diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-12-17 14:54:39 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:35 -0500 |
commit | c8e90d822bff3e0502d004facedb05859f98055f (patch) | |
tree | 12d37b4c20ab4ff6e55adcfbfff2bae8fdbeed41 /drivers/base/bus.c | |
parent | 7dc72b2842381684b864750af31a5fb168dec764 (diff) |
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>
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r-- | drivers/base/bus.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 937fc100b64a..aea579365f6d 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -643,15 +643,12 @@ int bus_add_driver(struct device_driver *drv) | |||
643 | if (!priv) | 643 | if (!priv) |
644 | return -ENOMEM; | 644 | return -ENOMEM; |
645 | 645 | ||
646 | error = kobject_set_name(&priv->kobj, "%s", drv->name); | ||
647 | if (error) | ||
648 | goto out_put_bus; | ||
649 | priv->kobj.kset = bus->p->drivers_kset; | ||
650 | priv->kobj.ktype = &driver_ktype; | ||
651 | klist_init(&priv->klist_devices, NULL, NULL); | 646 | klist_init(&priv->klist_devices, NULL, NULL); |
652 | priv->driver = drv; | 647 | priv->driver = drv; |
653 | drv->p = priv; | 648 | drv->p = priv; |
654 | error = kobject_register(&priv->kobj); | 649 | priv->kobj.kset = bus->p->drivers_kset; |
650 | error = kobject_init_and_add(&priv->kobj, &driver_ktype, NULL, | ||
651 | "%s", drv->name); | ||
655 | if (error) | 652 | if (error) |
656 | goto out_put_bus; | 653 | goto out_put_bus; |
657 | 654 | ||
@@ -681,6 +678,7 @@ int bus_add_driver(struct device_driver *drv) | |||
681 | __FUNCTION__, drv->name); | 678 | __FUNCTION__, drv->name); |
682 | } | 679 | } |
683 | 680 | ||
681 | kobject_uevent(&priv->kobj, KOBJ_ADD); | ||
684 | return error; | 682 | return error; |
685 | out_unregister: | 683 | out_unregister: |
686 | kobject_unregister(&priv->kobj); | 684 | kobject_unregister(&priv->kobj); |