[PATCH] driver core: restore event order for device_add()
authorKay Sievers <kay.sievers@vrfy.org>
Mon, 23 May 2005 22:50:26 +0000 (15:50 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 23 May 2005 23:08:12 +0000 (16:08 -0700)
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: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/base/core.c

index d21eb7744496de8b6705df42def7a60347842416..fbc223486f81b2b8380b0e157a81e429986ff73c 100644 (file)
@@ -245,6 +245,7 @@ int device_add(struct device *dev)
 
        if ((error = kobject_add(&dev->kobj)))
                goto Error;
+       kobject_hotplug(&dev->kobj, KOBJ_ADD);
        if ((error = device_pm_add(dev)))
                goto PMError;
        if ((error = bus_add_device(dev)))
@@ -257,14 +258,13 @@ int device_add(struct device *dev)
        /* notify platform of device entry */
        if (platform_notify)
                platform_notify(dev);
-
-       kobject_hotplug(&dev->kobj, KOBJ_ADD);
  Done:
        put_device(dev);
        return error;
  BusError:
        device_pm_remove(dev);
  PMError:
+       kobject_hotplug(&dev->kobj, KOBJ_REMOVE);
        kobject_del(&dev->kobj);
  Error:
        if (parent)