Commit c4192705 authored by Dave Jiang's avatar Dave Jiang Committed by Linus Torvalds

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: default avatarDave Jiang <djiang@mvista.com>
Signed-off-by: default avatarDouglas Thompson <dougthompson@xmission.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 20bcb7a8
...@@ -253,6 +253,7 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx) ...@@ -253,6 +253,7 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx)
mci->mod_name = EDAC_MOD_STR; mci->mod_name = EDAC_MOD_STR;
mci->mod_ver = AMD76X_REVISION; mci->mod_ver = AMD76X_REVISION;
mci->ctl_name = amd76x_devs[dev_idx].ctl_name; mci->ctl_name = amd76x_devs[dev_idx].ctl_name;
mci->dev_name = pci_name(pdev);
mci->edac_check = amd76x_check; mci->edac_check = amd76x_check;
mci->ctl_page_to_phys = NULL; mci->ctl_page_to_phys = NULL;
......
...@@ -1004,6 +1004,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx) ...@@ -1004,6 +1004,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
debugf3("%s(): more mci init\n", __func__); debugf3("%s(): more mci init\n", __func__);
mci->ctl_name = pvt->dev_info->ctl_name; mci->ctl_name = pvt->dev_info->ctl_name;
mci->dev_name = pci_name(pdev);
mci->edac_check = e752x_check; mci->edac_check = e752x_check;
mci->ctl_page_to_phys = ctl_page_to_phys; mci->ctl_page_to_phys = ctl_page_to_phys;
......
...@@ -463,6 +463,7 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx) ...@@ -463,6 +463,7 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx)
debugf3("%s(): more mci init\n", __func__); debugf3("%s(): more mci init\n", __func__);
mci->ctl_name = pvt->dev_info->ctl_name; mci->ctl_name = pvt->dev_info->ctl_name;
mci->dev_name = pci_name(pdev);
mci->edac_check = e7xxx_check; mci->edac_check = e7xxx_check;
mci->ctl_page_to_phys = ctl_page_to_phys; mci->ctl_page_to_phys = ctl_page_to_phys;
e7xxx_init_csrows(mci, pdev, dev_idx, drc); e7xxx_init_csrows(mci, pdev, dev_idx, drc);
......
...@@ -95,11 +95,7 @@ extern int edac_debug_level; ...@@ -95,11 +95,7 @@ extern int edac_debug_level;
#define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \ #define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \
PCI_DEVICE_ID_ ## vend ## _ ## dev PCI_DEVICE_ID_ ## vend ## _ ## dev
#if defined(CONFIG_X86) && defined(CONFIG_PCI) #define dev_name(dev) (dev)->dev_name
#define dev_name(dev) pci_name(to_pci_dev(dev))
#else
#define dev_name(dev) to_platform_device(dev)->name
#endif
/* memory devices */ /* memory devices */
enum dev_type { enum dev_type {
...@@ -368,6 +364,7 @@ struct mem_ctl_info { ...@@ -368,6 +364,7 @@ struct mem_ctl_info {
const char *mod_name; const char *mod_name;
const char *mod_ver; const char *mod_ver;
const char *ctl_name; const char *ctl_name;
const char *dev_name;
char proc_name[MC_PROC_NAME_MAX_LEN + 1]; char proc_name[MC_PROC_NAME_MAX_LEN + 1];
void *pvt_info; void *pvt_info;
u32 ue_noinfo_count; /* Uncorrectable Errors w/o info */ u32 ue_noinfo_count; /* Uncorrectable Errors w/o info */
...@@ -538,6 +535,7 @@ struct edac_device_ctl_info { ...@@ -538,6 +535,7 @@ struct edac_device_ctl_info {
const char *mod_name; /* module name */ const char *mod_name; /* module name */
const char *ctl_name; /* edac controller name */ const char *ctl_name; /* edac controller name */
const char *dev_name; /* pci/platform/etc... name */
void *pvt_info; /* pointer to 'private driver' info */ void *pvt_info; /* pointer to 'private driver' info */
......
...@@ -264,7 +264,7 @@ static int add_edac_dev_to_global_list (struct edac_device_ctl_info *edac_dev) ...@@ -264,7 +264,7 @@ static int add_edac_dev_to_global_list (struct edac_device_ctl_info *edac_dev)
fail0: fail0:
edac_printk(KERN_WARNING, EDAC_MC, edac_printk(KERN_WARNING, EDAC_MC,
"%s (%s) %s %s already assigned %d\n", "%s (%s) %s %s already assigned %d\n",
rover->dev->bus_id, dev_name(rover->dev), rover->dev->bus_id, dev_name(rover),
rover->mod_name, rover->ctl_name, rover->dev_idx); rover->mod_name, rover->ctl_name, rover->dev_idx);
return 1; return 1;
...@@ -491,7 +491,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx) ...@@ -491,7 +491,7 @@ int edac_device_add_device(struct edac_device_ctl_info *edac_dev, int edac_idx)
"Giving out device to module '%s' controller '%s': DEV '%s' (%s)\n", "Giving out device to module '%s' controller '%s': DEV '%s' (%s)\n",
edac_dev->mod_name, edac_dev->mod_name,
edac_dev->ctl_name, edac_dev->ctl_name,
dev_name(edac_dev->dev), dev_name(edac_dev),
edac_op_state_toString(edac_dev) edac_op_state_toString(edac_dev)
); );
...@@ -553,7 +553,7 @@ struct edac_device_ctl_info * edac_device_del_device(struct device *dev) ...@@ -553,7 +553,7 @@ struct edac_device_ctl_info * edac_device_del_device(struct device *dev)
edac_dev->dev_idx, edac_dev->dev_idx,
edac_dev->mod_name, edac_dev->mod_name,
edac_dev->ctl_name, edac_dev->ctl_name,
dev_name(edac_dev->dev)); dev_name(edac_dev));
return edac_dev; return edac_dev;
} }
......
...@@ -248,7 +248,7 @@ static int add_mc_to_global_list (struct mem_ctl_info *mci) ...@@ -248,7 +248,7 @@ static int add_mc_to_global_list (struct mem_ctl_info *mci)
fail0: fail0:
edac_printk(KERN_WARNING, EDAC_MC, edac_printk(KERN_WARNING, EDAC_MC,
"%s (%s) %s %s already assigned %d\n", p->dev->bus_id, "%s (%s) %s %s already assigned %d\n", p->dev->bus_id,
dev_name(p->dev), p->mod_name, p->ctl_name, p->mc_idx); dev_name(mci), p->mod_name, p->ctl_name, p->mc_idx);
return 1; return 1;
fail1: fail1:
...@@ -353,7 +353,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx) ...@@ -353,7 +353,7 @@ int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx)
/* Report action taken */ /* Report action taken */
edac_mc_printk(mci, KERN_INFO, "Giving out device to %s %s: DEV %s\n", edac_mc_printk(mci, KERN_INFO, "Giving out device to %s %s: DEV %s\n",
mci->mod_name, mci->ctl_name, dev_name(mci->dev)); mci->mod_name, mci->ctl_name, dev_name(mci));
mutex_unlock(&mem_ctls_mutex); mutex_unlock(&mem_ctls_mutex);
return 0; return 0;
...@@ -391,7 +391,7 @@ struct mem_ctl_info * edac_mc_del_mc(struct device *dev) ...@@ -391,7 +391,7 @@ struct mem_ctl_info * edac_mc_del_mc(struct device *dev)
mutex_unlock(&mem_ctls_mutex); mutex_unlock(&mem_ctls_mutex);
edac_printk(KERN_INFO, EDAC_MC, edac_printk(KERN_INFO, EDAC_MC,
"Removed device %d for %s %s: DEV %s\n", mci->mc_idx, "Removed device %d for %s %s: DEV %s\n", mci->mc_idx,
mci->mod_name, mci->ctl_name, dev_name(mci->dev)); mci->mod_name, mci->ctl_name, dev_name(mci));
return mci; return mci;
} }
EXPORT_SYMBOL_GPL(edac_mc_del_mc); EXPORT_SYMBOL_GPL(edac_mc_del_mc);
......
...@@ -1345,6 +1345,7 @@ static int i5000_probe1(struct pci_dev *pdev, int dev_idx) ...@@ -1345,6 +1345,7 @@ static int i5000_probe1(struct pci_dev *pdev, int dev_idx)
mci->mod_name = "i5000_edac.c"; mci->mod_name = "i5000_edac.c";
mci->mod_ver = I5000_REVISION; mci->mod_ver = I5000_REVISION;
mci->ctl_name = i5000_devs[dev_idx].ctl_name; mci->ctl_name = i5000_devs[dev_idx].ctl_name;
mci->dev_name = pci_name(pdev);
mci->ctl_page_to_phys = NULL; mci->ctl_page_to_phys = NULL;
/* Set the function pointer to an actual operation function */ /* Set the function pointer to an actual operation function */
......
...@@ -318,6 +318,7 @@ static int i82443bxgx_edacmc_probe1(struct pci_dev *pdev, int dev_idx) ...@@ -318,6 +318,7 @@ static int i82443bxgx_edacmc_probe1(struct pci_dev *pdev, int dev_idx)
mci->mod_name = EDAC_MOD_STR; mci->mod_name = EDAC_MOD_STR;
mci->mod_ver = I82443_REVISION; mci->mod_ver = I82443_REVISION;
mci->ctl_name = "I82443BXGX"; mci->ctl_name = "I82443BXGX";
mci->dev_name = pci_name(pdev);
mci->edac_check = i82443bxgx_edacmc_check; mci->edac_check = i82443bxgx_edacmc_check;
mci->ctl_page_to_phys = NULL; mci->ctl_page_to_phys = NULL;
......
...@@ -200,6 +200,7 @@ static int i82860_probe1(struct pci_dev *pdev, int dev_idx) ...@@ -200,6 +200,7 @@ static int i82860_probe1(struct pci_dev *pdev, int dev_idx)
mci->mod_name = EDAC_MOD_STR; mci->mod_name = EDAC_MOD_STR;
mci->mod_ver = I82860_REVISION; mci->mod_ver = I82860_REVISION;
mci->ctl_name = i82860_devs[dev_idx].ctl_name; mci->ctl_name = i82860_devs[dev_idx].ctl_name;
mci->dev_name = pci_name(pdev);
mci->edac_check = i82860_check; mci->edac_check = i82860_check;
mci->ctl_page_to_phys = NULL; mci->ctl_page_to_phys = NULL;
i82860_init_csrows(mci, pdev); i82860_init_csrows(mci, pdev);
......
...@@ -407,6 +407,7 @@ static int i82875p_probe1(struct pci_dev *pdev, int dev_idx) ...@@ -407,6 +407,7 @@ static int i82875p_probe1(struct pci_dev *pdev, int dev_idx)
mci->mod_name = EDAC_MOD_STR; mci->mod_name = EDAC_MOD_STR;
mci->mod_ver = I82875P_REVISION; mci->mod_ver = I82875P_REVISION;
mci->ctl_name = i82875p_devs[dev_idx].ctl_name; mci->ctl_name = i82875p_devs[dev_idx].ctl_name;
mci->dev_name = pci_name(pdev);
mci->edac_check = i82875p_check; mci->edac_check = i82875p_check;
mci->ctl_page_to_phys = NULL; mci->ctl_page_to_phys = NULL;
debugf3("%s(): init pvt\n", __func__); debugf3("%s(): init pvt\n", __func__);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Written with reference to 82600 High Integration Dual PCI System * Written with reference to 82600 High Integration Dual PCI System
* Controller Data Book: * Controller Data Book:
* http://www.radisys.com/files/support_downloads/007-01277-0002.82600DataBook.pdf * www.radisys.com/files/support_downloads/007-01277-0002.82600DataBook.pdf
* references to this document given in [] * references to this document given in []
*/ */
...@@ -305,6 +305,7 @@ static int r82600_probe1(struct pci_dev *pdev, int dev_idx) ...@@ -305,6 +305,7 @@ static int r82600_probe1(struct pci_dev *pdev, int dev_idx)
mci->mod_name = EDAC_MOD_STR; mci->mod_name = EDAC_MOD_STR;
mci->mod_ver = R82600_REVISION; mci->mod_ver = R82600_REVISION;
mci->ctl_name = "R82600"; mci->ctl_name = "R82600";
mci->dev_name = pci_name(pdev);
mci->edac_check = r82600_check; mci->edac_check = r82600_check;
mci->ctl_page_to_phys = NULL; mci->ctl_page_to_phys = NULL;
r82600_init_csrows(mci, pdev, dramcr); r82600_init_csrows(mci, pdev, dramcr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment