Drivers: clean up direct setting of the name of a kset

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>
Date: Thursday, September 13, 2007 - 7:42 pm

A kset should not have its name set directly, so dynamically set the
name at runtime.

This is needed to remove the static array in the kobject structure which
will be changed in a future patch.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


---
 drivers/edac/edac_mc_sysfs.c |    3 ++-
 fs/dlm/lockspace.c           |    2 +-
 fs/gfs2/locking/dlm/sysfs.c  |    2 +-
 fs/gfs2/sys.c                |    2 +-
 fs/ocfs2/cluster/masklog.c   |    3 ++-
 5 files changed, 7 insertions(+), 5 deletions(-)

--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -743,7 +743,7 @@ static struct kobj_type ktype_mc_set_att
  *	/sys/devices/system/edac/mc
  */
 static struct kset mc_kset = {
-	.kobj = {.name = "mc", .ktype = &ktype_mc_set_attribs },
+	.kobj = {.ktype = &ktype_mc_set_attribs },
 	.ktype = &ktype_mci,
 };
 
@@ -1010,6 +1010,7 @@ int edac_sysfs_setup_mc_kset(void)
 	}
 
 	/* Init the MC's kobject */
+	kobject_set_name(&mc_kset.kobj, "mc");
 	mc_kset.kobj.parent = &edac_class->kset.kobj;
 
 	/* register the mc_kset */
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -167,7 +167,6 @@ static struct kobj_type dlm_ktype = {
 };
 
 static struct kset dlm_kset = {
-	.kobj   = {.name = "dlm",},
 	.ktype  = &dlm_ktype,
 };
 
@@ -228,6 +227,7 @@ int dlm_lockspace_init(void)
 	INIT_LIST_HEAD(&lslist);
 	spin_lock_init(&lslist_lock);
 
+	kobject_set_name(&dlm_kset.kobj, "dlm");
 	kobj_set_kset_s(&dlm_kset, kernel_subsys);
 	error = kset_register(&dlm_kset);
 	if (error)
--- a/fs/gfs2/locking/dlm/sysfs.c
+++ b/fs/gfs2/locking/dlm/sysfs.c
@@ -190,7 +190,6 @@ static struct kobj_type gdlm_ktype = {
 };
 
 static struct kset gdlm_kset = {
-	.kobj   = {.name = "lock_dlm",},
 	.ktype  = &gdlm_ktype,
 };
 
@@ -224,6 +223,7 @@ int gdlm_sysfs_init(void)
 {
 	int error;
 
+	kobject_set_name(&gdlm_kset, "lock_dlm");
 	kobj_set_kset_s(&gdlm_kset, kernel_subsys);
 	error = kset_register(&gdlm_kset);
 	if (error)
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -222,7 +222,6 @@ static struct kobj_type gfs2_ktype = {
 };
 
 static struct kset gfs2_kset = {
-	.kobj   = {.name = "gfs2"},
 	.ktype  = &gfs2_ktype,
 };
 
@@ -553,6 +552,7 @@ int gfs2_sys_init(void)
 {
 	gfs2_sys_margs = NULL;
 	spin_lock_init(&gfs2_sys_margs_lock);
+	kobject_set_name(&gfs2_kset.kobj, "gfs2");
 	kobj_set_kset_s(&gfs2_kset, fs_subsys);
 	return kset_register(&gfs2_kset);
 }
--- a/fs/ocfs2/cluster/masklog.c
+++ b/fs/ocfs2/cluster/masklog.c
@@ -143,7 +143,7 @@ static struct kobj_type mlog_ktype = {
 };
 
 static struct kset mlog_kset = {
-	.kobj   = {.name = "logmask", .ktype = &mlog_ktype},
+	.kobj   = {.ktype = &mlog_ktype},
 };
 
 int mlog_sys_init(struct kset *o2cb_subsys)
@@ -156,6 +156,7 @@ int mlog_sys_init(struct kset *o2cb_subs
 	}
 	mlog_attr_ptrs[i] = NULL;
 
+	kobject_set_name(&mlog_kset.kobj, "logmask");
 	kobj_set_kset_s(&mlog_kset, *o2cb_subsys);
 	return kset_register(&mlog_kset);
 }
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC] Some driver core and kobject minor patches, Greg KH, (Thu Sep 13, 7:37 pm)
Re: [RFC] Some driver core and kobject minor patches, Cornelia Huck, (Fri Sep 14, 7:25 am)
kobject: remove the static array for the name, Greg KH, (Thu Sep 13, 7:44 pm)
cdev: remove unneeded setting of cdev names, Greg KH, (Thu Sep 13, 7:43 pm)
Drivers: clean up direct setting of the name of a kset, Greg KH, (Thu Sep 13, 7:42 pm)
Driver core: remove subsys_set_kset, Greg KH, (Thu Sep 13, 7:40 pm)
Driver core: remove subsys_put(), Greg KH, (Thu Sep 13, 7:40 pm)
Driver core: remove subsys_get(), Greg KH, (Thu Sep 13, 7:40 pm)
Driver core: remove put_bus(), Greg KH, (Thu Sep 13, 7:39 pm)
Re: Driver core: remove put_bus(), Cornelia Huck, (Fri Sep 14, 7:03 am)
Driver core: remove kset_set_kset_s, Greg KH, (Thu Sep 13, 7:39 pm)
Driver core: remove get_bus(), Greg KH, (Thu Sep 13, 7:38 pm)
Re: Driver core: remove get_bus(), Cornelia Huck, (Fri Sep 14, 7:02 am)
Re: Driver core: remove get_bus(), Greg KH, (Fri Sep 14, 7:27 am)