aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle/sysfs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:34:42 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-25 11:35:13 -0500
commitdf8dc74e8a383eaf2d9b44b80a71ec6f0e52b42e (patch)
treebc3799a43e8b94fa84b32e37b1c124d5e4868f50 /drivers/cpuidle/sysfs.c
parent556a169dab38b5100df6f4a45b655dddd3db94c1 (diff)
parent4a3ad20ccd8f4d2a0535cf98fa83f7b561ba59a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
This can be broken down into these major areas: - Documentation updates (language translations and fixes, as well as kobject and kset documenatation updates.) - major kset/kobject/ktype rework and fixes. This cleans up the kset and kobject and ktype relationship and architecture, making sense of things now, and good documenation and samples are provided for others to use. Also the attributes for kobjects are much easier to handle now. This cleaned up a LOT of code all through the kernel, making kobjects easier to use if you want to. - struct bus_type has been reworked to now handle the lifetime rules properly, as the kobject is properly dynamic. - struct driver has also been reworked, and now the lifetime issues are resolved. - the block subsystem has been converted to use struct device now, and not "raw" kobjects. This patch has been in the -mm tree for over a year now, and finally all the issues are worked out with it. Older distros now properly work with new kernels, and no userspace updates are needed at all. - nozomi driver is added. This has also been in -mm for a long time, and many people have asked for it to go in. It is now in good enough shape to do so. - lots of class_device conversions to use struct device instead. The tree is almost all cleaned up now, only SCSI and IB is the remaining code to fix up... * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (196 commits) Driver core: coding style fixes Kobject: fix coding style issues in kobject c files Kobject: fix coding style issues in kobject.h Driver core: fix coding style issues in device.h spi: use class iteration api scsi: use class iteration api rtc: use class iteration api power supply : use class iteration api ieee1394: use class iteration api Driver Core: add class iteration api Driver core: Cleanup get_device_parent() in device_add() and device_move() UIO: constify function pointer tables Driver Core: constify the name passed to platform_device_register_simple driver core: fix build with SYSFS=n sysfs: make SYSFS_DEPRECATED depend on SYSFS Driver core: use LIST_HEAD instead of call to INIT_LIST_HEAD in __init kobject: add sample code for how to use ksets/ktypes/kobjects kobject: add sample code for how to use kobjects in a simple manner. kobject: update the kobject/kset documentation kobject: remove old, outdated documentation. ...
Diffstat (limited to 'drivers/cpuidle/sysfs.c')
-rw-r--r--drivers/cpuidle/sysfs.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index 0f3515e77d4b..088ea74edd34 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -277,7 +277,7 @@ static struct kobj_type ktype_state_cpuidle = {
277 277
278static void inline cpuidle_free_state_kobj(struct cpuidle_device *device, int i) 278static void inline cpuidle_free_state_kobj(struct cpuidle_device *device, int i)
279{ 279{
280 kobject_unregister(&device->kobjs[i]->kobj); 280 kobject_put(&device->kobjs[i]->kobj);
281 wait_for_completion(&device->kobjs[i]->kobj_unregister); 281 wait_for_completion(&device->kobjs[i]->kobj_unregister);
282 kfree(device->kobjs[i]); 282 kfree(device->kobjs[i]);
283 device->kobjs[i] = NULL; 283 device->kobjs[i] = NULL;
@@ -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/**
@@ -357,5 +358,5 @@ void cpuidle_remove_sysfs(struct sys_device *sysdev)
357 struct cpuidle_device *dev; 358 struct cpuidle_device *dev;
358 359
359 dev = per_cpu(cpuidle_devices, cpu); 360 dev = per_cpu(cpuidle_devices, cpu);
360 kobject_unregister(&dev->kobj); 361 kobject_put(&dev->kobj);
361} 362}