aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ipmi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/ipmi')
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c34
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c1
2 files changed, 29 insertions, 6 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 761ed2699204..6a77b264eb2c 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -205,6 +205,7 @@ struct ipmi_smi
205 205
206 struct bmc_device *bmc; 206 struct bmc_device *bmc;
207 char *my_dev_name; 207 char *my_dev_name;
208 char *sysfs_name;
208 209
209 /* This is the lower-layer's sender routine. */ 210 /* This is the lower-layer's sender routine. */
210 struct ipmi_smi_handlers *handlers; 211 struct ipmi_smi_handlers *handlers;
@@ -2004,7 +2005,11 @@ static void ipmi_bmc_unregister(ipmi_smi_t intf)
2004{ 2005{
2005 struct bmc_device *bmc = intf->bmc; 2006 struct bmc_device *bmc = intf->bmc;
2006 2007
2007 sysfs_remove_link(&intf->si_dev->kobj, "bmc"); 2008 if (intf->sysfs_name) {
2009 sysfs_remove_link(&intf->si_dev->kobj, intf->sysfs_name);
2010 kfree(intf->sysfs_name);
2011 intf->sysfs_name = NULL;
2012 }
2008 if (intf->my_dev_name) { 2013 if (intf->my_dev_name) {
2009 sysfs_remove_link(&bmc->dev->dev.kobj, intf->my_dev_name); 2014 sysfs_remove_link(&bmc->dev->dev.kobj, intf->my_dev_name);
2010 kfree(intf->my_dev_name); 2015 kfree(intf->my_dev_name);
@@ -2140,7 +2145,8 @@ out:
2140 return err; 2145 return err;
2141} 2146}
2142 2147
2143static int ipmi_bmc_register(ipmi_smi_t intf) 2148static int ipmi_bmc_register(ipmi_smi_t intf, int ifnum,
2149 const char *sysfs_name)
2144{ 2150{
2145 int rv; 2151 int rv;
2146 struct bmc_device *bmc = intf->bmc; 2152 struct bmc_device *bmc = intf->bmc;
@@ -2257,29 +2263,44 @@ static int ipmi_bmc_register(ipmi_smi_t intf)
2257 * create symlink from system interface device to bmc device 2263 * create symlink from system interface device to bmc device
2258 * and back. 2264 * and back.
2259 */ 2265 */
2266 intf->sysfs_name = kstrdup(sysfs_name, GFP_KERNEL);
2267 if (!intf->sysfs_name) {
2268 rv = -ENOMEM;
2269 printk(KERN_ERR
2270 "ipmi_msghandler: allocate link to BMC: %d\n",
2271 rv);
2272 goto out_err;
2273 }
2274
2260 rv = sysfs_create_link(&intf->si_dev->kobj, 2275 rv = sysfs_create_link(&intf->si_dev->kobj,
2261 &bmc->dev->dev.kobj, "bmc"); 2276 &bmc->dev->dev.kobj, intf->sysfs_name);
2262 if (rv) { 2277 if (rv) {
2278 kfree(intf->sysfs_name);
2279 intf->sysfs_name = NULL;
2263 printk(KERN_ERR 2280 printk(KERN_ERR
2264 "ipmi_msghandler: Unable to create bmc symlink: %d\n", 2281 "ipmi_msghandler: Unable to create bmc symlink: %d\n",
2265 rv); 2282 rv);
2266 goto out_err; 2283 goto out_err;
2267 } 2284 }
2268 2285
2269 size = snprintf(dummy, 0, "ipmi%d", intf->intf_num); 2286 size = snprintf(dummy, 0, "ipmi%d", ifnum);
2270 intf->my_dev_name = kmalloc(size+1, GFP_KERNEL); 2287 intf->my_dev_name = kmalloc(size+1, GFP_KERNEL);
2271 if (!intf->my_dev_name) { 2288 if (!intf->my_dev_name) {
2289 kfree(intf->sysfs_name);
2290 intf->sysfs_name = NULL;
2272 rv = -ENOMEM; 2291 rv = -ENOMEM;
2273 printk(KERN_ERR 2292 printk(KERN_ERR
2274 "ipmi_msghandler: allocate link from BMC: %d\n", 2293 "ipmi_msghandler: allocate link from BMC: %d\n",
2275 rv); 2294 rv);
2276 goto out_err; 2295 goto out_err;
2277 } 2296 }
2278 snprintf(intf->my_dev_name, size+1, "ipmi%d", intf->intf_num); 2297 snprintf(intf->my_dev_name, size+1, "ipmi%d", ifnum);
2279 2298
2280 rv = sysfs_create_link(&bmc->dev->dev.kobj, &intf->si_dev->kobj, 2299 rv = sysfs_create_link(&bmc->dev->dev.kobj, &intf->si_dev->kobj,
2281 intf->my_dev_name); 2300 intf->my_dev_name);
2282 if (rv) { 2301 if (rv) {
2302 kfree(intf->sysfs_name);
2303 intf->sysfs_name = NULL;
2283 kfree(intf->my_dev_name); 2304 kfree(intf->my_dev_name);
2284 intf->my_dev_name = NULL; 2305 intf->my_dev_name = NULL;
2285 printk(KERN_ERR 2306 printk(KERN_ERR
@@ -2464,6 +2485,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
2464 void *send_info, 2485 void *send_info,
2465 struct ipmi_device_id *device_id, 2486 struct ipmi_device_id *device_id,
2466 struct device *si_dev, 2487 struct device *si_dev,
2488 const char *sysfs_name,
2467 unsigned char slave_addr) 2489 unsigned char slave_addr)
2468{ 2490{
2469 int i, j; 2491 int i, j;
@@ -2579,7 +2601,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
2579 if (rv == 0) 2601 if (rv == 0)
2580 rv = add_proc_entries(intf, i); 2602 rv = add_proc_entries(intf, i);
2581 2603
2582 rv = ipmi_bmc_register(intf); 2604 rv = ipmi_bmc_register(intf, i, sysfs_name);
2583 2605
2584 out: 2606 out:
2585 if (rv) { 2607 if (rv) {
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index bb1fac104fda..89cdb928061c 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2362,6 +2362,7 @@ static int try_smi_init(struct smi_info *new_smi)
2362 new_smi, 2362 new_smi,
2363 &new_smi->device_id, 2363 &new_smi->device_id,
2364 new_smi->dev, 2364 new_smi->dev,
2365 "bmc",
2365 new_smi->slave_addr); 2366 new_smi->slave_addr);
2366 if (rv) { 2367 if (rv) {
2367 printk(KERN_ERR 2368 printk(KERN_ERR