diff options
author | Joe Perches <joe@perches.com> | 2012-04-28 15:41:46 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-06-11 12:23:48 -0400 |
commit | 7e881856eee8b889b76cd1d8e04ce2fc79b72099 (patch) | |
tree | 1cd297b48d2193bce416a5516583fe65630c2d45 /drivers/edac | |
parent | dd23cd6eb1f59ba722a6e6aa228adff7c01404de (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/edac')
-rw-r--r-- | drivers/edac/edac_core.h | 35 | ||||
-rw-r--r-- | drivers/edac/i5000_edac.c | 30 | ||||
-rw-r--r-- | drivers/edac/i5400_edac.c | 30 | ||||
-rw-r--r-- | drivers/edac/i7300_edac.c | 30 |
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 |
72 | extern int edac_debug_level; | 72 | extern int edac_debug_level; |
73 | 73 | ||
74 | #define edac_debug_printk(level, fmt, arg...) \ | 74 | #define edac_debug_printk(level, fmt, ...) \ |
75 | do { \ | 75 | do { \ |
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( ... ) | 84 | do { \ |
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 | ||
291 | static char *numrow_toString[] = { | ||
292 | "8,192 - 13 rows", | ||
293 | "16,384 - 14 rows", | ||
294 | "32,768 - 15 rows", | ||
295 | "reserved" | ||
296 | }; | ||
297 | |||
298 | static 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 */ |
307 | static int misc_messages; | 291 | static 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 | ||
996 | static void handle_channel(struct i5000_pvt *pvt, int slot, int channel, | 988 | static 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 */ | ||
305 | static 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 */ | ||
313 | static 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) */ |
322 | struct i5400_dev_info { | 304 | struct 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 | ||
922 | static void handle_channel(struct i5400_pvt *pvt, int dimm, int channel, | 912 | static 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 */ | ||
187 | static 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 */ | ||
195 | static 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 | /* |