kobject: convert kernel_kset to be a kobject
kernel_kset does not need to be a kset, but a much simpler kobject now
that we have kobj_attributes.
We also rename kernel_kset to kernel_kobj 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>
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index c4ee7f0..54bf0db 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -140,7 +140,7 @@
if (!configfs_dir_cachep)
goto out;
- config_kobj = kobject_create_and_add("config", &kernel_kset->kobj);
+ config_kobj = kobject_create_and_add("config", kernel_kobj);
if (!config_kobj) {
kmem_cache_destroy(configfs_dir_cachep);
configfs_dir_cachep = NULL;
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 5ce92c3..97f6381 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -432,7 +432,7 @@
{
int retval;
- debug_kobj = kobject_create_and_add("debug", &kernel_kset->kobj);
+ debug_kobj = kobject_create_and_add("debug", kernel_kobj);
if (!debug_kobj)
return -EINVAL;
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 0828beb..e64b0dc 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -223,7 +223,7 @@
INIT_LIST_HEAD(&lslist);
spin_lock_init(&lslist_lock);
- dlm_kset = kset_create_and_add("dlm", NULL, &kernel_kset->kobj);
+ dlm_kset = kset_create_and_add("dlm", NULL, kernel_kobj);
if (!dlm_kset) {
printk(KERN_WARNING "%s: can not create kset\n", __FUNCTION__);
return -ENOMEM;
diff --git a/fs/gfs2/locking/dlm/sysfs.c b/fs/gfs2/locking/dlm/sysfs.c
index 1a92b6f..e5a4fbf 100644
--- a/fs/gfs2/locking/dlm/sysfs.c
+++ b/fs/gfs2/locking/dlm/sysfs.c
@@ -219,7 +219,7 @@
int gdlm_sysfs_init(void)
{
- gdlm_kset = kset_create_and_add("lock_dlm", NULL, &kernel_kset->kobj);
+ gdlm_kset = kset_create_and_add("lock_dlm", NULL, kernel_kobj);
if (!gdlm_kset) {
printk(KERN_WARNING "%s: can not create kset\n", __FUNCTION__);
return -ENOMEM;
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 9da3523..0930efd 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -198,8 +198,8 @@
#define set_kset_name(str) .kset = { .kobj = { .k_name = str } }
-/* The global /sys/kernel/ kset for people to chain off of */
-extern struct kset *kernel_kset;
+/* The global /sys/kernel/ kobject for people to chain off of */
+extern struct kobject *kernel_kobj;
/* The global /sys/hypervisor/ kobject for people to chain off of */
extern struct kobject *hypervisor_kobj;
/* The global /sys/power/ kset for people to chain off of */
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index 45e6465..1081aff 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -101,8 +101,8 @@
.read = ¬es_read,
};
-struct kset *kernel_kset;
-EXPORT_SYMBOL_GPL(kernel_kset);
+struct kobject *kernel_kobj;
+EXPORT_SYMBOL_GPL(kernel_kobj);
static struct attribute * kernel_attrs[] = {
#if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET)
@@ -125,18 +125,18 @@
{
int error;
- kernel_kset = kset_create_and_add("kernel", NULL, NULL);
- if (!kernel_kset) {
+ kernel_kobj = kobject_create_and_add("kernel", NULL);
+ if (!kernel_kobj) {
error = -ENOMEM;
goto exit;
}
- error = sysfs_create_group(&kernel_kset->kobj, &kernel_attr_group);
+ error = sysfs_create_group(kernel_kobj, &kernel_attr_group);
if (error)
goto kset_exit;
if (notes_size > 0) {
notes_attr.size = notes_size;
- error = sysfs_create_bin_file(&kernel_kset->kobj, ¬es_attr);
+ error = sysfs_create_bin_file(kernel_kobj, ¬es_attr);
if (error)
goto group_exit;
}
@@ -150,11 +150,11 @@
notes_exit:
if (notes_size > 0)
- sysfs_remove_bin_file(&kernel_kset->kobj, ¬es_attr);
+ sysfs_remove_bin_file(kernel_kobj, ¬es_attr);
group_exit:
- sysfs_remove_group(&kernel_kset->kobj, &kernel_attr_group);
+ sysfs_remove_group(kernel_kobj, &kernel_attr_group);
kset_exit:
- kset_unregister(kernel_kset);
+ kobject_unregister(kernel_kobj);
exit:
return error;
}
diff --git a/kernel/user.c b/kernel/user.c
index 5a106f3..7f17e6e 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -201,7 +201,7 @@
*/
int __init uids_sysfs_init(void)
{
- uids_kset = kset_create_and_add("uids", NULL, &kernel_kset->kobj);
+ uids_kset = kset_create_and_add("uids", NULL, kernel_kobj);
if (!uids_kset)
return -ENOMEM;
diff --git a/mm/slub.c b/mm/slub.c
index b6c7946..d26177f 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4091,8 +4091,7 @@
struct kmem_cache *s;
int err;
- slab_kset = kset_create_and_add("slab", &slab_uevent_ops,
- &kernel_kset->kobj);
+ slab_kset = kset_create_and_add("slab", &slab_uevent_ops, kernel_kobj);
if (!slab_kset) {
printk(KERN_ERR "Cannot register slab subsystem.\n");
return -ENOSYS;
diff --git a/security/inode.c b/security/inode.c
index dbe040a..def0cc1 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -321,7 +321,7 @@
{
int retval;
- security_kobj = kobject_create_and_add("security", &kernel_kset->kobj);
+ security_kobj = kobject_create_and_add("security", kernel_kobj);
if (!security_kobj)
return -EINVAL;