浏览代码

drivers/base: Platform notify needs to occur before drivers attach to the device

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 <brian@walsh.ws>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Brian Walsh 19 年之前
父节点
当前提交
370226449c
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      drivers/base/core.c

+ 4 - 4
drivers/base/core.c

@@ -424,6 +424,10 @@ int device_add(struct device *dev)
 	if ((error = kobject_add(&dev->kobj)))
 	if ((error = kobject_add(&dev->kobj)))
 		goto Error;
 		goto Error;
 
 
+	/* notify platform of device entry */
+	if (platform_notify)
+		platform_notify(dev);
+
 	dev->uevent_attr.attr.name = "uevent";
 	dev->uevent_attr.attr.name = "uevent";
 	dev->uevent_attr.attr.mode = S_IWUSR;
 	dev->uevent_attr.attr.mode = S_IWUSR;
 	if (dev->driver)
 	if (dev->driver)
@@ -488,10 +492,6 @@ int device_add(struct device *dev)
 				class_intf->add_dev(dev, class_intf);
 				class_intf->add_dev(dev, class_intf);
 		up(&dev->class->sem);
 		up(&dev->class->sem);
 	}
 	}
-
-	/* notify platform of device entry */
-	if (platform_notify)
-		platform_notify(dev);
  Done:
  Done:
  	kfree(class_name);
  	kfree(class_name);
 	put_device(dev);
 	put_device(dev);