diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-29 15:13:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:14 -0500 |
commit | bd35b93d8049ab47b5bfaf6b10ba39badf21d1c3 (patch) | |
tree | bac82e14d960b2c7011b7f660a93f07e922f8a97 /kernel | |
parent | e5e38a86c0bbe8475543f10f0a48393a45df5182 (diff) |
kset: convert kernel_subsys to use kset_create
Dynamically create the kset instead of declaring it statically. We also
rename kernel_subsys to kernel_kset to catch all users of this symbol
with a build error instead of an easy-to-ignore build warning.
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/ksysfs.c | 42 | ||||
-rw-r--r-- | kernel/user.c | 4 |
2 files changed, 32 insertions, 14 deletions
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 094e2bc101a8..cf02d4ba9add 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c | |||
@@ -94,8 +94,8 @@ static struct bin_attribute notes_attr = { | |||
94 | .read = ¬es_read, | 94 | .read = ¬es_read, |
95 | }; | 95 | }; |
96 | 96 | ||
97 | decl_subsys(kernel, NULL); | 97 | struct kset *kernel_kset; |
98 | EXPORT_SYMBOL_GPL(kernel_subsys); | 98 | EXPORT_SYMBOL_GPL(kernel_kset); |
99 | 99 | ||
100 | static struct attribute * kernel_attrs[] = { | 100 | static struct attribute * kernel_attrs[] = { |
101 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) | 101 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) |
@@ -116,24 +116,42 @@ static struct attribute_group kernel_attr_group = { | |||
116 | 116 | ||
117 | static int __init ksysfs_init(void) | 117 | static int __init ksysfs_init(void) |
118 | { | 118 | { |
119 | int error = subsystem_register(&kernel_subsys); | 119 | int error; |
120 | if (!error) | ||
121 | error = sysfs_create_group(&kernel_subsys.kobj, | ||
122 | &kernel_attr_group); | ||
123 | 120 | ||
124 | if (!error && notes_size > 0) { | 121 | kernel_kset = kset_create_and_add("kernel", NULL, NULL); |
122 | if (!kernel_kset) { | ||
123 | error = -ENOMEM; | ||
124 | goto exit; | ||
125 | } | ||
126 | error = sysfs_create_group(&kernel_kset->kobj, &kernel_attr_group); | ||
127 | if (error) | ||
128 | goto kset_exit; | ||
129 | |||
130 | if (notes_size > 0) { | ||
125 | notes_attr.size = notes_size; | 131 | notes_attr.size = notes_size; |
126 | error = sysfs_create_bin_file(&kernel_subsys.kobj, | 132 | error = sysfs_create_bin_file(&kernel_kset->kobj, ¬es_attr); |
127 | ¬es_attr); | 133 | if (error) |
134 | goto group_exit; | ||
128 | } | 135 | } |
129 | 136 | ||
130 | /* | 137 | /* |
131 | * Create "/sys/kernel/uids" directory and corresponding root user's | 138 | * Create "/sys/kernel/uids" directory and corresponding root user's |
132 | * directory under it. | 139 | * directory under it. |
133 | */ | 140 | */ |
134 | if (!error) | 141 | error = uids_kobject_init(); |
135 | error = uids_kobject_init(); | 142 | if (error) |
136 | 143 | goto notes_exit; | |
144 | |||
145 | return 0; | ||
146 | |||
147 | notes_exit: | ||
148 | if (notes_size > 0) | ||
149 | sysfs_remove_bin_file(&kernel_kset->kobj, ¬es_attr); | ||
150 | group_exit: | ||
151 | sysfs_remove_group(&kernel_kset->kobj, &kernel_attr_group); | ||
152 | kset_exit: | ||
153 | kset_unregister(kernel_kset); | ||
154 | exit: | ||
137 | return error; | 155 | return error; |
138 | } | 156 | } |
139 | 157 | ||
diff --git a/kernel/user.c b/kernel/user.c index 8320a87f3e5a..80f1116b8fcd 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
@@ -198,8 +198,8 @@ int __init uids_kobject_init(void) | |||
198 | int error; | 198 | int error; |
199 | 199 | ||
200 | /* create under /sys/kernel dir */ | 200 | /* create under /sys/kernel dir */ |
201 | uids_kobject.parent = &kernel_subsys.kobj; | 201 | uids_kobject.parent = &kernel_kset->kobj; |
202 | uids_kobject.kset = &kernel_subsys; | 202 | uids_kobject.kset = kernel_kset; |
203 | kobject_set_name(&uids_kobject, "uids"); | 203 | kobject_set_name(&uids_kobject, "uids"); |
204 | kobject_init(&uids_kobject); | 204 | kobject_init(&uids_kobject); |
205 | 205 | ||