Commit 4443d07f authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

kset: convert parisc/pdc_stable.c to use kset_create

Dynamically create the kset instead of declaring it statically.
This makes the kobject attributes now work properly that I broke in the
previous patch.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Thibaut VARENE <varenet@parisc-linux.org>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Grant Grundler <grundler@parisc-linux.org>
Cc: Kyle McMartin <kyle@parisc-linux.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7f548217
...@@ -960,8 +960,8 @@ static struct attribute_group pdcs_attr_group = { ...@@ -960,8 +960,8 @@ static struct attribute_group pdcs_attr_group = {
.attrs = pdcs_subsys_attrs, .attrs = pdcs_subsys_attrs,
}; };
static decl_subsys(paths, NULL); static struct kset *stable_kset;
static decl_subsys(stable, NULL); static struct kset *paths_kset;
/** /**
* pdcs_register_pathentries - Prepares path entries kobjects for sysfs usage. * pdcs_register_pathentries - Prepares path entries kobjects for sysfs usage.
...@@ -993,7 +993,7 @@ pdcs_register_pathentries(void) ...@@ -993,7 +993,7 @@ pdcs_register_pathentries(void)
if ((err = kobject_set_name(&entry->kobj, "%s", entry->name))) if ((err = kobject_set_name(&entry->kobj, "%s", entry->name)))
return err; return err;
entry->kobj.kset = &paths_subsys; entry->kobj.kset = paths_kset;
entry->kobj.ktype = &ktype_pdcspath; entry->kobj.ktype = &ktype_pdcspath;
if ((err = kobject_register(&entry->kobj))) if ((err = kobject_register(&entry->kobj)))
return err; return err;
...@@ -1058,19 +1058,24 @@ pdc_stable_init(void) ...@@ -1058,19 +1058,24 @@ pdc_stable_init(void)
/* the actual result is 16 bits away */ /* the actual result is 16 bits away */
pdcs_osid = (u16)(result >> 16); pdcs_osid = (u16)(result >> 16);
/* For now we'll register the stable subsys within this driver */ /* For now we'll register the stable kset within this driver */
if ((rc = firmware_register(&stable_subsys))) stable_kset = kset_create_and_add("stable", NULL, &firmware_kset->kobj);
if (!stable_kset) {
rc = -ENOMEM;
goto fail_firmreg; goto fail_firmreg;
}
/* Don't forget the root entries */ /* Don't forget the root entries */
error = sysfs_create_group(&stable_subsys.kobj, pdcs_attr_group); error = sysfs_create_group(&stable_kset->kobj, pdcs_attr_group);
/* register the paths subsys as a subsystem of stable subsys */ /* register the paths kset as a child of the stable kset */
paths_subsys.kobj.kset = &stable_subsys; paths_kset = kset_create_and_add("paths", NULL, &stable_kset->kobj);
if ((rc = subsystem_register(&paths_subsys))) if (!paths_kset) {
goto fail_subsysreg; rc = -ENOMEM;
goto fail_ksetreg;
}
/* now we create all "files" for the paths subsys */ /* now we create all "files" for the paths kset */
if ((rc = pdcs_register_pathentries())) if ((rc = pdcs_register_pathentries()))
goto fail_pdcsreg; goto fail_pdcsreg;
...@@ -1078,10 +1083,10 @@ pdc_stable_init(void) ...@@ -1078,10 +1083,10 @@ pdc_stable_init(void)
fail_pdcsreg: fail_pdcsreg:
pdcs_unregister_pathentries(); pdcs_unregister_pathentries();
subsystem_unregister(&paths_subsys); kset_unregister(paths_kset);
fail_subsysreg: fail_ksetreg:
firmware_unregister(&stable_subsys); kset_unregister(stable_kset);
fail_firmreg: fail_firmreg:
printk(KERN_INFO PDCS_PREFIX " bailing out\n"); printk(KERN_INFO PDCS_PREFIX " bailing out\n");
...@@ -1092,9 +1097,8 @@ static void __exit ...@@ -1092,9 +1097,8 @@ static void __exit
pdc_stable_exit(void) pdc_stable_exit(void)
{ {
pdcs_unregister_pathentries(); pdcs_unregister_pathentries();
subsystem_unregister(&paths_subsys); kset_unregister(paths_kset);
kset_unregister(stable_kset);
firmware_unregister(&stable_subsys);
} }
......
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