summaryrefslogtreecommitdiff
path: root/drivers/char/ipmi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/ipmi')
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 89b72425f9ce..8814f4bed862 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -265,6 +265,7 @@ struct ipmi_proc_entry {
struct bmc_device {
struct platform_device pdev;
struct ipmi_device_id id;
+ struct list_head intfs;
unsigned char guid[16];
int guid_set;
char name[16];
@@ -404,6 +405,7 @@ struct ipmi_smi {
struct bmc_device *bmc;
bool bmc_registered;
+ struct list_head bmc_link;
char *my_dev_name;
/*
@@ -2616,6 +2618,8 @@ static void ipmi_bmc_unregister(ipmi_smi_t intf)
intf->my_dev_name = NULL;
mutex_lock(&ipmidriver_mutex);
+ list_del(&intf->bmc_link);
+ intf->bmc = NULL;
kref_put(&bmc->usecount, cleanup_bmc_device);
mutex_unlock(&ipmidriver_mutex);
intf->bmc_registered = false;
@@ -2646,7 +2650,10 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum)
*/
if (old_bmc) {
kfree(bmc);
+ mutex_lock(&ipmidriver_mutex);
intf->bmc = old_bmc;
+ list_add_tail(&intf->bmc_link, &bmc->intfs);
+ mutex_unlock(&ipmidriver_mutex);
bmc = old_bmc;
printk(KERN_INFO
@@ -2697,6 +2704,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum)
kref_init(&bmc->usecount);
rv = platform_device_register(&bmc->pdev);
+ list_add_tail(&intf->bmc_link, &bmc->intfs);
mutex_unlock(&ipmidriver_mutex);
if (rv) {
printk(KERN_ERR
@@ -2761,6 +2769,7 @@ out_unlink1:
out_put_bmc:
mutex_lock(&ipmidriver_mutex);
+ list_del(&intf->bmc_link);
intf->bmc = NULL;
kref_put(&bmc->usecount, cleanup_bmc_device);
mutex_unlock(&ipmidriver_mutex);
@@ -2768,6 +2777,7 @@ out_put_bmc:
out_list_del:
mutex_lock(&ipmidriver_mutex);
+ list_del(&intf->bmc_link);
intf->bmc = NULL;
mutex_unlock(&ipmidriver_mutex);
put_device(&bmc->pdev.dev);
@@ -2990,6 +3000,7 @@ int ipmi_register_smi(const struct ipmi_smi_handlers *handlers,
kfree(intf);
return -ENOMEM;
}
+ INIT_LIST_HEAD(&intf->bmc->intfs);
intf->intf_num = -1; /* Mark it invalid for now. */
kref_init(&intf->refcount);
intf->bmc->id = *device_id;