Kobject: change drivers/base/bus to use kobject_init_and_add
Stop using kobject_register, as this way we can control the sending of the uevent properly, after everything is properly initialized. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
7dc72b2842
commit
c8e90d822b
|
@ -643,15 +643,12 @@ int bus_add_driver(struct device_driver *drv)
|
||||||
if (!priv)
|
if (!priv)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
error = kobject_set_name(&priv->kobj, "%s", drv->name);
|
|
||||||
if (error)
|
|
||||||
goto out_put_bus;
|
|
||||||
priv->kobj.kset = bus->p->drivers_kset;
|
|
||||||
priv->kobj.ktype = &driver_ktype;
|
|
||||||
klist_init(&priv->klist_devices, NULL, NULL);
|
klist_init(&priv->klist_devices, NULL, NULL);
|
||||||
priv->driver = drv;
|
priv->driver = drv;
|
||||||
drv->p = priv;
|
drv->p = priv;
|
||||||
error = kobject_register(&priv->kobj);
|
priv->kobj.kset = bus->p->drivers_kset;
|
||||||
|
error = kobject_init_and_add(&priv->kobj, &driver_ktype, NULL,
|
||||||
|
"%s", drv->name);
|
||||||
if (error)
|
if (error)
|
||||||
goto out_put_bus;
|
goto out_put_bus;
|
||||||
|
|
||||||
|
@ -681,6 +678,7 @@ int bus_add_driver(struct device_driver *drv)
|
||||||
__FUNCTION__, drv->name);
|
__FUNCTION__, drv->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kobject_uevent(&priv->kobj, KOBJ_ADD);
|
||||||
return error;
|
return error;
|
||||||
out_unregister:
|
out_unregister:
|
||||||
kobject_unregister(&priv->kobj);
|
kobject_unregister(&priv->kobj);
|
||||||
|
|
Loading…
Reference in New Issue