summaryrefslogtreecommitdiff
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
commit136a27507fd09006973f11b17ca971d4c176a06a (patch)
tree9d1490f61cbc3aded5bfc7c161c46285d0ecc74f
parent9bec101a0c38d559a8c95b44d850cd09a7b4edef (diff)
kset: convert gfs2 dlm to use kset_create
Dynamically create the kset instead of declaring it statically. Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Steven Whitehouse <swhiteho@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--fs/gfs2/locking/dlm/sysfs.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/fs/gfs2/locking/dlm/sysfs.c b/fs/gfs2/locking/dlm/sysfs.c
index 93e66b22757f..0a8614088ec6 100644
--- a/fs/gfs2/locking/dlm/sysfs.c
+++ b/fs/gfs2/locking/dlm/sysfs.c
@@ -189,7 +189,7 @@ static struct kobj_type gdlm_ktype = {
.sysfs_ops = &gdlm_attr_ops,
};
-static struct kset gdlm_kset;
+static struct kset *gdlm_kset;
int gdlm_kobject_setup(struct gdlm_ls *ls, struct kobject *fskobj)
{
@@ -201,7 +201,7 @@ int gdlm_kobject_setup(struct gdlm_ls *ls, struct kobject *fskobj)
return error;
}
- ls->kobj.kset = &gdlm_kset;
+ ls->kobj.kset = gdlm_kset;
ls->kobj.ktype = &gdlm_ktype;
ls->kobj.parent = fskobj;
@@ -219,19 +219,17 @@ void gdlm_kobject_release(struct gdlm_ls *ls)
int gdlm_sysfs_init(void)
{
- int error;
-
- kobject_set_name(&gdlm_kset.kobj, "lock_dlm");
- gdlm_kset.kobj.kset = &kernel_subsys;
- error = kset_register(&gdlm_kset);
- if (error)
- printk("lock_dlm: cannot register kset %d\n", error);
-
- return error;
+ gdlm_kset = kset_create_and_add("lock_dlm", NULL,
+ &kernel_subsys.kobj);
+ if (!gdlm_kset) {
+ printk(KERN_WARNING "%s: can not create kset\n", __FUNCTION__);
+ return -ENOMEM;
+ }
+ return 0;
}
void gdlm_sysfs_exit(void)
{
- kset_unregister(&gdlm_kset);
+ kset_unregister(gdlm_kset);
}