Drivers: clean up direct setting of the name of a kset
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 12 Sep 2007 22:06:57 +0000 (15:06 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 12 Oct 2007 21:51:02 +0000 (14:51 -0700)
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
drivers/pci/hotplug/rpadlpar_sysfs.c
fs/dlm/lockspace.c
fs/gfs2/locking/dlm/sysfs.c
fs/gfs2/sys.c
fs/ocfs2/cluster/masklog.c

index 4a0576bd06fc93bab9b2028b695ff7907a13f9c4..3706b2bc0987f8a5a22cc5784054dce95bf17973 100644 (file)
@@ -743,7 +743,7 @@ static struct kobj_type ktype_mc_set_attribs = {
  *     /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 */
index df076064a3e07d2980d0cea2bbab5e8ab557bbd7..a080fedf03327fb0b8fe92a940cc71f68ec25c2e 100644 (file)
@@ -129,17 +129,17 @@ struct kobj_type ktype_dlpar_io = {
 };
 
 struct kset dlpar_io_kset = {
-       .kobj = {.name = DLPAR_KOBJ_NAME,
-                .ktype = &ktype_dlpar_io,
+       .kobj = {.ktype = &ktype_dlpar_io,
                 .parent = &pci_hotplug_slots_subsys.kobj},
        .ktype = &ktype_dlpar_io,
 };
 
 int dlpar_sysfs_init(void)
 {
+       kobject_set_name(&dlpar_io_kset.kobj, DLPAR_KOBJ_NAME);
        if (kset_register(&dlpar_io_kset)) {
                printk(KERN_ERR "rpadlpar_io: cannot register kset for %s\n",
-                               dlpar_io_kset.kobj.name);
+                               kobject_name(&dlpar_io_kset.kobj));
                return -EINVAL;
        }
 
index 1dc72105ab125171b4bb3356ea0a09577178ec77..f88f88fdedf1f2d5d6671765613c23284214b5b4 100644 (file)
@@ -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)
index d9fe3ca40e1859ec8420c7e512bda40bfba486e6..ae9e6a25fe2ba67d390b507e21f678303ed54e59 100644 (file)
@@ -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.kobj, "lock_dlm");
        kobj_set_kset_s(&gdlm_kset, kernel_subsys);
        error = kset_register(&gdlm_kset);
        if (error)
index c26c21b53c19a2ccb26d1e75ee81569634f943b3..640cb6a6fc4ce205a4a6389849e20f404cfbcea2 100644 (file)
@@ -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);
 }
index e9e042b93dbf520ed9dc2c4b64a0e1b96590c0a1..a4882c8df945ef402694d8b4a392261a0db45dea 100644 (file)
@@ -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_subsys)
        }
        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);
 }