aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle/sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpuidle/sysfs.c')
-rw-r--r--drivers/cpuidle/sysfs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index 84e62852e50a..ed87399bb02b 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -374,8 +374,8 @@ int cpuidle_add_state_sysfs(struct cpuidle_device *device)
374 kobj->state_usage = &device->states_usage[i]; 374 kobj->state_usage = &device->states_usage[i];
375 init_completion(&kobj->kobj_unregister); 375 init_completion(&kobj->kobj_unregister);
376 376
377 ret = kobject_init_and_add(&kobj->kobj, &ktype_state_cpuidle, &device->kobj, 377 ret = kobject_init_and_add(&kobj->kobj, &ktype_state_cpuidle,
378 "state%d", i); 378 &device->kobj, "state%d", i);
379 if (ret) { 379 if (ret) {
380 kfree(kobj); 380 kfree(kobj);
381 goto error_state; 381 goto error_state;
@@ -413,6 +413,8 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev)
413 struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu); 413 struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu);
414 int error; 414 int error;
415 415
416 init_completion(&dev->kobj_unregister);
417
416 error = kobject_init_and_add(&dev->kobj, &ktype_cpuidle, &cpu_dev->kobj, 418 error = kobject_init_and_add(&dev->kobj, &ktype_cpuidle, &cpu_dev->kobj,
417 "cpuidle"); 419 "cpuidle");
418 if (!error) 420 if (!error)
@@ -427,4 +429,5 @@ int cpuidle_add_sysfs(struct cpuidle_device *dev)
427void cpuidle_remove_sysfs(struct cpuidle_device *dev) 429void cpuidle_remove_sysfs(struct cpuidle_device *dev)
428{ 430{
429 kobject_put(&dev->kobj); 431 kobject_put(&dev->kobj);
432 wait_for_completion(&dev->kobj_unregister);
430} 433}