Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Joe Perches and committed by
Mauro Carvalho Chehab
7e881856 dd23cd6e

+49 -76
+18 -17
drivers/edac/edac_core.h
··· 71 71 #ifdef CONFIG_EDAC_DEBUG 72 72 extern int edac_debug_level; 73 73 74 - #define edac_debug_printk(level, fmt, arg...) \ 75 - do { \ 76 - if (level <= edac_debug_level) \ 77 - edac_printk(KERN_DEBUG, EDAC_DEBUG, \ 78 - "%s: " fmt, __func__, ##arg); \ 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__ ) 74 + #define edac_debug_printk(level, fmt, ...) \ 75 + do { \ 76 + if (level <= edac_debug_level) \ 77 + edac_printk(KERN_DEBUG, EDAC_DEBUG, \ 78 + "%s: " fmt, __func__, ##__VA_ARGS__); \ 79 + } while (0) 86 80 87 81 #else /* !CONFIG_EDAC_DEBUG */ 88 82 89 - #define debugf0( ... ) 90 - #define debugf1( ... ) 91 - #define debugf2( ... ) 92 - #define debugf3( ... ) 93 - #define debugf4( ... ) 83 + #define edac_debug_printk(level, fmt, ...) \ 84 + do { \ 85 + if (0) \ 86 + edac_printk(KERN_DEBUG, EDAC_DEBUG, \ 87 + "%s: " fmt, __func__, ##__VA_ARGS__); \ 88 + } while (0) 94 89 95 90 #endif /* !CONFIG_EDAC_DEBUG */ 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__) 96 97 97 98 #define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \ 98 99 PCI_DEVICE_ID_ ## vend ## _ ## dev
+11 -19
drivers/edac/i5000_edac.c
··· 273 273 #define CHANNELS_PER_BRANCH 2 274 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 277 * MTRx - Memory Technology Registers 278 278 */ 279 279 #define MTR_DIMMS_PRESENT(mtr) ((mtr) & (0x1 << 8)) ··· 286 286 #define MTR_DIMM_ROWS_ADDR_BITS(mtr) (MTR_DIMM_ROWS(mtr) + 13) 287 287 #define MTR_DIMM_COLS(mtr) ((mtr) & 0x3) 288 288 #define MTR_DIMM_COLS_ADDR_BITS(mtr) (MTR_DIMM_COLS(mtr) + 10) 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 289 306 290 /* enables the report of miscellaneous messages as CE errors - default off */ 307 291 static int misc_messages; ··· 973 989 debugf2("\t\tWIDTH: x%d\n", MTR_DRAM_WIDTH(mtr)); 974 990 debugf2("\t\tNUMBANK: %d bank(s)\n", MTR_DRAM_BANKS(mtr)); 975 991 debugf2("\t\tNUMRANK: %s\n", MTR_DIMM_RANK(mtr) ? "double" : "single"); 976 - debugf2("\t\tNUMROW: %s\n", numrow_toString[MTR_DIMM_ROWS(mtr)]); 977 - debugf2("\t\tNUMCOL: %s\n", numcol_toString[MTR_DIMM_COLS(mtr)]); 992 + debugf2("\t\tNUMROW: %s\n", 993 + MTR_DIMM_ROWS(mtr) == 0 ? "8,192 - 13 rows" : 994 + MTR_DIMM_ROWS(mtr) == 1 ? "16,384 - 14 rows" : 995 + MTR_DIMM_ROWS(mtr) == 2 ? "32,768 - 15 rows" : 996 + "reserved"); 997 + debugf2("\t\tNUMCOL: %s\n", 998 + MTR_DIMM_COLS(mtr) == 0 ? "1,024 - 10 columns" : 999 + MTR_DIMM_COLS(mtr) == 1 ? "2,048 - 11 columns" : 1000 + MTR_DIMM_COLS(mtr) == 2 ? "4,096 - 12 columns" : 1001 + "reserved"); 978 1002 } 979 1003 980 1004 static void handle_channel(struct i5000_pvt *pvt, int slot, int channel,
+10 -20
drivers/edac/i5400_edac.c
··· 300 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 303 /* Device name and register DID (Device ID) */ 322 304 struct i5400_dev_info { 323 305 const char *ctl_name; /* name for this device */ ··· 897 915 898 916 debugf2("\t\tNUMBANK: %d bank(s)\n", MTR_DRAM_BANKS(mtr)); 899 917 debugf2("\t\tNUMRANK: %s\n", MTR_DIMM_RANK(mtr) ? "double" : "single"); 900 - debugf2("\t\tNUMROW: %s\n", numrow_toString[MTR_DIMM_ROWS(mtr)]); 901 - debugf2("\t\tNUMCOL: %s\n", numcol_toString[MTR_DIMM_COLS(mtr)]); 918 + debugf2("\t\tNUMROW: %s\n", 919 + MTR_DIMM_ROWS(mtr) == 0 ? "8,192 - 13 rows" : 920 + MTR_DIMM_ROWS(mtr) == 1 ? "16,384 - 14 rows" : 921 + MTR_DIMM_ROWS(mtr) == 2 ? "32,768 - 15 rows" : 922 + "65,536 - 16 rows"); 923 + debugf2("\t\tNUMCOL: %s\n", 924 + MTR_DIMM_COLS(mtr) == 0 ? "1,024 - 10 columns" : 925 + MTR_DIMM_COLS(mtr) == 1 ? "2,048 - 11 columns" : 926 + MTR_DIMM_COLS(mtr) == 2 ? "4,096 - 12 columns" : 927 + "reserved"); 902 928 } 903 929 904 930 static void handle_channel(struct i5400_pvt *pvt, int dimm, int channel,
+10 -20
drivers/edac/i7300_edac.c
··· 182 182 #define MTR_DIMM_COLS(mtr) ((mtr) & 0x3) 183 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 186 * i7300 Register definitions for error detection 205 187 ************************************************/ ··· 627 645 628 646 debugf2("\t\tNUMBANK: %d bank(s)\n", MTR_DRAM_BANKS(mtr)); 629 647 debugf2("\t\tNUMRANK: %s\n", MTR_DIMM_RANKS(mtr) ? "double" : "single"); 630 - debugf2("\t\tNUMROW: %s\n", numrow_toString[MTR_DIMM_ROWS(mtr)]); 631 - debugf2("\t\tNUMCOL: %s\n", numcol_toString[MTR_DIMM_COLS(mtr)]); 648 + debugf2("\t\tNUMROW: %s\n", 649 + MTR_DIMM_ROWS(mtr) == 0 ? "8,192 - 13 rows" : 650 + MTR_DIMM_ROWS(mtr) == 1 ? "16,384 - 14 rows" : 651 + MTR_DIMM_ROWS(mtr) == 2 ? "32,768 - 15 rows" : 652 + "65,536 - 16 rows"); 653 + debugf2("\t\tNUMCOL: %s\n", 654 + MTR_DIMM_COLS(mtr) == 0 ? "1,024 - 10 columns" : 655 + MTR_DIMM_COLS(mtr) == 1 ? "2,048 - 11 columns" : 656 + MTR_DIMM_COLS(mtr) == 2 ? "4,096 - 12 columns" : 657 + "reserved"); 632 658 debugf2("\t\tSIZE: %d MB\n", dinfo->megabytes); 633 659 634 660 /*