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 | 94f57f33680922197581b127b3badde7ef658258 (patch) | |
tree | 6bd9162944d0b90a4ae153f3ec29d0073d64f67b /drivers | |
parent | b2ed215a3338b8b16187be8d136153054118a41e (diff) |
Kobject: change drivers/cpuidle/sysfs.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: Shaohua Li <shaohua.li@intel.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cpuidle/sysfs.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c index 0f3515e77d4b..059db9c21474 100644 --- a/drivers/cpuidle/sysfs.c +++ b/drivers/cpuidle/sysfs.c | |||
@@ -300,14 +300,13 @@ int cpuidle_add_state_sysfs(struct cpuidle_device *device) | |||
300 | kobj->state = &device->states[i]; | 300 | kobj->state = &device->states[i]; |
301 | init_completion(&kobj->kobj_unregister); | 301 | init_completion(&kobj->kobj_unregister); |
302 | 302 | ||
303 | kobj->kobj.parent = &device->kobj; | 303 | ret = kobject_init_and_add(&kobj->kobj, &ktype_state_cpuidle, &device->kobj, |
304 | kobj->kobj.ktype = &ktype_state_cpuidle; | 304 | "state%d", i); |
305 | kobject_set_name(&kobj->kobj, "state%d", i); | ||
306 | ret = kobject_register(&kobj->kobj); | ||
307 | if (ret) { | 305 | if (ret) { |
308 | kfree(kobj); | 306 | kfree(kobj); |
309 | goto error_state; | 307 | goto error_state; |
310 | } | 308 | } |
309 | kobject_uevent(&kobj->kobj, KOBJ_ADD); | ||
311 | device->kobjs[i] = kobj; | 310 | device->kobjs[i] = kobj; |
312 | } | 311 | } |
313 | 312 | ||
@@ -339,12 +338,14 @@ int cpuidle_add_sysfs(struct sys_device *sysdev) | |||
339 | { | 338 | { |
340 | int cpu = sysdev->id; | 339 | int cpu = sysdev->id; |
341 | struct cpuidle_device *dev; | 340 | struct cpuidle_device *dev; |
341 | int error; | ||
342 | 342 | ||
343 | dev = per_cpu(cpuidle_devices, cpu); | 343 | dev = per_cpu(cpuidle_devices, cpu); |
344 | dev->kobj.parent = &sysdev->kobj; | 344 | error = kobject_init_and_add(&dev->kobj, &ktype_cpuidle, &sysdev->kobj, |
345 | dev->kobj.ktype = &ktype_cpuidle; | 345 | "cpuidle"); |
346 | kobject_set_name(&dev->kobj, "%s", "cpuidle"); | 346 | if (!error) |
347 | return kobject_register(&dev->kobj); | 347 | kobject_uevent(&dev->kobj, KOBJ_ADD); |
348 | return error; | ||
348 | } | 349 | } |
349 | 350 | ||
350 | /** | 351 | /** |