Skip to content

Commit 443dbf9

Browse files
committed
kset: convert drivers/base/class.c to use kset_create
Dynamically create the kset instead of declaring it statically. The class_obj subsystem is not yet converted as it is more complex and should be going away soon with the removal of class_device from the kernel tree. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 59a5483 commit 443dbf9

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

‎drivers/base/class.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static struct kobj_type class_ktype = {
7171
};
7272

7373
/* Hotplug events for classes go to the class_obj subsys */
74-
static decl_subsys(class, NULL);
74+
static struct kset *class_kset;
7575

7676

7777
int class_create_file(struct class * cls, const struct class_attribute * attr)
@@ -149,7 +149,7 @@ int class_register(struct class * cls)
149149
if (error)
150150
return error;
151151

152-
cls->subsys.kobj.kset = &class_subsys;
152+
cls->subsys.kobj.kset = class_kset;
153153
cls->subsys.kobj.ktype = &class_ktype;
154154

155155
error = subsystem_register(&cls->subsys);
@@ -855,11 +855,9 @@ void class_interface_unregister(struct class_interface *class_intf)
855855

856856
int __init classes_init(void)
857857
{
858-
int retval;
859-
860-
retval = subsystem_register(&class_subsys);
861-
if (retval)
862-
return retval;
858+
class_kset = kset_create_and_add("class", NULL, NULL);
859+
if (!class_kset)
860+
return -ENOMEM;
863861

864862
/* ick, this is ugly, the things we go through to keep from showing up
865863
* in sysfs... */

0 commit comments

Comments
 (0)