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:28 -0500 |
commit | 61030bfb79148b12b661580c8e3c2adfe1d9fc9e (patch) | |
tree | 7195206ee71ddec9e27e9d995ce09f76c2095f3f | |
parent | 64dbcac3a16d0d22045b2c80d7f208196575486a (diff) |
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>
-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) | |||
224 | if (!cls) | 224 | if (!cls) |
225 | return -EINVAL; | 225 | return -EINVAL; |
226 | 226 | ||
227 | pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj)); | ||
228 | |||
227 | /* Make sure the kset is set */ | 229 | /* Make sure the kset is set */ |
228 | sysdev->kobj.kset = &cls->kset; | 230 | sysdev->kobj.kset = &cls->kset; |
229 | 231 | ||
230 | /* But make sure we point to the right type for sysfs translation */ | ||
231 | sysdev->kobj.ktype = &ktype_sysdev; | ||
232 | error = kobject_set_name(&sysdev->kobj, "%s%d", | ||
233 | kobject_name(&cls->kset.kobj), sysdev->id); | ||
234 | if (error) | ||
235 | return error; | ||
236 | |||
237 | pr_debug("Registering sys device '%s'\n", kobject_name(&sysdev->kobj)); | ||
238 | |||
239 | /* Register the object */ | 232 | /* Register the object */ |
240 | error = kobject_register(&sysdev->kobj); | 233 | error = kobject_init_and_add(&sysdev->kobj, &ktype_sysdev, NULL, |
234 | "%s%d", kobject_name(&cls->kset.kobj), | ||
235 | sysdev->id); | ||
241 | 236 | ||
242 | if (!error) { | 237 | if (!error) { |
243 | struct sysdev_driver * drv; | 238 | struct sysdev_driver * drv; |
@@ -254,6 +249,7 @@ int sysdev_register(struct sys_device * sysdev) | |||
254 | } | 249 | } |
255 | mutex_unlock(&sysdev_drivers_lock); | 250 | mutex_unlock(&sysdev_drivers_lock); |
256 | } | 251 | } |
252 | kobject_uevent(&sysdev->kobj, KOBJ_ADD); | ||
257 | return error; | 253 | return error; |
258 | } | 254 | } |
259 | 255 | ||