diff options
Diffstat (limited to 'fs/dlm/lockspace.c')
-rw-r--r-- | fs/dlm/lockspace.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index e64b0dc664f3..b750f13d0328 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -168,23 +168,6 @@ static struct kobj_type dlm_ktype = { | |||
168 | 168 | ||
169 | static struct kset *dlm_kset; | 169 | static struct kset *dlm_kset; |
170 | 170 | ||
171 | static int kobject_setup(struct dlm_ls *ls) | ||
172 | { | ||
173 | char lsname[DLM_LOCKSPACE_LEN]; | ||
174 | int error; | ||
175 | |||
176 | memset(lsname, 0, DLM_LOCKSPACE_LEN); | ||
177 | snprintf(lsname, DLM_LOCKSPACE_LEN, "%s", ls->ls_name); | ||
178 | |||
179 | error = kobject_set_name(&ls->ls_kobj, "%s", lsname); | ||
180 | if (error) | ||
181 | return error; | ||
182 | |||
183 | ls->ls_kobj.kset = dlm_kset; | ||
184 | ls->ls_kobj.ktype = &dlm_ktype; | ||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | static int do_uevent(struct dlm_ls *ls, int in) | 171 | static int do_uevent(struct dlm_ls *ls, int in) |
189 | { | 172 | { |
190 | int error; | 173 | int error; |
@@ -545,13 +528,12 @@ static int new_lockspace(char *name, int namelen, void **lockspace, | |||
545 | goto out_delist; | 528 | goto out_delist; |
546 | } | 529 | } |
547 | 530 | ||
548 | error = kobject_setup(ls); | 531 | ls->ls_kobj.kset = dlm_kset; |
549 | if (error) | 532 | error = kobject_init_and_add(&ls->ls_kobj, &dlm_ktype, NULL, |
550 | goto out_stop; | 533 | "%s", ls->ls_name); |
551 | |||
552 | error = kobject_register(&ls->ls_kobj); | ||
553 | if (error) | 534 | if (error) |
554 | goto out_stop; | 535 | goto out_stop; |
536 | kobject_uevent(&ls->ls_kobj, KOBJ_ADD); | ||
555 | 537 | ||
556 | /* let kobject handle freeing of ls if there's an error */ | 538 | /* let kobject handle freeing of ls if there's an error */ |
557 | do_unreg = 1; | 539 | do_unreg = 1; |