Skip to contentSkip to conversation

staging: mt7621-mmc: Fix debug macros and their usages

PATCH Superseded Nishad Kamdar 2 participants 6 messages Aug 31, 2018 – Sep 15, 2018

Subsystems (2)

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v6 cover staging: mt7621-mmc: Fix debug macros and their usages

This patchset fixes the three debug macros N_MSG, ERR_MSG, and IRQ_MSG. Each patch fixes one particular macro and its usages.

For N_MSG, deletes the macro and its users as it is a no-op.

For ERR_MSG and IRQ_MSG, replaces printk with dev_<level> without __func__ or __LINE__ or current->comm and current->pid. Removes the do {} while(0) loop for the single statement macro. Further drops the macros and replaces their usages with dev_<level>. Deletes the commented usages.

Changes in v6:
- Delete N_MSG() macro and its users as it is a no-op.
- Patchset reduced to 3 patches as the patch INIT_MSG patch is accepted.

Changes in v5:
- Remove commented code for N_MSG().
- Remove commented ERR_MSG() usages.

Changes in v4:
- Create multiple patches, one for each type of macro being deleted/changed.

Changes in v3:
- Replace usages of ERR_MSG and IRQ_MSG with dev_err() in code itself.
- Remove all INIT_MSG usages.
- Drop ERR_MSG, INIT_MSG and IRQ_MSG from dbg.h.

Changes in v2:
- Replace printk with dev_<level>.
- Remove __func__, __LINE__, current->comm, current->pid from arguments.
- Remove the do {} while(0) loop from these macros.
- Modify commit message to include other changes.

Nishad Kamdar (3):
staging: mt7621-mmc: Delete N_MSG() and all its users
staging: mt7621-mmc: Fix debug macro ERR_MSG and its usages
staging: mt7621-mmc: Fix debug macro IRQ_MSG and its usages

 drivers/staging/mt7621-mmc/dbg.h |  28 ---
 drivers/staging/mt7621-mmc/sd.c  | 398 +++++++++----------------------
 2 files changed, 108 insertions(+), 318 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v6 1/3 staging: mt7621-mmc: Delete N_MSG() and all its users

This patch removes N_MSG() and all its users since it is a no-op.

---
Changes in v6:
- Delete N_MSG() and all its users.
Changes in v5:
- Remove commented code for N_MSG()

---
 drivers/staging/mt7621-mmc/dbg.h |  10 --
 drivers/staging/mt7621-mmc/sd.c  | 242 -------------------------------
 2 files changed, 252 deletions(-)
drivers/staging/mt7621-mmc/dbg.h +0 -10
index 4d4898a3ab54..9152db30a2ed 100644
@@ -102,16 +102,6 @@ do { \
 } while (0)
 #endif /* end of +++ */
 
-#define N_MSG(evt, fmt, args...)
-/*
-do {    \
-    if ((DBG_EVT_##evt) & sd_debug_zone[host->id]) { \
-        printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \
-            host->id,  ##args , __FUNCTION__, __LINE__, current->comm, current->pid);	\
-    } \
-} while(0)
-*/
-
 #define ERR_MSG(fmt, args...) \
 do { \
 	printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \
drivers/staging/mt7621-mmc/sd.c +0 -242

387 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

PATCH v6 2/3 staging: mt7621-mmc: Fix debug macro ERR_MSG and its usages

In reply to Nishad Kamdar

Replace all usages of ERR_MSG with with dev_<level> without __func__ or __LINE__ or current->comm and current->pid. Remove the do {} while(0) loop for the single statement macro. Delete commented ERR_MSG() usage. Drop ERR_MSG from dbg.h. Issue found by checkpatch.

---
Changes in v6:
- No change
Changes in v5:
- Remove commented ERR_MSG() usage.

---
 drivers/staging/mt7621-mmc/dbg.h |   6 --
 drivers/staging/mt7621-mmc/sd.c  | 120 +++++++++++++++++++++----------
 2 files changed, 81 insertions(+), 45 deletions(-)
drivers/staging/mt7621-mmc/dbg.h +0 -6
index 9152db30a2ed..79914d98c573 100644
@@ -102,12 +102,6 @@ do { \
 } while (0)
 #endif /* end of +++ */
 
-#define ERR_MSG(fmt, args...) \
-do { \
-	printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d> PID<%s><0x%x>\n", \
-	       host->id,  ##args, __FUNCTION__, __LINE__, current->comm, current->pid); \
-} while (0);
-
 #if 1
 //defined CONFIG_MTK_MMC_CD_POLL
 #define IRQ_MSG(fmt, args...)
drivers/staging/mt7621-mmc/sd.c +81 -39

252 lines not on this page · raw message

Signature · 1 line
2.17.1
#3 lore raw

PATCH v6 3/3 staging: mt7621-mmc: Fix debug macro IRQ_MSG and its usages

In reply to Nishad Kamdar

Replace all usages of IRQ_MSG with with dev_<level> without __func__ or __LINE__ or current->comm and current->pid. Remove the do {} while(0) loop for the single statement macro. Drop IRQ_MSG from dbg.h. Issue found by checkpatch.

---
Changes in v6:
- No change
Changes in v5:
- No change

---
 drivers/staging/mt7621-mmc/dbg.h | 12 -----------
 drivers/staging/mt7621-mmc/sd.c  | 36 ++++++++++++++++++++++++--------
 2 files changed, 27 insertions(+), 21 deletions(-)
drivers/staging/mt7621-mmc/dbg.h +0 -12
index 79914d98c573..4ab9f10dccc2 100644
@@ -102,18 +102,6 @@ do { \
 } while (0)
 #endif /* end of +++ */
 
-#if 1
-//defined CONFIG_MTK_MMC_CD_POLL
-#define IRQ_MSG(fmt, args...)
-#else
-/* PID in ISR in not corrent */
-#define IRQ_MSG(fmt, args...) \
-do { \
-	printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d>\n",	\
-	       host->id,  ##args, __FUNCTION__, __LINE__);	\
-} while (0);
-#endif
-
 void msdc_debug_proc_init(void);
 
 #if 0 /* --- chhung */
drivers/staging/mt7621-mmc/sd.c +27 -9
index 7474f9ed7b5b..f3ae19fe0f76 100644
@@ -279,7 +279,9 @@ static void msdc_tasklet_card(struct work_struct *work)
 		mmc_detect_change(host->mmc, msecs_to_jiffies(20));
 	}
 
-	IRQ_MSG("card found<%s>", inserted ? "inserted" : "removed");
+	dev_err(mmc_dev(host->mmc),
+		"%d -> card found<%s>\n",
+		host->id, inserted ? "inserted" : "removed");
 #endif
 
 	spin_unlock(&host->lock);
@@ -1638,14 +1640,17 @@ static irqreturn_t msdc_irq(int irq, void *dev_id)
 	if (intsts & MSDC_INT_CDSC) {
 		if (host->mmc->caps & MMC_CAP_NEEDS_POLL)
 			return IRQ_HANDLED;
-		IRQ_MSG("MSDC_INT_CDSC irq<0x%.8x>", intsts);
+		dev_err(mmc_dev(host->mmc),
+			"%d -> MSDC_INT_CDSC irq<0x%.8x>\n", host->id, intsts);
 		schedule_delayed_work(&host->card_delaywork, HZ);
 		/* tuning when plug card ? */
 	}
 
 	/* sdio interrupt */
 	if (intsts & MSDC_INT_SDIOIRQ) {
-		IRQ_MSG("XXX MSDC_INT_SDIOIRQ");  /* seems not sdio irq */
+		dev_err(mmc_dev(host->mmc),
+			"%d -> XXX MSDC_INT_SDIOIRQ\n",
+			host->id); /* seems not sdio irq */
 		//mmc_signal_sdio_irq(host->mmc);
 	}
 
@@ -1663,10 +1668,15 @@ static irqreturn_t msdc_irq(int irq, void *dev_id)
 			msdc_clr_int();
 
 			if (intsts & MSDC_INT_DATTMO) {
-				IRQ_MSG("XXX CMD<%d> MSDC_INT_DATTMO", host->mrq->cmd->opcode);
+				dev_err(mmc_dev(host->mmc),
+					"%d -> XXX CMD<%d> MSDC_INT_DATTMO\n",
+					host->id, host->mrq->cmd->opcode);
 				data->error = -ETIMEDOUT;
 			} else if (intsts & MSDC_INT_DATCRCERR) {
-				IRQ_MSG("XXX CMD<%d> MSDC_INT_DATCRCERR, SDC_DCRC_STS<0x%x>", host->mrq->cmd->opcode, readl(host->base + SDC_DCRC_STS));
+				dev_err(mmc_dev(host->mmc),
+					"%d -> XXX CMD<%d> MSDC_INT_DATCRCERR, SDC_DCRC_STS<0x%x>\n",
+					host->id, host->mrq->cmd->opcode,
+					readl(host->base + SDC_DCRC_STS);
 				data->error = -EIO;
 			}
 
@@ -1699,15 +1709,23 @@ static irqreturn_t msdc_irq(int irq, void *dev_id)
 			}
 		} else if ((intsts & MSDC_INT_RSPCRCERR) || (intsts & MSDC_INT_ACMDCRCERR)) {
 			if (intsts & MSDC_INT_ACMDCRCERR)
-				IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDCRCERR", cmd->opcode);
+				dev_err(mmc_dev(host->mmc),
+					"%d -> XXX CMD<%d> MSDC_INT_ACMDCRCERR\n",
+					host->id, cmd->opcode);
 			else
-				IRQ_MSG("XXX CMD<%d> MSDC_INT_RSPCRCERR", cmd->opcode);
+				dev_err(mmc_dev(host->mmc),
+					"%d -> XXX CMD<%d> MSDC_INT_RSPCRCERR\n",
+					host->id, cmd->opcode);
 			cmd->error = -EIO;
 		} else if ((intsts & MSDC_INT_CMDTMO) || (intsts & MSDC_INT_ACMDTMO)) {
 			if (intsts & MSDC_INT_ACMDTMO)
-				IRQ_MSG("XXX CMD<%d> MSDC_INT_ACMDTMO", cmd->opcode);
+				dev_err(mmc_dev(host->mmc),
+					"%d -> XXX CMD<%d> MSDC_INT_ACMDTMO\n",
+					host->id, cmd->opcode);
 			else
-				IRQ_MSG("XXX CMD<%d> MSDC_INT_CMDTMO", cmd->opcode);
+				dev_err(mmc_dev(host->mmc),
+					"%d -> XXX CMD<%d> MSDC_INT_CMDTMO\n",
+					host->id, cmd->opcode);
 			cmd->error = -ETIMEDOUT;
 			msdc_reset_hw(host);
 			msdc_clr_fifo(host);
Signature · 1 line
2.17.1
#4 lore raw

Re: [PATCH v6 3/3] staging: mt7621-mmc: Fix debug macro IRQ_MSG and its usages

Quoted 21 lines · Nishad Kamdar

Replace all usages of IRQ_MSG with with dev_<level> without __func__ or __LINE__ or current->comm and current->pid. Remove the do {} while(0) loop for the single statement macro. Drop IRQ_MSG from dbg.h. Issue found by checkpatch.

---
Changes in v6:
- No change
Changes in v5:
- No change

---
 drivers/staging/mt7621-mmc/dbg.h | 12 -----------
 drivers/staging/mt7621-mmc/sd.c  | 36 ++++++++++++++++++++++++--------
 2 files changed, 27 insertions(+), 21 deletions(-)
drivers/staging/mt7621-mmc/dbg.h +0 -0
index 79914d98c573..4ab9f10dccc2 100644

drivers/staging/mt7621-mmc/dbg.h do { \ · line 107

Quoted 6 lines
drivers/staging/mt7621-mmc/dbg.h +0 -3
@@ -102,18 +102,6 @@ do { \
 } while (0)
 #endif /* end of +++ */
 
-#if 1
-//defined CONFIG_MTK_MMC_CD_POLL
-#define IRQ_MSG(fmt, args...)

So right now this define does nothing, yet:

Quoted 17 lines
drivers/staging/mt7621-mmc/dbg.h +0 -9
-#else
-/* PID in ISR in not corrent */
-#define IRQ_MSG(fmt, args...) \
-do { \
-	printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d>\n",	\
-	       host->id,  ##args, __FUNCTION__, __LINE__);	\
-} while (0);
-#endif
-
 void msdc_debug_proc_init(void);
 
 #if 0 /* --- chhung */
drivers/staging/mt7621-mmc/sd.c +0 -0
index 7474f9ed7b5b..f3ae19fe0f76 100644

drivers/staging/mt7621-mmc/sd.c static void msdc_tasklet_card(struct work_struct *work) · line 284

Quoted 7 lines
drivers/staging/mt7621-mmc/sd.c +3 -1
@@ -279,7 +279,9 @@ static void msdc_tasklet_card(struct work_struct *work)
 		mmc_detect_change(host->mmc, msecs_to_jiffies(20));
 	}
 
-	IRQ_MSG("card found<%s>", inserted ? "inserted" : "removed");
+	dev_err(mmc_dev(host->mmc),
+		"%d -> card found<%s>\n",
+		host->id, inserted ? "inserted" : "removed");

You are now printing out lots of "errors" that really are not errors.

As these messages are not being printed at all right now, why not just delete these as well?

Your first 2 patches do look good, I've queued them up now.

thanks,

greg k-h

#5 lore raw

Re: [PATCH v6 3/3] staging: mt7621-mmc: Fix debug macro IRQ_MSG and its usages

Quoted 58 lines · Greg Kroah-Hartman
Quoted 21 lines · Nishad Kamdar

Replace all usages of IRQ_MSG with with dev_<level> without __func__ or __LINE__ or current->comm and current->pid. Remove the do {} while(0) loop for the single statement macro. Drop IRQ_MSG from dbg.h. Issue found by checkpatch.

---
Changes in v6:
- No change
Changes in v5:
- No change

---
 drivers/staging/mt7621-mmc/dbg.h | 12 -----------
 drivers/staging/mt7621-mmc/sd.c  | 36 ++++++++++++++++++++++++--------
 2 files changed, 27 insertions(+), 21 deletions(-)
drivers/staging/mt7621-mmc/dbg.h +0 -0
index 79914d98c573..4ab9f10dccc2 100644

drivers/staging/mt7621-mmc/dbg.h do { \ · line 107

Quoted 6 lines
drivers/staging/mt7621-mmc/dbg.h +0 -3
@@ -102,18 +102,6 @@ do { \
 } while (0)
 #endif /* end of +++ */
 
-#if 1
-//defined CONFIG_MTK_MMC_CD_POLL
-#define IRQ_MSG(fmt, args...)

So right now this define does nothing, yet:

Quoted 17 lines
drivers/staging/mt7621-mmc/dbg.h +0 -9
-#else
-/* PID in ISR in not corrent */
-#define IRQ_MSG(fmt, args...) \
-do { \
-	printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d>\n",	\
-	       host->id,  ##args, __FUNCTION__, __LINE__);	\
-} while (0);
-#endif
-
 void msdc_debug_proc_init(void);
 
 #if 0 /* --- chhung */
drivers/staging/mt7621-mmc/sd.c +0 -0
index 7474f9ed7b5b..f3ae19fe0f76 100644

drivers/staging/mt7621-mmc/sd.c static void msdc_tasklet_card(struct work_struct *work) · line 284

Quoted 7 lines
drivers/staging/mt7621-mmc/sd.c +3 -1
@@ -279,7 +279,9 @@ static void msdc_tasklet_card(struct work_struct *work)
 		mmc_detect_change(host->mmc, msecs_to_jiffies(20));
 	}
 
-	IRQ_MSG("card found<%s>", inserted ? "inserted" : "removed");
+	dev_err(mmc_dev(host->mmc),
+		"%d -> card found<%s>\n",
+		host->id, inserted ? "inserted" : "removed");

You are now printing out lots of "errors" that really are not errors.

Quoted 8 lines

As these messages are not being printed at all right now, why not just delete these as well?

Your first 2 patches do look good, I've queued them up now.

thanks,

greg k-h

Ok, I'll do that.

Thanks for the review.

regards,
nishad