Commit 7960f18a authored by Corey Minyard's avatar Corey Minyard

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: default avatarCorey Minyard <cminyard@mvista.com>
parent e86ee2d4
...@@ -1209,9 +1209,11 @@ static void set_maintenance_mode(void *send_info, bool enable) ...@@ -1209,9 +1209,11 @@ static void set_maintenance_mode(void *send_info, bool enable)
atomic_set(&smi_info->req_events, 0); atomic_set(&smi_info->req_events, 0);
} }
static void shutdown_smi(void *send_info);
static const struct ipmi_smi_handlers handlers = { static const struct ipmi_smi_handlers handlers = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.start_processing = smi_start_processing, .start_processing = smi_start_processing,
.shutdown = shutdown_smi,
.get_smi_info = get_smi_info, .get_smi_info = get_smi_info,
.sender = sender, .sender = sender,
.request_events = request_events, .request_events = request_events,
...@@ -2301,20 +2303,9 @@ static int init_ipmi_si(void) ...@@ -2301,20 +2303,9 @@ static int init_ipmi_si(void)
} }
module_init(init_ipmi_si); 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; struct smi_info *smi_info = send_info;
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);
}
}
if (smi_info->dev_group_added) { if (smi_info->dev_group_added) {
device_remove_group(smi_info->io.dev, &ipmi_si_dev_attr_group); 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) ...@@ -2372,6 +2363,20 @@ static void shutdown_one_si(struct smi_info *smi_info)
smi_info->si_sm = NULL; 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) static void cleanup_one_si(struct smi_info *smi_info)
{ {
if (!smi_info) if (!smi_info)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment