* [PATCH v2] staging: mt7621-mmc: Fix debug macros in dbg.h
@ 2018-08-18 11:43 Nishad Kamdar
2018-08-18 11:49 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Nishad Kamdar @ 2018-08-18 11:43 UTC (permalink / raw)
To: Greg Kroah-Hartman, Joe Perches
Cc: Christian Lütke-Stetzkamp, NeilBrown, John Crispin, devel,
linux-kernel
Fixed four debug macros by replacing printk with dev_<level>
without __func__ or __LINE__ or current->comm and current->pid.
Further removed the do {} while(0) loop for single statement
macro. Issues found by checkpatch.
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
---
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 | 26 +++++++-------------------
1 file changed, 7 insertions(+), 19 deletions(-)
diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h
index 2f2c56b73987..e8091db3c1d6 100644
--- a/drivers/staging/mt7621-mmc/dbg.h
+++ b/drivers/staging/mt7621-mmc/dbg.h
@@ -104,19 +104,13 @@ 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)
-*/
+ *if ((DBG_EVT_##evt) & sd_debug_zone[host->id]) { \
+ * dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args) \
+ *}
+ */
#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);
+dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args)
#if 1
//defined CONFIG_MTK_MMC_CD_POLL
@@ -124,17 +118,11 @@ do { \
#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);
+dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args)
/* 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);
+dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args)
#endif
void msdc_debug_proc_init(void);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] staging: mt7621-mmc: Fix debug macros in dbg.h
2018-08-18 11:43 [PATCH v2] staging: mt7621-mmc: Fix debug macros in dbg.h Nishad Kamdar
@ 2018-08-18 11:49 ` Greg Kroah-Hartman
2018-08-19 9:59 ` Nishad Kamdar
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2018-08-18 11:49 UTC (permalink / raw)
To: Nishad Kamdar
Cc: Joe Perches, NeilBrown, devel, Christian Lütke-Stetzkamp,
linux-kernel, John Crispin
On Sat, Aug 18, 2018 at 05:13:17PM +0530, Nishad Kamdar wrote:
> Fixed four debug macros by replacing printk with dev_<level>
> without __func__ or __LINE__ or current->comm and current->pid.
> Further removed the do {} while(0) loop for single statement
> macro. Issues found by checkpatch.
>
> Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
> ---
> 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 | 26 +++++++-------------------
> 1 file changed, 7 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h
> index 2f2c56b73987..e8091db3c1d6 100644
> --- a/drivers/staging/mt7621-mmc/dbg.h
> +++ b/drivers/staging/mt7621-mmc/dbg.h
> @@ -104,19 +104,13 @@ 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)
> -*/
> + *if ((DBG_EVT_##evt) & sd_debug_zone[host->id]) { \
> + * dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args) \
> + *}
> + */
This can just be deleted, just drop it.
>
> #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);
> +dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args)
No, please just replace all usages of ERR_MSG with dev_err() in the code
itself, and then drop ERR_MSG. No driver/subsystem should have special
macros just for it.
> #if 1
> //defined CONFIG_MTK_MMC_CD_POLL
> @@ -124,17 +118,11 @@ do { \
> #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);
> +dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args)
Same here. Actually I bet all INIT_MSG can just be removed :)
>
> /* 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);
> +dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args)
Same here, just replace the usage of these macros with the real thing.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] staging: mt7621-mmc: Fix debug macros in dbg.h
2018-08-18 11:49 ` Greg Kroah-Hartman
@ 2018-08-19 9:59 ` Nishad Kamdar
0 siblings, 0 replies; 3+ messages in thread
From: Nishad Kamdar @ 2018-08-19 9:59 UTC (permalink / raw)
To: Greg Kroah-Hartman, Joe Perches
Cc: Christian Lütke-Stetzkamp, NeilBrown, John Crispin, devel,
linux-kernel
On Sat, Aug 18, 2018 at 01:49:23PM +0200, Greg Kroah-Hartman wrote:
> On Sat, Aug 18, 2018 at 05:13:17PM +0530, Nishad Kamdar wrote:
> > Fixed four debug macros by replacing printk with dev_<level>
> > without __func__ or __LINE__ or current->comm and current->pid.
> > Further removed the do {} while(0) loop for single statement
> > macro. Issues found by checkpatch.
> >
> > Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
> > ---
> > 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 | 26 +++++++-------------------
> > 1 file changed, 7 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h
> > index 2f2c56b73987..e8091db3c1d6 100644
> > --- a/drivers/staging/mt7621-mmc/dbg.h
> > +++ b/drivers/staging/mt7621-mmc/dbg.h
> > @@ -104,19 +104,13 @@ 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)
> > -*/
> > + *if ((DBG_EVT_##evt) & sd_debug_zone[host->id]) { \
> > + * dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args) \
> > + *}
> > + */
>
> This can just be deleted, just drop it.
>
> >
> > #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);
> > +dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args)
>
> No, please just replace all usages of ERR_MSG with dev_err() in the code
> itself, and then drop ERR_MSG. No driver/subsystem should have special
> macros just for it.
>
> > #if 1
> > //defined CONFIG_MTK_MMC_CD_POLL
> > @@ -124,17 +118,11 @@ do { \
> > #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);
> > +dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args)
>
> Same here. Actually I bet all INIT_MSG can just be removed :)
>
> >
> > /* 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);
> > +dev_err(mmc_dev(host->mmc), "%d -> " fmt "\n", host->id, ##args)
>
> Same here, just replace the usage of these macros with the real thing.
>
> thanks,
>
> greg k-h
Ok, I will make the changes in the next version.
thanks for the review.
regards,
nishad
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-08-19 9:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-18 11:43 [PATCH v2] staging: mt7621-mmc: Fix debug macros in dbg.h Nishad Kamdar
2018-08-18 11:49 ` Greg Kroah-Hartman
2018-08-19 9:59 ` Nishad Kamdar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).