diff options
-rw-r--r-- | fs/dlm/lockspace.c | 26 | ||||
-rw-r--r-- | fs/gfs2/locking/dlm/sysfs.c | 13 | ||||
-rw-r--r-- | fs/gfs2/sys.c | 10 |
3 files changed, 10 insertions, 39 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; |
diff --git a/fs/gfs2/locking/dlm/sysfs.c b/fs/gfs2/locking/dlm/sysfs.c index e5a4fbf7265f..a7336b909c61 100644 --- a/fs/gfs2/locking/dlm/sysfs.c +++ b/fs/gfs2/locking/dlm/sysfs.c | |||
@@ -195,19 +195,12 @@ int gdlm_kobject_setup(struct gdlm_ls *ls, struct kobject *fskobj) | |||
195 | { | 195 | { |
196 | int error; | 196 | int error; |
197 | 197 | ||
198 | error = kobject_set_name(&ls->kobj, "%s", "lock_module"); | ||
199 | if (error) { | ||
200 | log_error("can't set kobj name %d", error); | ||
201 | return error; | ||
202 | } | ||
203 | |||
204 | ls->kobj.kset = gdlm_kset; | 198 | ls->kobj.kset = gdlm_kset; |
205 | ls->kobj.ktype = &gdlm_ktype; | 199 | error = kobject_init_and_add(&ls->kobj, &gdlm_ktype, fskobj, |
206 | ls->kobj.parent = fskobj; | 200 | "lock_module"); |
207 | |||
208 | error = kobject_register(&ls->kobj); | ||
209 | if (error) | 201 | if (error) |
210 | log_error("can't register kobj %d", error); | 202 | log_error("can't register kobj %d", error); |
203 | kobject_uevent(&ls->kobj, KOBJ_ADD); | ||
211 | 204 | ||
212 | return error; | 205 | return error; |
213 | } | 206 | } |
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 44cfaae92e76..8d9cd5bd5845 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -494,13 +494,8 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp) | |||
494 | int error; | 494 | int error; |
495 | 495 | ||
496 | sdp->sd_kobj.kset = gfs2_kset; | 496 | sdp->sd_kobj.kset = gfs2_kset; |
497 | sdp->sd_kobj.ktype = &gfs2_ktype; | 497 | error = kobject_init_and_add(&sdp->sd_kobj, &gfs2_ktype, NULL, |
498 | 498 | "%s", sdp->sd_table_name); | |
499 | error = kobject_set_name(&sdp->sd_kobj, "%s", sdp->sd_table_name); | ||
500 | if (error) | ||
501 | goto fail; | ||
502 | |||
503 | error = kobject_register(&sdp->sd_kobj); | ||
504 | if (error) | 499 | if (error) |
505 | goto fail; | 500 | goto fail; |
506 | 501 | ||
@@ -520,6 +515,7 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp) | |||
520 | if (error) | 515 | if (error) |
521 | goto fail_args; | 516 | goto fail_args; |
522 | 517 | ||
518 | kobject_uevent(&sdp->sd_kobj, KOBJ_ADD); | ||
523 | return 0; | 519 | return 0; |
524 | 520 | ||
525 | fail_args: | 521 | fail_args: |