summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/ksysfs.c42
-rw-r--r--kernel/user.c4
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 = {
.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;
}
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)
int error;
/* create under /sys/kernel dir */
- uids_kobject.parent = &kernel_subsys.kobj;
- uids_kobject.kset = &kernel_subsys;
+ uids_kobject.parent = &kernel_kset->kobj;
+ uids_kobject.kset = kernel_kset;
kobject_set_name(&uids_kobject, "uids");
kobject_init(&uids_kobject);