aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-04-28 15:41:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-06-11 12:23:48 -0400
commit7e881856eee8b889b76cd1d8e04ce2fc79b72099 (patch)
tree1cd297b48d2193bce416a5516583fe65630c2d45 /drivers
parentdd23cd6eb1f59ba722a6e6aa228adff7c01404de (diff)
edac: Use more normal debugging macro style
Convert macros to a simpler style and enforce appropriate format checking when not CONFIG_EDAC_DEBUG. Use fmt and __VA_ARGS__, neaten macros. Move some string arrays to the debugfx uses and remove the now unnecessary CONFIG_EDAC_DEBUG variable block definitions. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/edac/edac_core.h35
-rw-r--r--drivers/edac/i5000_edac.c30
-rw-r--r--drivers/edac/i5400_edac.c30
-rw-r--r--drivers/edac/i7300_edac.c30
4 files changed, 49 insertions, 76 deletions
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h
index 740c7e22c023..410738bf30fd 100644
--- a/drivers/edac/edac_core.h
+++ b/drivers/edac/edac_core.h
@@ -71,29 +71,30 @@ extern const char *edac_mem_types[];
71#ifdef CONFIG_EDAC_DEBUG 71#ifdef CONFIG_EDAC_DEBUG
72extern int edac_debug_level; 72extern int edac_debug_level;
73 73
74#define edac_debug_printk(level, fmt, arg...) \ 74#define edac_debug_printk(level, fmt, ...) \
75 do { \ 75do { \
76 if (level <= edac_debug_level) \ 76 if (level <= edac_debug_level) \
77 edac_printk(KERN_DEBUG, EDAC_DEBUG, \ 77 edac_printk(KERN_DEBUG, EDAC_DEBUG, \
78 "%s: " fmt, __func__, ##arg); \ 78 "%s: " fmt, __func__, ##__VA_ARGS__); \
79 } while (0) 79} while (0)
80
81#define debugf0( ... ) edac_debug_printk(0, __VA_ARGS__ )
82#define debugf1( ... ) edac_debug_printk(1, __VA_ARGS__ )
83#define debugf2( ... ) edac_debug_printk(2, __VA_ARGS__ )
84#define debugf3( ... ) edac_debug_printk(3, __VA_ARGS__ )
85#define debugf4( ... ) edac_debug_printk(4, __VA_ARGS__ )
86 80
87#else /* !CONFIG_EDAC_DEBUG */ 81#else /* !CONFIG_EDAC_DEBUG */
88 82
89#define debugf0( ... ) 83#define edac_debug_printk(level, fmt, ...) \
90#define debugf1( ... ) 84do { \
91#define debugf2( ... ) 85 if (0) \
92#define debugf3( ... ) 86 edac_printk(KERN_DEBUG, EDAC_DEBUG, \
93#define debugf4( ... ) 87 "%s: " fmt, __func__, ##__VA_ARGS__); \
88} while (0)
94 89
95#endif /* !CONFIG_EDAC_DEBUG */ 90#endif /* !CONFIG_EDAC_DEBUG */
96 91
92#define debugf0(fmt, ...) edac_debug_printk(0, fmt, ##__VA_ARGS__)
93#define debugf1(fmt, ...) edac_debug_printk(1, fmt, ##__VA_ARGS__)
94#define debugf2(fmt, ...) edac_debug_printk(2, fmt, ##__VA_ARGS__)
95#define debugf3(fmt, ...) edac_debug_printk(3, fmt, ##__VA_ARGS__)
96#define debugf4(fmt, ...) edac_debug_printk(4, fmt, ##__VA_ARGS__)
97
97#define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \ 98#define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \
98 PCI_DEVICE_ID_ ## vend ## _ ## dev 99 PCI_DEVICE_ID_ ## vend ## _ ## dev
99 100
diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c
index 4a5ca5229d5f..0e16db620ad5 100644
--- a/drivers/edac/i5000_edac.c
+++ b/drivers/edac/i5000_edac.c
@@ -273,7 +273,7 @@
273#define CHANNELS_PER_BRANCH 2 273#define CHANNELS_PER_BRANCH 2
274#define MAX_BRANCHES 2 274#define MAX_BRANCHES 2
275 275
276/* Defines to extract the vaious fields from the 276/* Defines to extract the various fields from the
277 * MTRx - Memory Technology Registers 277 * MTRx - Memory Technology Registers
278 */ 278 */
279#define MTR_DIMMS_PRESENT(mtr) ((mtr) & (0x1 << 8)) 279#define MTR_DIMMS_PRESENT(mtr) ((mtr) & (0x1 << 8))
@@ -287,22 +287,6 @@
287#define MTR_DIMM_COLS(mtr) ((mtr) & 0x3) 287#define MTR_DIMM_COLS(mtr) ((mtr) & 0x3)
288#define MTR_DIMM_COLS_ADDR_BITS(mtr) (MTR_DIMM_COLS(mtr) + 10) 288#define MTR_DIMM_COLS_ADDR_BITS(mtr) (MTR_DIMM_COLS(mtr) + 10)
289 289
290#ifdef CONFIG_EDAC_DEBUG
291static char *numrow_toString[] = {
292 "8,192 - 13 rows",
293 "16,384 - 14 rows",
294 "32,768 - 15 rows",
295 "reserved"
296};
297
298static char *numcol_toString[] = {
299 "1,024 - 10 columns",
300 "2,048 - 11 columns",
301 "4,096 - 12 columns",
302 "reserved"
303};
304#endif
305
306/* enables the report of miscellaneous messages as CE errors - default off */ 290/* enables the report of miscellaneous messages as CE errors - default off */
307static int misc_messages; 291static int misc_messages;
308 292
@@ -989,8 +973,16 @@ static void decode_mtr(int slot_row, u16 mtr)
989 debugf2("\t\tWIDTH: x%d\n", MTR_DRAM_WIDTH(mtr)); 973 debugf2("\t\tWIDTH: x%d\n", MTR_DRAM_WIDTH(mtr));
990 debugf2("\t\tNUMBANK: %d bank(s)\n", MTR_DRAM_BANKS(mtr)); 974 debugf2("\t\tNUMBANK: %d bank(s)\n", MTR_DRAM_BANKS(mtr));
991 debugf2("\t\tNUMRANK: %s\n", MTR_DIMM_RANK(mtr) ? "double" : "single"); 975 debugf2("\t\tNUMRANK: %s\n", MTR_DIMM_RANK(mtr) ? "double" : "single");
992 debugf2("\t\tNUMROW: %s\n", numrow_toString[MTR_DIMM_ROWS(mtr)]); 976 debugf2("\t\tNUMROW: %s\n",
993 debugf2("\t\tNUMCOL: %s\n", numcol_toString[MTR_DIMM_COLS(mtr)]); 977 MTR_DIMM_ROWS(mtr) == 0 ? "8,192 - 13 rows" :
978 MTR_DIMM_ROWS(mtr) == 1 ? "16,384 - 14 rows" :
979 MTR_DIMM_ROWS(mtr) == 2 ? "32,768 - 15 rows" :
980 "reserved");
981 debugf2("\t\tNUMCOL: %s\n",
982 MTR_DIMM_COLS(mtr) == 0 ? "1,024 - 10 columns" :
983 MTR_DIMM_COLS(mtr) == 1 ? "2,048 - 11 columns" :
984 MTR_DIMM_COLS(mtr) == 2 ? "4,096 - 12 columns" :
985 "reserved");
994} 986}
995 987
996static void handle_channel(struct i5000_pvt *pvt, int slot, int channel, 988static void handle_channel(struct i5000_pvt *pvt, int slot, int channel,
diff --git a/drivers/edac/i5400_edac.c b/drivers/edac/i5400_edac.c
index be1880de33a6..3004b946c403 100644
--- a/drivers/edac/i5400_edac.c
+++ b/drivers/edac/i5400_edac.c
@@ -300,24 +300,6 @@ static inline int extract_fbdchan_indx(u32 x)
300 return (x>>28) & 0x3; 300 return (x>>28) & 0x3;
301} 301}
302 302
303#ifdef CONFIG_EDAC_DEBUG
304/* MTR NUMROW */
305static const char *numrow_toString[] = {
306 "8,192 - 13 rows",
307 "16,384 - 14 rows",
308 "32,768 - 15 rows",
309 "65,536 - 16 rows"
310};
311
312/* MTR NUMCOL */
313static const char *numcol_toString[] = {
314 "1,024 - 10 columns",
315 "2,048 - 11 columns",
316 "4,096 - 12 columns",
317 "reserved"
318};
319#endif
320
321/* Device name and register DID (Device ID) */ 303/* Device name and register DID (Device ID) */
322struct i5400_dev_info { 304struct i5400_dev_info {
323 const char *ctl_name; /* name for this device */ 305 const char *ctl_name; /* name for this device */
@@ -915,8 +897,16 @@ static void decode_mtr(int slot_row, u16 mtr)
915 897
916 debugf2("\t\tNUMBANK: %d bank(s)\n", MTR_DRAM_BANKS(mtr)); 898 debugf2("\t\tNUMBANK: %d bank(s)\n", MTR_DRAM_BANKS(mtr));
917 debugf2("\t\tNUMRANK: %s\n", MTR_DIMM_RANK(mtr) ? "double" : "single"); 899 debugf2("\t\tNUMRANK: %s\n", MTR_DIMM_RANK(mtr) ? "double" : "single");
918 debugf2("\t\tNUMROW: %s\n", numrow_toString[MTR_DIMM_ROWS(mtr)]); 900 debugf2("\t\tNUMROW: %s\n",
919 debugf2("\t\tNUMCOL: %s\n", numcol_toString[MTR_DIMM_COLS(mtr)]); 901 MTR_DIMM_ROWS(mtr) == 0 ? "8,192 - 13 rows" :
902 MTR_DIMM_ROWS(mtr) == 1 ? "16,384 - 14 rows" :
903 MTR_DIMM_ROWS(mtr) == 2 ? "32,768 - 15 rows" :
904 "65,536 - 16 rows");
905 debugf2("\t\tNUMCOL: %s\n",
906 MTR_DIMM_COLS(mtr) == 0 ? "1,024 - 10 columns" :
907 MTR_DIMM_COLS(mtr) == 1 ? "2,048 - 11 columns" :
908 MTR_DIMM_COLS(mtr) == 2 ? "4,096 - 12 columns" :
909 "reserved");
920} 910}
921 911
922static void handle_channel(struct i5400_pvt *pvt, int dimm, int channel, 912static void handle_channel(struct i5400_pvt *pvt, int dimm, int channel,
diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c
index 20435ee47077..7eca688f7885 100644
--- a/drivers/edac/i7300_edac.c
+++ b/drivers/edac/i7300_edac.c
@@ -182,24 +182,6 @@ static const u16 mtr_regs[MAX_SLOTS] = {
182#define MTR_DIMM_COLS(mtr) ((mtr) & 0x3) 182#define MTR_DIMM_COLS(mtr) ((mtr) & 0x3)
183#define MTR_DIMM_COLS_ADDR_BITS(mtr) (MTR_DIMM_COLS(mtr) + 10) 183#define MTR_DIMM_COLS_ADDR_BITS(mtr) (MTR_DIMM_COLS(mtr) + 10)
184 184
185#ifdef CONFIG_EDAC_DEBUG
186/* MTR NUMROW */
187static const char *numrow_toString[] = {
188 "8,192 - 13 rows",
189 "16,384 - 14 rows",
190 "32,768 - 15 rows",
191 "65,536 - 16 rows"
192};
193
194/* MTR NUMCOL */
195static const char *numcol_toString[] = {
196 "1,024 - 10 columns",
197 "2,048 - 11 columns",
198 "4,096 - 12 columns",
199 "reserved"
200};
201#endif
202
203/************************************************ 185/************************************************
204 * i7300 Register definitions for error detection 186 * i7300 Register definitions for error detection
205 ************************************************/ 187 ************************************************/
@@ -645,8 +627,16 @@ static int decode_mtr(struct i7300_pvt *pvt,
645 627
646 debugf2("\t\tNUMBANK: %d bank(s)\n", MTR_DRAM_BANKS(mtr)); 628 debugf2("\t\tNUMBANK: %d bank(s)\n", MTR_DRAM_BANKS(mtr));
647 debugf2("\t\tNUMRANK: %s\n", MTR_DIMM_RANKS(mtr) ? "double" : "single"); 629 debugf2("\t\tNUMRANK: %s\n", MTR_DIMM_RANKS(mtr) ? "double" : "single");
648 debugf2("\t\tNUMROW: %s\n", numrow_toString[MTR_DIMM_ROWS(mtr)]); 630 debugf2("\t\tNUMROW: %s\n",
649 debugf2("\t\tNUMCOL: %s\n", numcol_toString[MTR_DIMM_COLS(mtr)]); 631 MTR_DIMM_ROWS(mtr) == 0 ? "8,192 - 13 rows" :
632 MTR_DIMM_ROWS(mtr) == 1 ? "16,384 - 14 rows" :
633 MTR_DIMM_ROWS(mtr) == 2 ? "32,768 - 15 rows" :
634 "65,536 - 16 rows");
635 debugf2("\t\tNUMCOL: %s\n",
636 MTR_DIMM_COLS(mtr) == 0 ? "1,024 - 10 columns" :
637 MTR_DIMM_COLS(mtr) == 1 ? "2,048 - 11 columns" :
638 MTR_DIMM_COLS(mtr) == 2 ? "4,096 - 12 columns" :
639 "reserved");
650 debugf2("\t\tSIZE: %d MB\n", dinfo->megabytes); 640 debugf2("\t\tSIZE: %d MB\n", dinfo->megabytes);
651 641
652 /* 642 /*