aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/amd64_edac.h
diff options
context:
space:
mode:
authorBorislav Petkov <borislav.petkov@amd.com>2009-10-13 13:26:55 -0400
committerBorislav Petkov <borislav.petkov@amd.com>2009-12-07 13:14:27 -0500
commit6ba5dcdc44624677bba0bef1dcb93a524f88f8c1 (patch)
treeaa2aa4c95882b4451c2bf99c5228d81dd76e641d /drivers/edac/amd64_edac.h
parentf6d6ae965760906d79ab29bc38507608c5971549 (diff)
amd64_edac: wrap-up pci config read error handling
Add a pci config read wrapper for signaling pci config space access errors instead of them being visible only on a debug build. This is important on amd64_edac since it uses all those pci config register values to access the DRAM/DIMM configuration of the nodes. In addition, the wrapper makes a _lot_ (look at the diffstat!) of error handling code superfluous and improves much of the overall code readability by removing error handling details out of the way. Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers/edac/amd64_edac.h')
-rw-r--r--drivers/edac/amd64_edac.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
index bba6c944ff13..16f2df449a09 100644
--- a/drivers/edac/amd64_edac.h
+++ b/drivers/edac/amd64_edac.h
@@ -565,6 +565,22 @@ static inline struct low_ops *family_ops(int index)
565 return &amd64_family_types[index].ops; 565 return &amd64_family_types[index].ops;
566} 566}
567 567
568static inline int amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset,
569 u32 *val, const char *func)
570{
571 int err = 0;
572
573 err = pci_read_config_dword(pdev, offset, val);
574 if (err)
575 amd64_printk(KERN_WARNING, "%s: error reading F%dx%x.\n",
576 func, PCI_FUNC(pdev->devfn), offset);
577
578 return err;
579}
580
581#define amd64_read_pci_cfg(pdev, offset, val) \
582 amd64_read_pci_cfg_dword(pdev, offset, val, __func__)
583
568/* 584/*
569 * For future CPU versions, verify the following as new 'slow' rates appear and 585 * For future CPU versions, verify the following as new 'slow' rates appear and
570 * modify the necessary skip values for the supported CPU. 586 * modify the necessary skip values for the supported CPU.