diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-12-17 20:54:39 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-25 05:40:28 +0100 |
commit | 61030bfb79148b12b661580c8e3c2adfe1d9fc9e (patch) | |
tree | 7195206ee71ddec9e27e9d995ce09f76c2095f3f /drivers/base/sys.c | |
parent | Kobject: change drivers/pci/hotplug/pci_hotplug_core.c to use kobject_init_an... (diff) | |
download | linux-61030bfb79148b12b661580c8e3c2adfe1d9fc9e.tar.xz linux-61030bfb79148b12b661580c8e3c2adfe1d9fc9e.zip |
Kobject: change drivers/base/sys.c 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/sys.c')
-rw-r--r-- | drivers/base/sys.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 29eadc656bd1..47fc6eb6473f 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c @@ -224,20 +224,15 @@ int sysdev_register(struct sys_device * sysdev) if (!cls) return -EINVAL; + pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj)); + /* Make sure the kset is set */ sysdev->kobj.kset = &cls->kset; - /* But make sure we point to the right type for sysfs translation */ - sysdev->kobj.ktype = &ktype_sysdev; - error = kobject_set_name(&sysdev->kobj, "%s%d", - kobject_name(&cls->kset.kobj), sysdev->id); - if (error) - return error; - - pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj)); - /* Register the object */ - error = kobject_register(&sysdev->kobj); + error = kobject_init_and_add(&sysdev->kobj, &ktype_sysdev, NULL, + "%s%d", kobject_name(&cls->kset.kobj), + sysdev->id); if (!error) { struct sysdev_driver * drv; @@ -254,6 +249,7 @@ int sysdev_register(struct sys_device * sysdev) } mutex_unlock(&sysdev_drivers_lock); } + kobject_uevent(&sysdev->kobj, KOBJ_ADD); return error; } |