diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-11-02 18:25:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:21 -0500 |
commit | 4443d07fcfab39c4d2d9d7711cff983f15b374fc (patch) | |
tree | f0d6de1ce686072c8c7c5a6fadf8db7ea0304a9d | |
parent | 7f548217860a7cf8a345d87792a07512450dfbff (diff) |
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: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/parisc/pdc_stable.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index e1b9cbaf4456..444483405abf 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c | |||
@@ -960,8 +960,8 @@ static struct attribute_group pdcs_attr_group = { | |||
960 | .attrs = pdcs_subsys_attrs, | 960 | .attrs = pdcs_subsys_attrs, |
961 | }; | 961 | }; |
962 | 962 | ||
963 | static decl_subsys(paths, NULL); | 963 | static struct kset *stable_kset; |
964 | static decl_subsys(stable, NULL); | 964 | static struct kset *paths_kset; |
965 | 965 | ||
966 | /** | 966 | /** |
967 | * pdcs_register_pathentries - Prepares path entries kobjects for sysfs usage. | 967 | * pdcs_register_pathentries - Prepares path entries kobjects for sysfs usage. |
@@ -993,7 +993,7 @@ pdcs_register_pathentries(void) | |||
993 | 993 | ||
994 | if ((err = kobject_set_name(&entry->kobj, "%s", entry->name))) | 994 | if ((err = kobject_set_name(&entry->kobj, "%s", entry->name))) |
995 | return err; | 995 | return err; |
996 | entry->kobj.kset = &paths_subsys; | 996 | entry->kobj.kset = paths_kset; |
997 | entry->kobj.ktype = &ktype_pdcspath; | 997 | entry->kobj.ktype = &ktype_pdcspath; |
998 | if ((err = kobject_register(&entry->kobj))) | 998 | if ((err = kobject_register(&entry->kobj))) |
999 | return err; | 999 | return err; |
@@ -1058,19 +1058,24 @@ pdc_stable_init(void) | |||
1058 | /* the actual result is 16 bits away */ | 1058 | /* the actual result is 16 bits away */ |
1059 | pdcs_osid = (u16)(result >> 16); | 1059 | pdcs_osid = (u16)(result >> 16); |
1060 | 1060 | ||
1061 | /* For now we'll register the stable subsys within this driver */ | 1061 | /* For now we'll register the stable kset within this driver */ |
1062 | if ((rc = firmware_register(&stable_subsys))) | 1062 | stable_kset = kset_create_and_add("stable", NULL, &firmware_kset->kobj); |
1063 | if (!stable_kset) { | ||
1064 | rc = -ENOMEM; | ||
1063 | goto fail_firmreg; | 1065 | goto fail_firmreg; |
1066 | } | ||
1064 | 1067 | ||
1065 | /* Don't forget the root entries */ | 1068 | /* Don't forget the root entries */ |
1066 | error = sysfs_create_group(&stable_subsys.kobj, pdcs_attr_group); | 1069 | error = sysfs_create_group(&stable_kset->kobj, pdcs_attr_group); |
1067 | 1070 | ||
1068 | /* register the paths subsys as a subsystem of stable subsys */ | 1071 | /* register the paths kset as a child of the stable kset */ |
1069 | paths_subsys.kobj.kset = &stable_subsys; | 1072 | paths_kset = kset_create_and_add("paths", NULL, &stable_kset->kobj); |
1070 | if ((rc = subsystem_register(&paths_subsys))) | 1073 | if (!paths_kset) { |
1071 | goto fail_subsysreg; | 1074 | rc = -ENOMEM; |
1075 | goto fail_ksetreg; | ||
1076 | } | ||
1072 | 1077 | ||
1073 | /* now we create all "files" for the paths subsys */ | 1078 | /* now we create all "files" for the paths kset */ |
1074 | if ((rc = pdcs_register_pathentries())) | 1079 | if ((rc = pdcs_register_pathentries())) |
1075 | goto fail_pdcsreg; | 1080 | goto fail_pdcsreg; |
1076 | 1081 | ||
@@ -1078,10 +1083,10 @@ pdc_stable_init(void) | |||
1078 | 1083 | ||
1079 | fail_pdcsreg: | 1084 | fail_pdcsreg: |
1080 | pdcs_unregister_pathentries(); | 1085 | pdcs_unregister_pathentries(); |
1081 | subsystem_unregister(&paths_subsys); | 1086 | kset_unregister(paths_kset); |
1082 | 1087 | ||
1083 | fail_subsysreg: | 1088 | fail_ksetreg: |
1084 | firmware_unregister(&stable_subsys); | 1089 | kset_unregister(stable_kset); |
1085 | 1090 | ||
1086 | fail_firmreg: | 1091 | fail_firmreg: |
1087 | printk(KERN_INFO PDCS_PREFIX " bailing out\n"); | 1092 | printk(KERN_INFO PDCS_PREFIX " bailing out\n"); |
@@ -1092,9 +1097,8 @@ static void __exit | |||
1092 | pdc_stable_exit(void) | 1097 | pdc_stable_exit(void) |
1093 | { | 1098 | { |
1094 | pdcs_unregister_pathentries(); | 1099 | pdcs_unregister_pathentries(); |
1095 | subsystem_unregister(&paths_subsys); | 1100 | kset_unregister(paths_kset); |
1096 | 1101 | kset_unregister(stable_kset); | |
1097 | firmware_unregister(&stable_subsys); | ||
1098 | } | 1102 | } |
1099 | 1103 | ||
1100 | 1104 | ||