From akpm@osdl.org Mon Aug 14 22:43:54 2006 Message-Id: <200608150543.k7F5hK8v011750@shell0.pdx.osdl.net> Subject: drivers/base: Platform notify needs to occur before drivers attach to the device To: greg@kroah.com Cc: akpm@osdl.org, brian@walsh.ws From: akpm@osdl.org Date: Mon, 14 Aug 2006 22:43:19 -0700 From: Brian Walsh The platform_notify call for Arm and PPC architectures needs to be called before the driver attaches to the device. The problem only presents itself when hotplugging certain devices while the driver is already loaded. Signed-off-by: Brian Walsh Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- drivers/base/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- gregkh-2.6.orig/drivers/base/core.c +++ gregkh-2.6/drivers/base/core.c @@ -424,6 +424,10 @@ int device_add(struct device *dev) if ((error = kobject_add(&dev->kobj))) goto Error; + /* notify platform of device entry */ + if (platform_notify) + platform_notify(dev); + dev->uevent_attr.attr.name = "uevent"; dev->uevent_attr.attr.mode = S_IWUSR; if (dev->driver) @@ -488,10 +492,6 @@ int device_add(struct device *dev) class_intf->add_dev(dev, class_intf); up(&dev->class->sem); } - - /* notify platform of device entry */ - if (platform_notify) - platform_notify(dev); Done: kfree(class_name); put_device(dev);