Skip to content

Commit 34980ca

Browse files
committed
Drivers: clean up direct setting of the name of a kset
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>
1 parent 7e7654a commit 34980ca

6 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎drivers/edac/edac_mc_sysfs.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ static struct kobj_type ktype_mc_set_attribs = {
743743
* /sys/devices/system/edac/mc
744744
*/
745745
static struct kset mc_kset = {
746-
.kobj = {.name = "mc", .ktype = &ktype_mc_set_attribs },
746+
.kobj = {.ktype = &ktype_mc_set_attribs },
747747
.ktype = &ktype_mci,
748748
};
749749

@@ -1010,6 +1010,7 @@ int edac_sysfs_setup_mc_kset(void)
10101010
}
10111011

10121012
/* Init the MC's kobject */
1013+
kobject_set_name(&mc_kset.kobj, "mc");
10131014
mc_kset.kobj.parent = &edac_class->kset.kobj;
10141015

10151016
/* register the mc_kset */

‎drivers/pci/hotplug/rpadlpar_sysfs.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,17 @@ struct kobj_type ktype_dlpar_io = {
129129
};
130130

131131
struct kset dlpar_io_kset = {
132-
.kobj = {.name = DLPAR_KOBJ_NAME,
133-
.ktype = &ktype_dlpar_io,
132+
.kobj = {.ktype = &ktype_dlpar_io,
134133
.parent = &pci_hotplug_slots_subsys.kobj},
135134
.ktype = &ktype_dlpar_io,
136135
};
137136

138137
int dlpar_sysfs_init(void)
139138
{
139+
kobject_set_name(&dlpar_io_kset.kobj, DLPAR_KOBJ_NAME);
140140
if (kset_register(&dlpar_io_kset)) {
141141
printk(KERN_ERR "rpadlpar_io: cannot register kset for %s\n",
142-
dlpar_io_kset.kobj.name);
142+
kobject_name(&dlpar_io_kset.kobj));
143143
return -EINVAL;
144144
}
145145

‎fs/dlm/lockspace.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ static struct kobj_type dlm_ktype = {
167167
};
168168

169169
static struct kset dlm_kset = {
170-
.kobj = {.name = "dlm",},
171170
.ktype = &dlm_ktype,
172171
};
173172

@@ -228,6 +227,7 @@ int dlm_lockspace_init(void)
228227
INIT_LIST_HEAD(&lslist);
229228
spin_lock_init(&lslist_lock);
230229

230+
kobject_set_name(&dlm_kset.kobj, "dlm");
231231
kobj_set_kset_s(&dlm_kset, kernel_subsys);
232232
error = kset_register(&dlm_kset);
233233
if (error)

‎fs/gfs2/locking/dlm/sysfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ static struct kobj_type gdlm_ktype = {
190190
};
191191

192192
static struct kset gdlm_kset = {
193-
.kobj = {.name = "lock_dlm",},
194193
.ktype = &gdlm_ktype,
195194
};
196195

@@ -224,6 +223,7 @@ int gdlm_sysfs_init(void)
224223
{
225224
int error;
226225

226+
kobject_set_name(&gdlm_kset.kobj, "lock_dlm");
227227
kobj_set_kset_s(&gdlm_kset, kernel_subsys);
228228
error = kset_register(&gdlm_kset);
229229
if (error)

‎fs/gfs2/sys.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ static struct kobj_type gfs2_ktype = {
222222
};
223223

224224
static struct kset gfs2_kset = {
225-
.kobj = {.name = "gfs2"},
226225
.ktype = &gfs2_ktype,
227226
};
228227

@@ -553,6 +552,7 @@ int gfs2_sys_init(void)
553552
{
554553
gfs2_sys_margs = NULL;
555554
spin_lock_init(&gfs2_sys_margs_lock);
555+
kobject_set_name(&gfs2_kset.kobj, "gfs2");
556556
kobj_set_kset_s(&gfs2_kset, fs_subsys);
557557
return kset_register(&gfs2_kset);
558558
}

‎fs/ocfs2/cluster/masklog.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static struct kobj_type mlog_ktype = {
143143
};
144144

145145
static struct kset mlog_kset = {
146-
.kobj = {.name = "logmask", .ktype = &mlog_ktype},
146+
.kobj = {.ktype = &mlog_ktype},
147147
};
148148

149149
int mlog_sys_init(struct kset *o2cb_subsys)
@@ -156,6 +156,7 @@ int mlog_sys_init(struct kset *o2cb_subsys)
156156
}
157157
mlog_attr_ptrs[i] = NULL;
158158

159+
kobject_set_name(&mlog_kset.kobj, "logmask");
159160
kobj_set_kset_s(&mlog_kset, *o2cb_subsys);
160161
return kset_register(&mlog_kset);
161162
}

0 commit comments

Comments
 (0)