aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/sys.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-11-01 11:29:06 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:15 -0500
commitaade4041aa60a3ed335391ba308458e26f2dbc0a (patch)
treef6fc8b8f94f328aa540071afe87eb5d9cc977a69 /drivers/base/sys.c
parent9b477705360c16198d7a4bd73d199f5a957585b0 (diff)
kset: convert /sys/devices/system to use kset_create
Dynamically create the kset instead of declaring it statically. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/sys.c')
-rw-r--r--drivers/base/sys.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 7693c95848e6..29eadc656bd1 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -126,19 +126,16 @@ void sysdev_class_remove_file(struct sysdev_class *c,
126} 126}
127EXPORT_SYMBOL_GPL(sysdev_class_remove_file); 127EXPORT_SYMBOL_GPL(sysdev_class_remove_file);
128 128
129/* 129static struct kset *system_kset;
130 * declare system_subsys
131 */
132static decl_subsys(system, NULL);
133 130
134int sysdev_class_register(struct sysdev_class * cls) 131int sysdev_class_register(struct sysdev_class * cls)
135{ 132{
136 pr_debug("Registering sysdev class '%s'\n", 133 pr_debug("Registering sysdev class '%s'\n",
137 kobject_name(&cls->kset.kobj)); 134 kobject_name(&cls->kset.kobj));
138 INIT_LIST_HEAD(&cls->drivers); 135 INIT_LIST_HEAD(&cls->drivers);
139 cls->kset.kobj.parent = &system_subsys.kobj; 136 cls->kset.kobj.parent = &system_kset->kobj;
140 cls->kset.kobj.ktype = &ktype_sysdev_class; 137 cls->kset.kobj.ktype = &ktype_sysdev_class;
141 cls->kset.kobj.kset = &system_subsys; 138 cls->kset.kobj.kset = system_kset;
142 return kset_register(&cls->kset); 139 return kset_register(&cls->kset);
143} 140}
144 141
@@ -297,8 +294,7 @@ void sysdev_shutdown(void)
297 pr_debug("Shutting Down System Devices\n"); 294 pr_debug("Shutting Down System Devices\n");
298 295
299 mutex_lock(&sysdev_drivers_lock); 296 mutex_lock(&sysdev_drivers_lock);
300 list_for_each_entry_reverse(cls, &system_subsys.list, 297 list_for_each_entry_reverse(cls, &system_kset->list, kset.kobj.entry) {
301 kset.kobj.entry) {
302 struct sys_device * sysdev; 298 struct sys_device * sysdev;
303 299
304 pr_debug("Shutting down type '%s':\n", 300 pr_debug("Shutting down type '%s':\n",
@@ -360,9 +356,7 @@ int sysdev_suspend(pm_message_t state)
360 356
361 pr_debug("Suspending System Devices\n"); 357 pr_debug("Suspending System Devices\n");
362 358
363 list_for_each_entry_reverse(cls, &system_subsys.list, 359 list_for_each_entry_reverse(cls, &system_kset->list, kset.kobj.entry) {
364 kset.kobj.entry) {
365
366 pr_debug("Suspending type '%s':\n", 360 pr_debug("Suspending type '%s':\n",
367 kobject_name(&cls->kset.kobj)); 361 kobject_name(&cls->kset.kobj));
368 362
@@ -413,8 +407,7 @@ aux_driver:
413 } 407 }
414 408
415 /* resume other classes */ 409 /* resume other classes */
416 list_for_each_entry_continue(cls, &system_subsys.list, 410 list_for_each_entry_continue(cls, &system_kset->list, kset.kobj.entry) {
417 kset.kobj.entry) {
418 list_for_each_entry(err_dev, &cls->kset.list, kobj.entry) { 411 list_for_each_entry(err_dev, &cls->kset.list, kobj.entry) {
419 pr_debug(" %s\n", kobject_name(&err_dev->kobj)); 412 pr_debug(" %s\n", kobject_name(&err_dev->kobj));
420 __sysdev_resume(err_dev); 413 __sysdev_resume(err_dev);
@@ -439,7 +432,7 @@ int sysdev_resume(void)
439 432
440 pr_debug("Resuming System Devices\n"); 433 pr_debug("Resuming System Devices\n");
441 434
442 list_for_each_entry(cls, &system_subsys.list, kset.kobj.entry) { 435 list_for_each_entry(cls, &system_kset->list, kset.kobj.entry) {
443 struct sys_device * sysdev; 436 struct sys_device * sysdev;
444 437
445 pr_debug("Resuming type '%s':\n", 438 pr_debug("Resuming type '%s':\n",
@@ -457,8 +450,10 @@ int sysdev_resume(void)
457 450
458int __init system_bus_init(void) 451int __init system_bus_init(void)
459{ 452{
460 system_subsys.kobj.parent = &devices_kset->kobj; 453 system_kset = kset_create_and_add("system", NULL, &devices_kset->kobj);
461 return subsystem_register(&system_subsys); 454 if (!system_kset)
455 return -ENOMEM;
456 return 0;
462} 457}
463 458
464EXPORT_SYMBOL_GPL(sysdev_register); 459EXPORT_SYMBOL_GPL(sysdev_register);