[MMC] Pass -DDEBUG on compiler command line if MMC_DEBUG selected

Rather than each driver test MMC_DEBUG itself, and define DEBUG,
pass it in via the makefile instead.

Fix drivers to use pr_debug() where appropriate, and avoid defining
a DEBUG() macro.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by Russell King and committed by Russell King c6563178 730c9b7e

+32 -58
+4
drivers/mmc/Makefile
··· 23 23 obj-$(CONFIG_MMC_OMAP) += omap.o 24 24 25 25 mmc_core-y := mmc.o mmc_queue.o mmc_sysfs.o 26 + 27 + ifeq ($(CONFIG_MMC_DEBUG),y) 28 + EXTRA_CFLAGS += -DDEBUG 29 + endif
+9 -10
drivers/mmc/au1xmmc.c
··· 56 56 #define DRIVER_NAME "au1xxx-mmc" 57 57 58 58 /* Set this to enable special debugging macros */ 59 - /* #define MMC_DEBUG */ 60 59 61 - #ifdef MMC_DEBUG 62 - #define DEBUG(fmt, idx, args...) printk("au1xx(%d): DEBUG: " fmt, idx, ##args) 60 + #ifdef DEBUG 61 + #define DBG(fmt, idx, args...) printk("au1xx(%d): DEBUG: " fmt, idx, ##args) 63 62 #else 64 - #define DEBUG(fmt, idx, args...) 63 + #define DBG(fmt, idx, args...) 65 64 #endif 66 65 67 66 const struct { ··· 423 424 break; 424 425 425 426 if (status & SD_STATUS_RC) { 426 - DEBUG("RX CRC Error [%d + %d].\n", host->id, 427 + DBG("RX CRC Error [%d + %d].\n", host->id, 427 428 host->pio.len, count); 428 429 break; 429 430 } 430 431 431 432 if (status & SD_STATUS_RO) { 432 - DEBUG("RX Overrun [%d + %d]\n", host->id, 433 + DBG("RX Overrun [%d + %d]\n", host->id, 433 434 host->pio.len, count); 434 435 break; 435 436 } 436 437 else if (status & SD_STATUS_RU) { 437 - DEBUG("RX Underrun [%d + %d]\n", host->id, 438 + DBG("RX Underrun [%d + %d]\n", host->id, 438 439 host->pio.len, count); 439 440 break; 440 441 } ··· 720 721 { 721 722 struct au1xmmc_host *host = mmc_priv(mmc); 722 723 723 - DEBUG("set_ios (power=%u, clock=%uHz, vdd=%u, mode=%u)\n", 724 + DBG("set_ios (power=%u, clock=%uHz, vdd=%u, mode=%u)\n", 724 725 host->id, ios->power_mode, ios->clock, ios->vdd, 725 726 ios->bus_mode); 726 727 ··· 809 810 au1xmmc_receive_pio(host); 810 811 } 811 812 else if (status & 0x203FBC70) { 812 - DEBUG("Unhandled status %8.8x\n", host->id, status); 813 + DBG("Unhandled status %8.8x\n", host->id, status); 813 814 handled = 0; 814 815 } 815 816 ··· 838 839 839 840 if (host->mrq != NULL) { 840 841 u32 status = au_readl(HOST_STATUS(host)); 841 - DEBUG("PENDING - %8.8x\n", host->id, status); 842 + DBG("PENDING - %8.8x\n", host->id, status); 842 843 } 843 844 844 845 mod_timer(&host->timer, jiffies + AU1XMMC_DETECT_TIMEOUT);
+7 -12
drivers/mmc/mmc.c
··· 27 27 28 28 #include "mmc.h" 29 29 30 - #ifdef CONFIG_MMC_DEBUG 31 - #define DBG(x...) printk(KERN_DEBUG x) 32 - #else 33 - #define DBG(x...) do { } while (0) 34 - #endif 35 - 36 30 #define CMD_RETRIES 3 37 31 38 32 /* ··· 71 77 { 72 78 struct mmc_command *cmd = mrq->cmd; 73 79 int err = mrq->cmd->error; 74 - DBG("MMC: req done (%02x): %d: %08x %08x %08x %08x\n", cmd->opcode, 75 - err, cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]); 80 + pr_debug("MMC: req done (%02x): %d: %08x %08x %08x %08x\n", 81 + cmd->opcode, err, cmd->resp[0], cmd->resp[1], 82 + cmd->resp[2], cmd->resp[3]); 76 83 77 84 if (err && cmd->retries) { 78 85 cmd->retries--; ··· 97 102 void 98 103 mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) 99 104 { 100 - DBG("MMC: starting cmd %02x arg %08x flags %08x\n", 101 - mrq->cmd->opcode, mrq->cmd->arg, mrq->cmd->flags); 105 + pr_debug("MMC: starting cmd %02x arg %08x flags %08x\n", 106 + mrq->cmd->opcode, mrq->cmd->arg, mrq->cmd->flags); 102 107 103 108 WARN_ON(host->card_busy == NULL); 104 109 ··· 971 976 if (!mmc_card_dead(card) && max_dtr > card->csd.max_dtr) 972 977 max_dtr = card->csd.max_dtr; 973 978 974 - DBG("MMC: selected %d.%03dMHz transfer rate\n", 975 - max_dtr / 1000000, (max_dtr / 1000) % 1000); 979 + pr_debug("MMC: selected %d.%03dMHz transfer rate\n", 980 + max_dtr / 1000000, (max_dtr / 1000) % 1000); 976 981 977 982 return max_dtr; 978 983 }
-4
drivers/mmc/mmci.c
··· 33 33 34 34 #define DRIVER_NAME "mmci-pl18x" 35 35 36 - #ifdef CONFIG_MMC_DEBUG 37 36 #define DBG(host,fmt,args...) \ 38 37 pr_debug("%s: %s: " fmt, mmc_hostname(host->mmc), __func__ , args) 39 - #else 40 - #define DBG(host,fmt,args...) do { } while (0) 41 - #endif 42 38 43 39 static unsigned int fmax = 515633; 44 40
-5
drivers/mmc/omap.c
··· 12 12 */ 13 13 14 14 #include <linux/config.h> 15 - 16 - #ifdef CONFIG_MMC_DEBUG 17 - #define DEBUG /* for dev_dbg(), pr_debug(), etc */ 18 - #endif 19 - 20 15 #include <linux/module.h> 21 16 #include <linux/moduleparam.h> 22 17 #include <linux/init.h>
+9 -15
drivers/mmc/pxamci.c
··· 37 37 38 38 #include "pxamci.h" 39 39 40 - #ifdef CONFIG_MMC_DEBUG 41 - #define DBG(x...) printk(KERN_DEBUG x) 42 - #else 43 - #define DBG(x...) do { } while (0) 44 - #endif 45 - 46 40 #define DRIVER_NAME "pxa2xx-mci" 47 41 48 42 #define NR_SG 1 ··· 200 206 201 207 static void pxamci_finish_request(struct pxamci_host *host, struct mmc_request *mrq) 202 208 { 203 - DBG("PXAMCI: request done\n"); 209 + pr_debug("PXAMCI: request done\n"); 204 210 host->mrq = NULL; 205 211 host->cmd = NULL; 206 212 host->data = NULL; ··· 246 252 if ((cmd->resp[0] & 0x80000000) == 0) 247 253 cmd->error = MMC_ERR_BADCRC; 248 254 } else { 249 - DBG("ignoring CRC from command %d - *risky*\n",cmd->opcode); 255 + pr_debug("ignoring CRC from command %d - *risky*\n",cmd->opcode); 250 256 } 251 257 #else 252 258 cmd->error = MMC_ERR_BADCRC; ··· 311 317 312 318 ireg = readl(host->base + MMC_I_REG); 313 319 314 - DBG("PXAMCI: irq %08x\n", ireg); 320 + pr_debug("PXAMCI: irq %08x\n", ireg); 315 321 316 322 if (ireg) { 317 323 unsigned stat = readl(host->base + MMC_STAT); 318 324 319 - DBG("PXAMCI: stat %08x\n", stat); 325 + pr_debug("PXAMCI: stat %08x\n", stat); 320 326 321 327 if (ireg & END_CMD_RES) 322 328 handled |= pxamci_cmd_done(host, stat); ··· 370 376 { 371 377 struct pxamci_host *host = mmc_priv(mmc); 372 378 373 - DBG("pxamci_set_ios: clock %u power %u vdd %u.%02u\n", 374 - ios->clock, ios->power_mode, ios->vdd / 100, 375 - ios->vdd % 100); 379 + pr_debug("pxamci_set_ios: clock %u power %u vdd %u.%02u\n", 380 + ios->clock, ios->power_mode, ios->vdd / 100, 381 + ios->vdd % 100); 376 382 377 383 if (ios->clock) { 378 384 unsigned int clk = CLOCKRATE / ios->clock; ··· 399 405 host->cmdat |= CMDAT_INIT; 400 406 } 401 407 402 - DBG("pxamci_set_ios: clkrt = %x cmdat = %x\n", 403 - host->clkrt, host->cmdat); 408 + pr_debug("pxamci_set_ios: clkrt = %x cmdat = %x\n", 409 + host->clkrt, host->cmdat); 404 410 } 405 411 406 412 static struct mmc_host_ops pxamci_ops = {
+1 -5
drivers/mmc/sdhci.c
··· 31 31 32 32 #define BUGMAIL "<sdhci-devel@list.drzeus.cx>" 33 33 34 - #ifdef CONFIG_MMC_DEBUG 35 34 #define DBG(f, x...) \ 36 - printk(KERN_DEBUG DRIVER_NAME " [%s()]: " f, __func__,## x) 37 - #else 38 - #define DBG(f, x...) do { } while (0) 39 - #endif 35 + pr_debug(DRIVER_NAME " [%s()]: " f, __func__,## x) 40 36 41 37 static const struct pci_device_id pci_ids[] __devinitdata = { 42 38 /* handle any SD host controller */
+2 -7
drivers/mmc/wbsd.c
··· 44 44 #define DRIVER_NAME "wbsd" 45 45 #define DRIVER_VERSION "1.5" 46 46 47 - #ifdef CONFIG_MMC_DEBUG 48 47 #define DBG(x...) \ 49 - printk(KERN_DEBUG DRIVER_NAME ": " x) 48 + pr_debug(DRIVER_NAME ": " x) 50 49 #define DBGF(f, x...) \ 51 - printk(KERN_DEBUG DRIVER_NAME " [%s()]: " f, __func__ , ##x) 52 - #else 53 - #define DBG(x...) do { } while (0) 54 - #define DBGF(x...) do { } while (0) 55 - #endif 50 + pr_debug(DRIVER_NAME " [%s()]: " f, __func__ , ##x) 56 51 57 52 /* 58 53 * Device resources