aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/ksysfs.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-10-29 15:13:17 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:14 -0500
commitbd35b93d8049ab47b5bfaf6b10ba39badf21d1c3 (patch)
treebac82e14d960b2c7011b7f660a93f07e922f8a97 /kernel/ksysfs.c
parente5e38a86c0bbe8475543f10f0a48393a45df5182 (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/ksysfs.c')
-rw-r--r--kernel/ksysfs.c42
1 files changed, 30 insertions, 12 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 = &notes_read, 94 .read = &notes_read,
95}; 95};
96 96
97decl_subsys(kernel, NULL); 97struct kset *kernel_kset;
98EXPORT_SYMBOL_GPL(kernel_subsys); 98EXPORT_SYMBOL_GPL(kernel_kset);
99 99
100static struct attribute * kernel_attrs[] = { 100static 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
117static int __init ksysfs_init(void) 117static 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, &notes_attr);
127 &notes_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
147notes_exit:
148 if (notes_size > 0)
149 sysfs_remove_bin_file(&kernel_kset->kobj, &notes_attr);
150group_exit:
151 sysfs_remove_group(&kernel_kset->kobj, &kernel_attr_group);
152kset_exit:
153 kset_unregister(kernel_kset);
154exit:
137 return error; 155 return error;
138} 156}
139 157