Commit aade4041 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9b477705
...@@ -126,19 +126,16 @@ void sysdev_class_remove_file(struct sysdev_class *c, ...@@ -126,19 +126,16 @@ void sysdev_class_remove_file(struct sysdev_class *c,
} }
EXPORT_SYMBOL_GPL(sysdev_class_remove_file); EXPORT_SYMBOL_GPL(sysdev_class_remove_file);
/* static struct kset *system_kset;
* declare system_subsys
*/
static decl_subsys(system, NULL);
int sysdev_class_register(struct sysdev_class * cls) int sysdev_class_register(struct sysdev_class * cls)
{ {
pr_debug("Registering sysdev class '%s'\n", pr_debug("Registering sysdev class '%s'\n",
kobject_name(&cls->kset.kobj)); kobject_name(&cls->kset.kobj));
INIT_LIST_HEAD(&cls->drivers); INIT_LIST_HEAD(&cls->drivers);
cls->kset.kobj.parent = &system_subsys.kobj; cls->kset.kobj.parent = &system_kset->kobj;
cls->kset.kobj.ktype = &ktype_sysdev_class; cls->kset.kobj.ktype = &ktype_sysdev_class;
cls->kset.kobj.kset = &system_subsys; cls->kset.kobj.kset = system_kset;
return kset_register(&cls->kset); return kset_register(&cls->kset);
} }
...@@ -297,8 +294,7 @@ void sysdev_shutdown(void) ...@@ -297,8 +294,7 @@ void sysdev_shutdown(void)
pr_debug("Shutting Down System Devices\n"); pr_debug("Shutting Down System Devices\n");
mutex_lock(&sysdev_drivers_lock); mutex_lock(&sysdev_drivers_lock);
list_for_each_entry_reverse(cls, &system_subsys.list, list_for_each_entry_reverse(cls, &system_kset->list, kset.kobj.entry) {
kset.kobj.entry) {
struct sys_device * sysdev; struct sys_device * sysdev;
pr_debug("Shutting down type '%s':\n", pr_debug("Shutting down type '%s':\n",
...@@ -360,9 +356,7 @@ int sysdev_suspend(pm_message_t state) ...@@ -360,9 +356,7 @@ int sysdev_suspend(pm_message_t state)
pr_debug("Suspending System Devices\n"); pr_debug("Suspending System Devices\n");
list_for_each_entry_reverse(cls, &system_subsys.list, list_for_each_entry_reverse(cls, &system_kset->list, kset.kobj.entry) {
kset.kobj.entry) {
pr_debug("Suspending type '%s':\n", pr_debug("Suspending type '%s':\n",
kobject_name(&cls->kset.kobj)); kobject_name(&cls->kset.kobj));
...@@ -413,8 +407,7 @@ aux_driver: ...@@ -413,8 +407,7 @@ aux_driver:
} }
/* resume other classes */ /* resume other classes */
list_for_each_entry_continue(cls, &system_subsys.list, list_for_each_entry_continue(cls, &system_kset->list, kset.kobj.entry) {
kset.kobj.entry) {
list_for_each_entry(err_dev, &cls->kset.list, kobj.entry) { list_for_each_entry(err_dev, &cls->kset.list, kobj.entry) {
pr_debug(" %s\n", kobject_name(&err_dev->kobj)); pr_debug(" %s\n", kobject_name(&err_dev->kobj));
__sysdev_resume(err_dev); __sysdev_resume(err_dev);
...@@ -439,7 +432,7 @@ int sysdev_resume(void) ...@@ -439,7 +432,7 @@ int sysdev_resume(void)
pr_debug("Resuming System Devices\n"); pr_debug("Resuming System Devices\n");
list_for_each_entry(cls, &system_subsys.list, kset.kobj.entry) { list_for_each_entry(cls, &system_kset->list, kset.kobj.entry) {
struct sys_device * sysdev; struct sys_device * sysdev;
pr_debug("Resuming type '%s':\n", pr_debug("Resuming type '%s':\n",
...@@ -457,8 +450,10 @@ int sysdev_resume(void) ...@@ -457,8 +450,10 @@ int sysdev_resume(void)
int __init system_bus_init(void) int __init system_bus_init(void)
{ {
system_subsys.kobj.parent = &devices_kset->kobj; system_kset = kset_create_and_add("system", NULL, &devices_kset->kobj);
return subsystem_register(&system_subsys); if (!system_kset)
return -ENOMEM;
return 0;
} }
EXPORT_SYMBOL_GPL(sysdev_register); EXPORT_SYMBOL_GPL(sysdev_register);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment