diff options
author | Corey Minyard <cminyard@mvista.com> | 2018-04-05 22:03:35 -0500 |
---|---|---|
committer | Corey Minyard <cminyard@mvista.com> | 2018-04-18 10:22:59 -0500 |
commit | 7960f18a56475bf2177c5ff56c72eb4c12c56440 (patch) | |
tree | bc60689ccf2baebdbff23ae2c027b296144c012d /drivers/char/ipmi | |
parent | e86ee2d44b44056243da17c120ad258717cedf9b (diff) | |
download | linux-7960f18a56475bf2177c5ff56c72eb4c12c56440.tar.bz2 |
ipmi_si: Convert over to a shutdown handler
Move the shutdown handling to a shutdown function called from
the IPMI core code. That makes for a cleaner shutdown.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Diffstat (limited to 'drivers/char/ipmi')
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 24702ab853a8..00a324060dcd 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -1209,9 +1209,11 @@ static void set_maintenance_mode(void *send_info, bool enable) atomic_set(&smi_info->req_events, 0); } +static void shutdown_smi(void *send_info); static const struct ipmi_smi_handlers handlers = { .owner = THIS_MODULE, .start_processing = smi_start_processing, + .shutdown = shutdown_smi, .get_smi_info = get_smi_info, .sender = sender, .request_events = request_events, @@ -2301,20 +2303,9 @@ skip_fallback_noirq: } module_init(init_ipmi_si); -static void shutdown_one_si(struct smi_info *smi_info) +static void shutdown_smi(void *send_info) { - int rv = 0; - - if (smi_info->intf) { - ipmi_smi_t intf = smi_info->intf; - - smi_info->intf = NULL; - rv = ipmi_unregister_smi(intf); - if (rv) { - pr_err(PFX "Unable to unregister device: errno=%d\n", - rv); - } - } + struct smi_info *smi_info = send_info; if (smi_info->dev_group_added) { device_remove_group(smi_info->io.dev, &ipmi_si_dev_attr_group); @@ -2372,6 +2363,20 @@ static void shutdown_one_si(struct smi_info *smi_info) smi_info->si_sm = NULL; } +static void shutdown_one_si(struct smi_info *smi_info) +{ + int rv; + ipmi_smi_t intf = smi_info->intf; + + if (!intf) + return; + + smi_info->intf = NULL; + rv = ipmi_unregister_smi(intf); + if (rv) + pr_err(PFX "Unable to unregister device: errno=%d\n", rv); +} + static void cleanup_one_si(struct smi_info *smi_info) { if (!smi_info) |