summaryrefslogtreecommitdiffstats
path: root/kernel/ksysfs.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-10-29 20:13:17 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 20:40:14 -0800
commitbd35b93d8049ab47b5bfaf6b10ba39badf21d1c3 (patch)
treebac82e14d960b2c7011b7f660a93f07e922f8a97 /kernel/ksysfs.c
parente5e38a86c0bbe8475543f10f0a48393a45df5182 (diff)
downloadop-kernel-dev-bd35b93d8049ab47b5bfaf6b10ba39badf21d1c3.zip
op-kernel-dev-bd35b93d8049ab47b5bfaf6b10ba39badf21d1c3.tar.gz
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 094e2bc..cf02d4b 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -94,8 +94,8 @@ static struct bin_attribute notes_attr = {
.read = &notes_read,
};
-decl_subsys(kernel, NULL);
-EXPORT_SYMBOL_GPL(kernel_subsys);
+struct kset *kernel_kset;
+EXPORT_SYMBOL_GPL(kernel_kset);
static struct attribute * kernel_attrs[] = {
#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
@@ -116,24 +116,42 @@ static struct attribute_group kernel_attr_group = {
static int __init ksysfs_init(void)
{
- int error = subsystem_register(&kernel_subsys);
- if (!error)
- error = sysfs_create_group(&kernel_subsys.kobj,
- &kernel_attr_group);
+ int error;
- if (!error && notes_size > 0) {
+ kernel_kset = kset_create_and_add("kernel", NULL, NULL);
+ if (!kernel_kset) {
+ error = -ENOMEM;
+ goto exit;
+ }
+ error = sysfs_create_group(&kernel_kset->kobj, &kernel_attr_group);
+ if (error)
+ goto kset_exit;
+
+ if (notes_size > 0) {
notes_attr.size = notes_size;
- error = sysfs_create_bin_file(&kernel_subsys.kobj,
- &notes_attr);
+ error = sysfs_create_bin_file(&kernel_kset->kobj, &notes_attr);
+ if (error)
+ goto group_exit;
}
/*
* Create "/sys/kernel/uids" directory and corresponding root user's
* directory under it.
*/
- if (!error)
- error = uids_kobject_init();
-
+ error = uids_kobject_init();
+ if (error)
+ goto notes_exit;
+
+ return 0;
+
+notes_exit:
+ if (notes_size > 0)
+ sysfs_remove_bin_file(&kernel_kset->kobj, &notes_attr);
+group_exit:
+ sysfs_remove_group(&kernel_kset->kobj, &kernel_attr_group);
+kset_exit:
+ kset_unregister(kernel_kset);
+exit:
return error;
}
OpenPOWER on IntegriCloud