Skip to content

Commit c419270

Browse files
Dave JiangLinus Torvalds
authored andcommitted
drivers/edac: add dev_name getter function
Move dev_name() macro to a more generic interface since it's not possible to determine whether a device is pci, platform, or of_device easily. Now each low level driver sets the name into the control structure, and the EDAC core references the control structure for the information. Better abstraction. Signed-off-by: Dave Jiang <[email protected]> Signed-off-by: Douglas Thompson <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 20bcb7a commit c419270

File tree

11 files changed

+18
-12
lines changed

11 files changed

+18
-12
lines changed

drivers/edac/amd76x_edac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx)
253253
mci->mod_name = EDAC_MOD_STR;
254254
mci->mod_ver = AMD76X_REVISION;
255255
mci->ctl_name = amd76x_devs[dev_idx].ctl_name;
256+
mci->dev_name = pci_name(pdev);
256257
mci->edac_check = amd76x_check;
257258
mci->ctl_page_to_phys = NULL;
258259

drivers/edac/e752x_edac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
10041004

10051005
debugf3("%s(): more mci init\n", __func__);
10061006
mci->ctl_name = pvt->dev_info->ctl_name;
1007+
mci->dev_name = pci_name(pdev);
10071008
mci->edac_check = e752x_check;
10081009
mci->ctl_page_to_phys = ctl_page_to_phys;
10091010

drivers/edac/e7xxx_edac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx)
463463

464464
debugf3("%s(): more mci init\n", __func__);
465465
mci->ctl_name = pvt->dev_info->ctl_name;
466+
mci->dev_name = pci_name(pdev);
466467
mci->edac_check = e7xxx_check;
467468
mci->ctl_page_to_phys = ctl_page_to_phys;
468469
e7xxx_init_csrows(mci, pdev, dev_idx, drc);

drivers/edac/edac_core.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,7 @@ extern int edac_debug_level;
9595
#define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \
9696
PCI_DEVICE_ID_ ## vend ## _ ## dev
9797

98-
#if defined(CONFIG_X86) && defined(CONFIG_PCI)
99-
#define dev_name(dev) pci_name(to_pci_dev(dev))
100-
#else
101-
#define dev_name(dev) to_platform_device(dev)->name
102-
#endif
98+
#define dev_name(dev) (dev)->dev_name
10399

104100
/* memory devices */
105101
enum dev_type {
@@ -368,6 +364,7 @@ struct mem_ctl_info {
368364
const char *mod_name;
369365
const char *mod_ver;
370366
const char *ctl_name;
367+
const char *dev_name;
371368
char proc_name[MC_PROC_NAME_MAX_LEN + 1];
372369
void *pvt_info;
373370
u32 ue_noinfo_count; /* Uncorrectable Errors w/o info */
@@ -538,6 +535,7 @@ struct edac_device_ctl_info {
538535

539536
const char *mod_name; /* module name */
540537
const char *ctl_name; /* edac controller name */
538+
const char *dev_name; /* pci/platform/etc... name */
541539

542540
void *pvt_info; /* pointer to 'private driver' info */
543541

drivers/edac/edac_device.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static int add_edac_dev_to_global_list (struct edac_device_ctl_info *edac_dev)
264264
fail0:
265265
edac_printk(KERN_WARNING, EDAC_MC,
266266
"%s (%s) %s %s already assigned %d\n",
267-
rover->dev->bus_id, dev_name(rover->dev),
267+
rover->dev->bus_id, dev_name(rover),
268268
rover->mod_name, rover->ctl_name, rover->dev_idx);
269269
return 1;
270270

@@ -491,7 +491,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx)
491491
"Giving out device to module '%s' controller '%s': DEV '%s' (%s)\n",
492492
edac_dev->mod_name,
493493
edac_dev->ctl_name,
494-
dev_name(edac_dev->dev),
494+
dev_name(edac_dev),
495495
edac_op_state_toString(edac_dev)
496496
);
497497

@@ -553,7 +553,7 @@ struct edac_device_ctl_info * edac_device_del_device(struct device *dev)
553553
edac_dev->dev_idx,
554554
edac_dev->mod_name,
555555
edac_dev->ctl_name,
556-
dev_name(edac_dev->dev));
556+
dev_name(edac_dev));
557557

558558
return edac_dev;
559559
}

drivers/edac/edac_mc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static int add_mc_to_global_list (struct mem_ctl_info *mci)
248248
fail0:
249249
edac_printk(KERN_WARNING, EDAC_MC,
250250
"%s (%s) %s %s already assigned %d\n", p->dev->bus_id,
251-
dev_name(p->dev), p->mod_name, p->ctl_name, p->mc_idx);
251+
dev_name(mci), p->mod_name, p->ctl_name, p->mc_idx);
252252
return 1;
253253

254254
fail1:
@@ -353,7 +353,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx)
353353

354354
/* Report action taken */
355355
edac_mc_printk(mci, KERN_INFO, "Giving out device to %s %s: DEV %s\n",
356-
mci->mod_name, mci->ctl_name, dev_name(mci->dev));
356+
mci->mod_name, mci->ctl_name, dev_name(mci));
357357

358358
mutex_unlock(&mem_ctls_mutex);
359359
return 0;
@@ -391,7 +391,7 @@ struct mem_ctl_info * edac_mc_del_mc(struct device *dev)
391391
mutex_unlock(&mem_ctls_mutex);
392392
edac_printk(KERN_INFO, EDAC_MC,
393393
"Removed device %d for %s %s: DEV %s\n", mci->mc_idx,
394-
mci->mod_name, mci->ctl_name, dev_name(mci->dev));
394+
mci->mod_name, mci->ctl_name, dev_name(mci));
395395
return mci;
396396
}
397397
EXPORT_SYMBOL_GPL(edac_mc_del_mc);

drivers/edac/i5000_edac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,7 @@ static int i5000_probe1(struct pci_dev *pdev, int dev_idx)
13451345
mci->mod_name = "i5000_edac.c";
13461346
mci->mod_ver = I5000_REVISION;
13471347
mci->ctl_name = i5000_devs[dev_idx].ctl_name;
1348+
mci->dev_name = pci_name(pdev);
13481349
mci->ctl_page_to_phys = NULL;
13491350

13501351
/* Set the function pointer to an actual operation function */

drivers/edac/i82443bxgx_edac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ static int i82443bxgx_edacmc_probe1(struct pci_dev *pdev, int dev_idx)
318318
mci->mod_name = EDAC_MOD_STR;
319319
mci->mod_ver = I82443_REVISION;
320320
mci->ctl_name = "I82443BXGX";
321+
mci->dev_name = pci_name(pdev);
321322
mci->edac_check = i82443bxgx_edacmc_check;
322323
mci->ctl_page_to_phys = NULL;
323324

drivers/edac/i82860_edac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ static int i82860_probe1(struct pci_dev *pdev, int dev_idx)
200200
mci->mod_name = EDAC_MOD_STR;
201201
mci->mod_ver = I82860_REVISION;
202202
mci->ctl_name = i82860_devs[dev_idx].ctl_name;
203+
mci->dev_name = pci_name(pdev);
203204
mci->edac_check = i82860_check;
204205
mci->ctl_page_to_phys = NULL;
205206
i82860_init_csrows(mci, pdev);

drivers/edac/i82875p_edac.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ static int i82875p_probe1(struct pci_dev *pdev, int dev_idx)
407407
mci->mod_name = EDAC_MOD_STR;
408408
mci->mod_ver = I82875P_REVISION;
409409
mci->ctl_name = i82875p_devs[dev_idx].ctl_name;
410+
mci->dev_name = pci_name(pdev);
410411
mci->edac_check = i82875p_check;
411412
mci->ctl_page_to_phys = NULL;
412413
debugf3("%s(): init pvt\n", __func__);

0 commit comments

Comments
 (0)