diff options
author | Corey Minyard <cminyard@mvista.com> | 2019-02-21 17:21:50 -0600 |
---|---|---|
committer | Corey Minyard <cminyard@mvista.com> | 2019-02-22 07:12:41 -0600 |
commit | bdb57b7bc16252599cbcb826dfdf7e394dd2af4b (patch) | |
tree | 377900c887e5721b13705fa01ae16276be248a31 /drivers/char/ipmi/ipmi_si_intf.c | |
parent | 1a84df2df8ebb1083cb57be6808fbf36d9cabe0e (diff) | |
download | linux-stable-bdb57b7bc16252599cbcb826dfdf7e394dd2af4b.tar.gz linux-stable-bdb57b7bc16252599cbcb826dfdf7e394dd2af4b.tar.bz2 linux-stable-bdb57b7bc16252599cbcb826dfdf7e394dd2af4b.zip |
ipmi_si: Remove hotmod devices on removal and exit
When a hotmod-added device is removed or when the module is removed,
remove the platform devices that was created for it.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Diffstat (limited to 'drivers/char/ipmi/ipmi_si_intf.c')
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index c8af06dfa244..9b3a272af7dd 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -2281,11 +2281,12 @@ int ipmi_si_remove_by_dev(struct device *dev) return rv; } -void ipmi_si_remove_by_data(int addr_space, enum si_type si_type, - unsigned long addr) +struct device *ipmi_si_remove_by_data(int addr_space, enum si_type si_type, + unsigned long addr) { /* remove */ struct smi_info *e, *tmp_e; + struct device *dev = NULL; mutex_lock(&smi_infos_lock); list_for_each_entry_safe(e, tmp_e, &smi_infos, link) { @@ -2293,10 +2294,14 @@ void ipmi_si_remove_by_data(int addr_space, enum si_type si_type, continue; if (e->io.si_type != si_type) continue; - if (e->io.addr_data == addr) + if (e->io.addr_data == addr) { + dev = get_device(e->io.dev); cleanup_one_si(e); + } } mutex_unlock(&smi_infos_lock); + + return dev; } static void cleanup_ipmi_si(void) @@ -2318,6 +2323,7 @@ static void cleanup_ipmi_si(void) mutex_unlock(&smi_infos_lock); ipmi_si_hardcode_exit(); + ipmi_si_hotmod_exit(); } module_exit(cleanup_ipmi_si); |