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

kset: convert 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>
上级 136a2750
...@@ -166,7 +166,7 @@ static struct kobj_type dlm_ktype = { ...@@ -166,7 +166,7 @@ static struct kobj_type dlm_ktype = {
.release = lockspace_kobj_release, .release = lockspace_kobj_release,
}; };
static struct kset dlm_kset; static struct kset *dlm_kset;
static int kobject_setup(struct dlm_ls *ls) static int kobject_setup(struct dlm_ls *ls)
{ {
...@@ -180,7 +180,7 @@ static int kobject_setup(struct dlm_ls *ls) ...@@ -180,7 +180,7 @@ static int kobject_setup(struct dlm_ls *ls)
if (error) if (error)
return error; return error;
ls->ls_kobj.kset = &dlm_kset; ls->ls_kobj.kset = dlm_kset;
ls->ls_kobj.ktype = &dlm_ktype; ls->ls_kobj.ktype = &dlm_ktype;
return 0; return 0;
} }
...@@ -218,24 +218,22 @@ static int do_uevent(struct dlm_ls *ls, int in) ...@@ -218,24 +218,22 @@ static int do_uevent(struct dlm_ls *ls, int in)
int dlm_lockspace_init(void) int dlm_lockspace_init(void)
{ {
int error;
ls_count = 0; ls_count = 0;
mutex_init(&ls_lock); mutex_init(&ls_lock);
INIT_LIST_HEAD(&lslist); INIT_LIST_HEAD(&lslist);
spin_lock_init(&lslist_lock); spin_lock_init(&lslist_lock);
kobject_set_name(&dlm_kset.kobj, "dlm"); dlm_kset = kset_create_and_add("dlm", NULL, &kernel_subsys.kobj);
dlm_kset.kobj.kset = &kernel_subsys; if (!dlm_kset) {
error = kset_register(&dlm_kset); printk(KERN_WARNING "%s: can not create kset\n", __FUNCTION__);
if (error) return -ENOMEM;
printk("dlm_lockspace_init: cannot register kset %d\n", error); }
return error; return 0;
} }
void dlm_lockspace_exit(void) void dlm_lockspace_exit(void)
{ {
kset_unregister(&dlm_kset); kset_unregister(dlm_kset);
} }
static int dlm_scand(void *data) static int dlm_scand(void *data)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册