提交 136a2750 编写于 作者: G Greg Kroah-Hartman

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: NGreg Kroah-Hartman <gregkh@suse.de>
上级 9bec101a
...@@ -189,7 +189,7 @@ static struct kobj_type gdlm_ktype = { ...@@ -189,7 +189,7 @@ static struct kobj_type gdlm_ktype = {
.sysfs_ops = &gdlm_attr_ops, .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) 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) ...@@ -201,7 +201,7 @@ int gdlm_kobject_setup(struct gdlm_ls *ls, struct kobject *fskobj)
return error; return error;
} }
ls->kobj.kset = &gdlm_kset; ls->kobj.kset = gdlm_kset;
ls->kobj.ktype = &gdlm_ktype; ls->kobj.ktype = &gdlm_ktype;
ls->kobj.parent = fskobj; ls->kobj.parent = fskobj;
...@@ -219,19 +219,17 @@ void gdlm_kobject_release(struct gdlm_ls *ls) ...@@ -219,19 +219,17 @@ void gdlm_kobject_release(struct gdlm_ls *ls)
int gdlm_sysfs_init(void) int gdlm_sysfs_init(void)
{ {
int error; gdlm_kset = kset_create_and_add("lock_dlm", NULL,
&kernel_subsys.kobj);
kobject_set_name(&gdlm_kset.kobj, "lock_dlm"); if (!gdlm_kset) {
gdlm_kset.kobj.kset = &kernel_subsys; printk(KERN_WARNING "%s: can not create kset\n", __FUNCTION__);
error = kset_register(&gdlm_kset); return -ENOMEM;
if (error) }
printk("lock_dlm: cannot register kset %d\n", error); return 0;
return error;
} }
void gdlm_sysfs_exit(void) void gdlm_sysfs_exit(void)
{ {
kset_unregister(&gdlm_kset); kset_unregister(gdlm_kset);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册