aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/cpuidle/sysfs.c17
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/**