staging: mt7621-mmc: Fix debug macros and their usages
Subsystems (2)
PATCH v3 1/1 staging: mt7621-mmc: Fix debug macros and their usages
Fixed four debug macros and their usages. Replaced printk with dev_<level> without __func__ or __LINE__ or current->comm and current->pid. Further removed the do {} while(0) loop for single statement macros.
Out of the four, replaced all usages of ERR_MSG and IRQ_MSG with dev_err() in the code itself and dropped them from dbg.h. Removed all INIT_MSG usages and dropped it from dgb.h. Issues found by checkpatch.
---
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.
--- drivers/staging/mt7621-mmc/dbg.h | 36 +------ drivers/staging/mt7621-mmc/sd.c | 180 ++++++++++++++++++++----------- 2 files changed, 121 insertions(+), 95 deletions(-)
drivers/staging/mt7621-mmc/dbg.h +4 -32
@@ -104,38 +104,10 @@ do { \ #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", \ - host->id, ##args, __FUNCTION__, __LINE__, current->comm, current->pid); \ -} while (0); - -#if 1 -//defined CONFIG_MTK_MMC_CD_POLL -#define INIT_MSG(fmt, args...) -#define IRQ_MSG(fmt, args...) -#else -#define INIT_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); - -/* 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 +*if ((DBG_EVT_##evt) & sd_debug_zone[host->id]) { \ +* dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args) \ +*} +*/ void msdc_debug_proc_init (void );
drivers/staging/mt7621-mmc/sd.c +117 -63
395 lines not on this page · raw message
Signature · 1 line
2.17.1
Greg Kroah-Hartman
maintainerQuoted 8 lines · Nishad Kamdar
Fixed four debug macros and their usages. Replaced printk with dev_<level> without
__func__or__LINE__orcurrent->commandcurrent->pid. Further removed the do {} while(0) loop for single statement macros.
Out of the four, replaced all usages ofERR_MSGandIRQ_MSGwithdev_err()in the code itself and dropped them fromdbg.h. Removed allINIT_MSGusages and dropped it fromdgb.h. Issues found by checkpatch.
This needs to be multiple patches. One for each type of macro you are deleting/changing, not all lumped together into one big patch.
Plaese fix that up and resend.
thanks,
greg k-h
Quoted 28 lines · Nishad Kamdar
#define
N_MSG(evt, fmt, args...)
/*drivers/staging/mt7621-mmc/dbg.h +0
-26-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", \ - host->id, ##args, __FUNCTION__, __LINE__, current->comm, current->pid); \ -} while (0); - -#if 1 -//defined CONFIG_MTK_MMC_CD_POLL -#define INIT_MSG(fmt, args...) -#define IRQ_MSG(fmt, args...) -#else -#define INIT_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); - -/* PID in ISR in not corrent */
drivers/staging/mt7621-mmc/dbg.h do { \ · line 110
Quoted 10 lines
drivers/staging/mt7621-mmc/dbg.h +4
-6-#define IRQ_MSG(fmt, args...) \ -do { \ - printk(KERN_ERR TAG"%d -> "fmt" <- %s() : L<%d>\n", \ - host->id, ##args, __FUNCTION__, __LINE__); \ -} while (0); -#endif +*if ((DBG_EVT_##evt) & sd_debug_zone[host->id]) { \ +* dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args) \ +*} +*/
I'm sorry but this patch doesn't make any sort of sense at all...
regards,
dan carpenter
Quoted 10 lines · Greg Kroah-Hartman
Quoted 8 lines · Nishad Kamdar
Fixed four debug macros and their usages. Replaced printk with dev_<level> without
__func__or__LINE__orcurrent->commandcurrent->pid. Further removed the do {} while(0) loop for single statement macros.
Out of the four, replaced all usages ofERR_MSGandIRQ_MSGwithdev_err()in the code itself and dropped them fromdbg.h. Removed allINIT_MSGusages and dropped it fromdgb.h. Issues found by checkpatch.
Quoted 8 lines
This needs to be multiple patches. One for each type of macro you are deleting/changing, not all lumped together into one big patch.
Plaese fix that up and resend.
thanks,
greg k-h
Ok, I'll do that.
Thanks for the review.
regards,
nishad
Quoted 10 lines · Greg Kroah-Hartman
Quoted 8 lines · Nishad Kamdar
Fixed four debug macros and their usages. Replaced printk with dev_<level> without
__func__or__LINE__orcurrent->commandcurrent->pid. Further removed the do {} while(0) loop for single statement macros.
Out of the four, replaced all usages ofERR_MSGandIRQ_MSGwithdev_err()in the code itself and dropped them fromdbg.h. Removed allINIT_MSGusages and dropped it fromdgb.h. Issues found by checkpatch.
Quoted 4 lines
This needs to be multiple patches. One for each type of macro you are deleting/changing, not all lumped together into one big patch.
Plaese fix that up and resend.
I'd also be tempted to add some logging macros like:
#define host_err(host, fmt, ...) \ dev_err(mmc_dev((host)->mmc, fmt, ##__VA_ARGS__)
so that the code flows a little better.
e.g.:
@@ -521,7 +517,7 @@ static void msdc_abort_data(struct msdc_host *host)> {
drivers/staging/mt7621-mmc/sd.c static void msdc_abort_data(struct msdc_host *host) · line 523
Quoted 5 lines
drivers/staging/mt7621-mmc/sd.c +1
-1struct mmc_command *stop = host->mrq->stop; -ERR_MSG ("Need to Abort." ); +dev_err (mmc_dev (host->mmc),"%d -> Need to Abort.\n" , host->id);msdc_reset_hw (host);msdc_clr_fifo (host);
becomes
host_err(host, "%d -> Need to Abort\n", host->id);
etc...