Skip to content

Commit 625c6b5

Browse files
gregkhsuryasaimadhu
authored andcommitted
EDAC: Use default_groups in kobj_type
There are currently 2 ways to create a set of sysfs files for a kobj_type, through the default_attrs field, and the default_groups field. Move the edac sysfs code to use default_groups field which has been the preferred way since aa30f47 ("kobject: Add support for default attribute groups to kobj_type") so that the obsolete default_attrs field can be removed soon. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lore.kernel.org/r/20220104112401.1067148-2-gregkh@linuxfoundation.org
1 parent 1141389 commit 625c6b5

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

drivers/edac/edac_device_sysfs.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,14 @@ CTL_INFO_ATTR(poll_msec, S_IRUGO | S_IWUSR,
163163
edac_device_ctl_poll_msec_show, edac_device_ctl_poll_msec_store);
164164

165165
/* Base Attributes of the EDAC_DEVICE ECC object */
166-
static struct attribute *device_ctrl_attr[] = {
166+
static struct attribute *device_ctrl_attrs[] = {
167167
&attr_ctl_info_panic_on_ue.attr,
168168
&attr_ctl_info_log_ue.attr,
169169
&attr_ctl_info_log_ce.attr,
170170
&attr_ctl_info_poll_msec.attr,
171171
NULL,
172172
};
173+
ATTRIBUTE_GROUPS(device_ctrl);
173174

174175
/*
175176
* edac_device_ctrl_master_release
@@ -217,7 +218,7 @@ static void edac_device_ctrl_master_release(struct kobject *kobj)
217218
static struct kobj_type ktype_device_ctrl = {
218219
.release = edac_device_ctrl_master_release,
219220
.sysfs_ops = &device_ctl_info_ops,
220-
.default_attrs = device_ctrl_attr,
221+
.default_groups = device_ctrl_groups,
221222
};
222223

223224
/*
@@ -389,17 +390,18 @@ INSTANCE_ATTR(ce_count, S_IRUGO, instance_ce_count_show, NULL);
389390
INSTANCE_ATTR(ue_count, S_IRUGO, instance_ue_count_show, NULL);
390391

391392
/* list of edac_dev 'instance' attributes */
392-
static struct attribute *device_instance_attr[] = {
393+
static struct attribute *device_instance_attrs[] = {
393394
&attr_instance_ce_count.attr,
394395
&attr_instance_ue_count.attr,
395396
NULL,
396397
};
398+
ATTRIBUTE_GROUPS(device_instance);
397399

398400
/* The 'ktype' for each edac_dev 'instance' */
399401
static struct kobj_type ktype_instance_ctrl = {
400402
.release = edac_device_ctrl_instance_release,
401403
.sysfs_ops = &device_instance_ops,
402-
.default_attrs = device_instance_attr,
404+
.default_groups = device_instance_groups,
403405
};
404406

405407
/* edac_dev -> instance -> block information */
@@ -487,17 +489,18 @@ BLOCK_ATTR(ce_count, S_IRUGO, block_ce_count_show, NULL);
487489
BLOCK_ATTR(ue_count, S_IRUGO, block_ue_count_show, NULL);
488490

489491
/* list of edac_dev 'block' attributes */
490-
static struct attribute *device_block_attr[] = {
492+
static struct attribute *device_block_attrs[] = {
491493
&attr_block_ce_count.attr,
492494
&attr_block_ue_count.attr,
493495
NULL,
494496
};
497+
ATTRIBUTE_GROUPS(device_block);
495498

496499
/* The 'ktype' for each edac_dev 'block' */
497500
static struct kobj_type ktype_block_ctrl = {
498501
.release = edac_device_ctrl_block_release,
499502
.sysfs_ops = &device_block_ops,
500-
.default_attrs = device_block_attr,
503+
.default_groups = device_block_groups,
501504
};
502505

503506
/* block ctor/dtor code */

drivers/edac/edac_pci_sysfs.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,18 @@ INSTANCE_ATTR(pe_count, S_IRUGO, instance_pe_count_show, NULL);
135135
INSTANCE_ATTR(npe_count, S_IRUGO, instance_npe_count_show, NULL);
136136

137137
/* pci instance attributes */
138-
static struct attribute *pci_instance_attr[] = {
138+
static struct attribute *pci_instance_attrs[] = {
139139
&attr_instance_pe_count.attr,
140140
&attr_instance_npe_count.attr,
141141
NULL
142142
};
143+
ATTRIBUTE_GROUPS(pci_instance);
143144

144145
/* the ktype for a pci instance */
145146
static struct kobj_type ktype_pci_instance = {
146147
.release = edac_pci_instance_release,
147148
.sysfs_ops = &pci_instance_ops,
148-
.default_attrs = pci_instance_attr,
149+
.default_groups = pci_instance_groups,
149150
};
150151

151152
/*
@@ -292,7 +293,7 @@ EDAC_PCI_ATTR(pci_parity_count, S_IRUGO, edac_pci_int_show, NULL);
292293
EDAC_PCI_ATTR(pci_nonparity_count, S_IRUGO, edac_pci_int_show, NULL);
293294

294295
/* Base Attributes of the memory ECC object */
295-
static struct attribute *edac_pci_attr[] = {
296+
static struct attribute *edac_pci_attrs[] = {
296297
&edac_pci_attr_check_pci_errors.attr,
297298
&edac_pci_attr_edac_pci_log_pe.attr,
298299
&edac_pci_attr_edac_pci_log_npe.attr,
@@ -301,6 +302,7 @@ static struct attribute *edac_pci_attr[] = {
301302
&edac_pci_attr_pci_nonparity_count.attr,
302303
NULL,
303304
};
305+
ATTRIBUTE_GROUPS(edac_pci);
304306

305307
/*
306308
* edac_pci_release_main_kobj
@@ -327,7 +329,7 @@ static void edac_pci_release_main_kobj(struct kobject *kobj)
327329
static struct kobj_type ktype_edac_pci_main_kobj = {
328330
.release = edac_pci_release_main_kobj,
329331
.sysfs_ops = &edac_pci_sysfs_ops,
330-
.default_attrs = edac_pci_attr,
332+
.default_groups = edac_pci_groups,
331333
};
332334

333335
/**

0 commit comments

Comments
 (0)