EDAC: printk() cleanup
Subsystems (3)
PATCH 2/15 EDAC: printk() cleanup
This implements the following idea:
Quoted 11 lines · Eric W. Biederman
One piece missing from this conversation is the issue that we need errors in a uniform format. That is why
edac_mchas helper functions.However there will always be errors that don't fit any particular model. Could we add a
edac_printk(dev, ); That is similar todev_printkbut prints out an EDAC header and the device on which the error was found? Letting the rest of the string be user specified.For actual control that interface may be to blunt, but at least for people looking in the logs it allows all of the errors to be detected and harvested.
---
drivers/edac/amd76x_edac.c +15 -8
@@ -25,6 +25,14 @@#include "edac_mc.h" +#define amd76x_printk(level, fmt, arg...) \ + edac_printk(level, "amd76x", fmt, ##arg) + + +#define amd76x_mc_printk(mci, level, fmt, arg...) \ + edac_mc_chipset_printk(mci, level, "amd76x", fmt, ##arg) + +#define AMD76X_NR_CSROWS 8#define AMD76X_NR_CHANS 1#define AMD76X_NR_DIMMS 4
@@ -174,7 +182,7 @@ static int amd76x_process_error_info (ststatic void amd76x_check (struct mem_ctl_info *mci) {struct amd76x_error_info info; -debugf3 ("MC: " __FILE__": %s()\n" , __func__); +debugf3 ("%s()\n" , __func__);amd76x_get_error_info (mci, &info);amd76x_process_error_info (mci, &info,1 ); }
@@ -204,7 +212,7 @@ static int amd76x_probe1(struct pci_devu32 ems;u32 ems_mode; -debugf0 ("MC: " __FILE__": %s()\n" , __func__); +debugf0 ("%s()\n" , __func__);pci_read_config_dword (pdev,AMD76X_ECC_MODE_STATUS , &ems); ems_mode = (ems >>10 ) &0x3 ;
@@ -216,7 +224,7 @@ static int amd76x_probe1(struct pci_dev goto fail; } -debugf0 ("MC: " __FILE__": %s(): mci = %p\n" , __func__, mci); +debugf0 ("%s(): mci = %p\n" , __func__, mci); mci->pdev =pci_dev_get (pdev); mci->mtype_cap =MEM_FLAG_RDDR ;
@@ -267,13 +275,12 @@ static int amd76x_probe1(struct pci_dev (u32) (0x3 << 8));if (edac_mc_add_mc (mci)) { -debugf3 ("MC: " __FILE__ -": %s(): failed edac_mc_add_mc()\n" , __func__); +debugf3 ("%s(): failed edac_mc_add_mc()\n" , __func__); goto fail; }/* get this far and it's successful */ -debugf3 ("MC: " __FILE__": %s(): success\n" , __func__); +debugf3 ("%s(): success\n" , __func__);return 0 ; fail:
@@ -289,7 +296,7 @@ fail:static int __devinit amd76x_init_one (struct pci_dev *pdev,const struct pci_device_id *ent) { -debugf0 ("MC: " __FILE__": %s()\n" , __func__); +debugf0 ("%s()\n" , __func__);/* don't need to call pci_device_enable() */ return amd76x_probe1 (pdev, ent->driver_data);
@@ -309,7 +316,7 @@ static void __devexit amd76x_remove_one( {struct mem_ctl_info *mci; -debugf0 (__FILE__": %s()\n" , __func__); +debugf0 ("%s()\n" , __func__);if ((mci =edac_mc_find_mci_by_pdev (pdev)) ==NULL )return ;
drivers/edac/e752x_edac.c +47 -43
263 lines not on this page · raw message
drivers/edac/e7xxx_edac.c +34 -28
183 lines not on this page · raw message
drivers/edac/edac_mc.c +92 -106
455 lines not on this page · raw message
drivers/edac/edac_mc.h +21 -2
@@ -43,10 +43,29 @@#define PAGES_TO_MiB ( pages ) ( ( pages ) << ( PAGE_SHIFT - 20 ) )#endif +#define edac_printk(level, prefix, fmt, arg...) \ + printk(level "EDAC " prefix ": " fmt, ##arg) + +#define edac_mc_printk(mci, level, fmt, arg...) \ + printk(level "EDAC MC%d: " fmt, mci->mc_idx, ##arg) + +#define edac_mc_chipset_printk(mci, level, prefix, fmt, arg...) \ + printk(level "EDAC " prefix " MC%d: " fmt, mci->mc_idx, ##arg) + +/* prefixes for edac_printk() and edac_mc_printk() */ +#define EDAC_MC "MC" +#define EDAC_PCI "PCI" +#define EDAC_DEBUG "DEBUG" +#ifdef CONFIG_EDAC_DEBUG extern int edac_debug_level; -#define edac_debug_printk(level, fmt, args...) \ -do { if (level <= edac_debug_level) printk(KERN_DEBUG fmt, ##args); } while(0) + +#define edac_debug_printk(level, fmt, arg...) \ + do { \ + if (level <= edac_debug_level) \ + edac_printk(KERN_DEBUG, EDAC_DEBUG, fmt, ##arg); \ + } while(0) +#define debugf0 ( ... ) edac_debug_printk(0, __VA_ARGS__ )#define debugf1 ( ... ) edac_debug_printk(1, __VA_ARGS__ )#define debugf2 ( ... ) edac_debug_printk(2, __VA_ARGS__ )
drivers/edac/i82860_edac.c +19 -13
@@ -19,6 +19,14 @@#include "edac_mc.h" +#define i82860_printk(level, fmt, arg...) \ + edac_printk(level, "i82860", fmt, ##arg) + + +#define i82860_mc_printk(mci, level, fmt, arg...) \ + edac_mc_chipset_printk(mci, level, "i82860", fmt, ##arg) + +#ifndef PCI_DEVICE_ID_INTEL_82860_0 #define PCI_DEVICE_ID_INTEL_82860_0 0x2531#endif /* PCI_DEVICE_ID_INTEL_82860_0 */
@@ -117,7 +125,7 @@ static void i82860_check(struct mem_ctl_ {struct i82860_error_info info; -debugf1 ("MC%d: " __FILE__": %s()\n" , mci->mc_idx, __func__); +debugf1 ("MC%d: %s()\n" , mci->mc_idx, __func__);i82860_get_error_info (mci, &info);i82860_process_error_info (mci, &info,1 ); }
@@ -143,7 +151,7 @@ static int i82860_probe1(struct pci_devif (!mci)return -ENOMEM ; -debugf3 ("MC: " __FILE__": %s(): init mci\n" , __func__); +debugf3 ("%s(): init mci\n" , __func__); mci->pdev = pdev; mci->mtype_cap =MEM_FLAG_DDR ;
@@ -179,8 +187,8 @@ static int i82860_probe1(struct pci_dev cumul_size = (value &I82860_GBA_MASK ) << (I82860_GBA_SHIFT -PAGE_SHIFT ); -debugf3 ("MC: " __FILE__": %s(): (%d) cumul_size 0x%x\n" , - __func__, index, cumul_size); +debugf3 ("%s(): (%d) cumul_size 0x%x\n" , __func__, index, + cumul_size);if (cumul_size == last_cumul_size)continue ;/* not populated */
@@ -198,13 +206,11 @@ static int i82860_probe1(struct pci_devpci_write_bits16 (mci->pdev,I82860_ERRSTS ,0x0003 ,0x0003 );if (edac_mc_add_mc (mci)) { -debugf3 ("MC: " __FILE__ -": %s(): failed edac_mc_add_mc()\n" , - __func__); +debugf3 ("%s(): failed edac_mc_add_mc()\n" , __func__);edac_mc_free (mci); }else {/* get this far and it's successful */ -debugf3 ("MC: " __FILE__": %s(): success\n" , __func__); +debugf3 ("%s(): success\n" , __func__); rc =0 ; }return rc;
@@ -216,9 +222,9 @@ static int __devinit i82860_init_one(str {int rc; -debugf0 ("MC: " __FILE__": %s()\n" , __func__); +debugf0 ("%s()\n" , __func__); -printk (KERN_INFO "i82860 init one\n" ); +i82860_printk (KERN_INFO ,"i82860 init one\n" );if (pci_enable_device (pdev) <0 )return -EIO ; rc =i82860_probe1 (pdev, ent->driver_data);
@@ -231,7 +237,7 @@ static void __devexit i82860_remove_one( {struct mem_ctl_info *mci; -debugf0 (__FILE__": %s()\n" , __func__); +debugf0 ("%s()\n" , __func__); mci =edac_mc_find_mci_by_pdev (pdev);if ((mci !=NULL ) && (edac_mc_del_mc (mci) ==0 ))
@@ -257,7 +263,7 @@ static int __init i82860_init(void) {int pci_rc; -debugf3 ("MC: " __FILE__": %s()\n" , __func__); +debugf3 ("%s()\n" , __func__);if ((pci_rc =pci_register_driver (&i82860_driver)) <0 )return pci_rc;
@@ -281,7 +287,7 @@ static int __init i82860_init(void) static void __exit i82860_exit(void) { -debugf3 ("MC: " __FILE__": %s()\n" , __func__); +debugf3 ("%s()\n" , __func__);pci_unregister_driver (&i82860_driver);if (!i82860_registered) {
drivers/edac/i82875p_edac.c +29 -22
138 lines not on this page · raw message
drivers/edac/r82600_edac.c +25 -23
124 lines not on this page · raw message