driver core: move uevent call to driver_register
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Mon, 2 Jul 2012 17:08:15 +0000 (19:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Jul 2012 01:04:25 +0000 (18:04 -0700)
Device driver attribute groups are created after userspace is notified
via an add event. Fix this by moving the kobject_uevent call to
driver_register after the attribute groups are added.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/bus.c
drivers/base/driver.c

index 2bcef65..181ed26 100644 (file)
@@ -743,7 +743,6 @@ int bus_add_driver(struct device_driver *drv)
                }
        }
 
-       kobject_uevent(&priv->kobj, KOBJ_ADD);
        return 0;
 
 out_unregister:
index 207c27d..1b500d6 100644 (file)
@@ -187,6 +187,9 @@ int driver_register(struct device_driver *drv)
        ret = driver_add_groups(drv, drv->groups);
        if (ret)
                bus_remove_driver(drv);
+
+       kobject_uevent(&drv->p->kobj, KOBJ_ADD);
+
        return ret;
 }
 EXPORT_SYMBOL_GPL(driver_register);