diff options
author | Zhang, Yanmin <yanmin_zhang@linux.intel.com> | 2006-11-16 01:19:08 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-11-16 11:43:37 -0800 |
commit | b48f5457b4e9d64d9c1117a4ece247d98b4db49f (patch) | |
tree | 6cccfbd1a7863ea830448b981019a7357997daf8 /drivers | |
parent | 44597f65f6af3c692560a639f61d25398d13d1b6 (diff) |
[PATCH] ipmi: use platform_device_add() instead of platform_device_register() to register device allocated dynamically
I got below warning when running 2.6.19-rc5-mm1 on my ia64 machine.
WARNING at lib/kobject.c:172 kobject_init()
Call Trace:
[<a0000001000137c0>] show_stack+0x40/0xa0
sp=e0000002ff9f7bc0 bsp=e0000002ff9f0d10
[<a000000100013850>] dump_stack+0x30/0x60
sp=e0000002ff9f7d90 bsp=e0000002ff9f0cf8
[<a000000100407bb0>] kobject_init+0x90/0x160
sp=e0000002ff9f7d90 bsp=e0000002ff9f0cd0
[<a0000001005ae080>] device_initialize+0x40/0x1c0
sp=e0000002ff9f7da0 bsp=e0000002ff9f0cb0
[<a0000001005b88c0>] platform_device_register+0x20/0x60
sp=e0000002ff9f7dd0 bsp=e0000002ff9f0c90
[<a000000100592560>] try_smi_init+0xbc0/0x11e0
sp=e0000002ff9f7dd0 bsp=e0000002ff9f0c50
[<a000000100594900>] init_ipmi_si+0xaa0/0x12e0
sp=e0000002ff9f7de0 bsp=e0000002ff9f0bd8
[<a000000100009910>] init+0x350/0x780
sp=e0000002ff9f7e00 bsp=e0000002ff9f0ba8
[<a000000100011d30>] kernel_thread_helper+0x30/0x60
sp=e0000002ff9f7e30 bsp=e0000002ff9f0b80
[<a0000001000090c0>] start_kernel_thread+0x20/0x40
sp=e0000002ff9f7e30 bsp=e0000002ff9f0b80
WARNING at lib/kobject.c:172 kobject_init()
Call Trace:
[<a0000001000137c0>] show_stack+0x40/0xa0
sp=e0000002ff9f7b40 bsp=e0000002ff9f0db0
[<a000000100013850>] dump_stack+0x30/0x60
sp=e0000002ff9f7d10 bsp=e0000002ff9f0d98
[<a000000100407bb0>] kobject_init+0x90/0x160
sp=e0000002ff9f7d10 bsp=e0000002ff9f0d70
[<a0000001005ae080>] device_initialize+0x40/0x1c0
sp=e0000002ff9f7d20 bsp=e0000002ff9f0d50
[<a0000001005b88c0>] platform_device_register+0x20/0x60
sp=e0000002ff9f7d50 bsp=e0000002ff9f0d30
[<a00000010058ac00>] ipmi_register_smi+0xcc0/0x18e0
sp=e0000002ff9f7d50 bsp=e0000002ff9f0c90
[<a000000100592600>] try_smi_init+0xc60/0x11e0
sp=e0000002ff9f7dd0 bsp=e0000002ff9f0c50
[<a000000100594900>] init_ipmi_si+0xaa0/0x12e0
sp=e0000002ff9f7de0 bsp=e0000002ff9f0bd8
[<a000000100009910>] init+0x350/0x780
sp=e0000002ff9f7e00 bsp=e0000002ff9f0ba8
[<a000000100011d30>] kernel_thread_helper+0x30/0x60
sp=e0000002ff9f7e30 bsp=e0000002ff9f0b80
[<a0000001000090c0>] start_kernel_thread+0x20/0x40
sp=e0000002ff9f7e30 bsp=e0000002ff9f0b80
The root cause is the device struct is initialized twice.
If the device is allocated dynamically by platform_device_alloc,
platform_device_alloc will initialize struct device, then,
platform_device_add should be used to register the device.
The difference between platform_device_register and platform_device_add is
platform_device_register will initiate the device while platform_device_add
won't.
Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com>
Cc: Corey Minyard <minyard@acm.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/ipmi/ipmi_msghandler.c | 2 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_intf.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index a41b8df2407..c47add8e47d 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -2118,7 +2118,7 @@ static int ipmi_bmc_register(ipmi_smi_t intf) dev_set_drvdata(&bmc->dev->dev, bmc); kref_init(&bmc->refcount); - rv = platform_device_register(bmc->dev); + rv = platform_device_add(bmc->dev); mutex_unlock(&ipmidriver_mutex); if (rv) { printk(KERN_ERR diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index abc5149e30e..bb1fac104fd 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -2346,7 +2346,7 @@ static int try_smi_init(struct smi_info *new_smi) new_smi->dev = &new_smi->pdev->dev; new_smi->dev->driver = &ipmi_driver; - rv = platform_device_register(new_smi->pdev); + rv = platform_device_add(new_smi->pdev); if (rv) { printk(KERN_ERR "ipmi_si_intf:" |