Commit 187a1a94 authored by Kay Sievers's avatar Kay Sievers Committed by Linus Torvalds

[PATCH] driver core: restore event order for device_add()

As a result of the split of the kobject-registration and the
corresponding hotplug event, the order of events for device_add() has
changed. This restores the old order, cause it confused some userspace
applications.
Signed-off-by: default avatarKay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ab3fc403
...@@ -245,6 +245,7 @@ int device_add(struct device *dev) ...@@ -245,6 +245,7 @@ int device_add(struct device *dev)
if ((error = kobject_add(&dev->kobj))) if ((error = kobject_add(&dev->kobj)))
goto Error; goto Error;
kobject_hotplug(&dev->kobj, KOBJ_ADD);
if ((error = device_pm_add(dev))) if ((error = device_pm_add(dev)))
goto PMError; goto PMError;
if ((error = bus_add_device(dev))) if ((error = bus_add_device(dev)))
...@@ -257,14 +258,13 @@ int device_add(struct device *dev) ...@@ -257,14 +258,13 @@ int device_add(struct device *dev)
/* notify platform of device entry */ /* notify platform of device entry */
if (platform_notify) if (platform_notify)
platform_notify(dev); platform_notify(dev);
kobject_hotplug(&dev->kobj, KOBJ_ADD);
Done: Done:
put_device(dev); put_device(dev);
return error; return error;
BusError: BusError:
device_pm_remove(dev); device_pm_remove(dev);
PMError: PMError:
kobject_hotplug(&dev->kobj, KOBJ_REMOVE);
kobject_del(&dev->kobj); kobject_del(&dev->kobj);
Error: Error:
if (parent) if (parent)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment