LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] tmio_mmc: Improve readability of the output of pr_debug_status()
@ 2011-02-04 8:33 Simon Horman
2011-02-04 19:34 ` Guennadi Liakhovetski
0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2011-02-04 8:33 UTC (permalink / raw)
To: linux-mmc, linux-kernel; +Cc: Ian Molton, Chris Ball, Simon Horman
Signed-off-by: Simon Horman <horms@verge.net.au>
---
drivers/mmc/host/tmio_mmc.h | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 6f724de..811427d 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -237,12 +237,16 @@ static inline void tmio_mmc_kunmap_atomic(void *virt,
#define STATUS_TO_TEXT(a) \
do { \
- if (status & TMIO_STAT_##a) \
+ if (status & TMIO_STAT_##a) { \
+ if (i++) \
+ printk("|"); \
printk(#a); \
+ } \
} while (0)
void pr_debug_status(u32 status)
{
+ int i = 0;
printk(KERN_DEBUG "status: %08x = ", status);
STATUS_TO_TEXT(CARD_REMOVE);
STATUS_TO_TEXT(CARD_INSERT);
--
1.7.2.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tmio_mmc: Improve readability of the output of pr_debug_status()
2011-02-04 8:33 [PATCH] tmio_mmc: Improve readability of the output of pr_debug_status() Simon Horman
@ 2011-02-04 19:34 ` Guennadi Liakhovetski
2011-02-04 21:41 ` Simon Horman
0 siblings, 1 reply; 3+ messages in thread
From: Guennadi Liakhovetski @ 2011-02-04 19:34 UTC (permalink / raw)
To: Simon Horman; +Cc: linux-mmc, linux-kernel, Ian Molton, Chris Ball
On Fri, 4 Feb 2011, Simon Horman wrote:
> Signed-off-by: Simon Horman <horms@verge.net.au>
> ---
> drivers/mmc/host/tmio_mmc.h | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 6f724de..811427d 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -237,12 +237,16 @@ static inline void tmio_mmc_kunmap_atomic(void *virt,
>
> #define STATUS_TO_TEXT(a) \
> do { \
> - if (status & TMIO_STAT_##a) \
> + if (status & TMIO_STAT_##a) { \
> + if (i++) \
> + printk("|"); \
> printk(#a); \
> + } \
Personally, I find it a bad idea to use variables in macros without
explicitly passing them in the parameter list. Yes, this macro is already
using "status" in that way, still, I don't think, that adding more such
variables is good. Why not make it STATUS_TO_TEXT(a, status, i) and also
add spaces for better yet readability like printk(" | ")?
Thanks
Guennadi
> } while (0)
>
> void pr_debug_status(u32 status)
> {
> + int i = 0;
> printk(KERN_DEBUG "status: %08x = ", status);
> STATUS_TO_TEXT(CARD_REMOVE);
> STATUS_TO_TEXT(CARD_INSERT);
> --
> 1.7.2.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tmio_mmc: Improve readability of the output of pr_debug_status()
2011-02-04 19:34 ` Guennadi Liakhovetski
@ 2011-02-04 21:41 ` Simon Horman
0 siblings, 0 replies; 3+ messages in thread
From: Simon Horman @ 2011-02-04 21:41 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: linux-mmc, linux-kernel, Ian Molton, Chris Ball
On Fri, Feb 04, 2011 at 08:34:54PM +0100, Guennadi Liakhovetski wrote:
> On Fri, 4 Feb 2011, Simon Horman wrote:
>
> > Signed-off-by: Simon Horman <horms@verge.net.au>
> > ---
> > drivers/mmc/host/tmio_mmc.h | 6 +++++-
> > 1 files changed, 5 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> > index 6f724de..811427d 100644
> > --- a/drivers/mmc/host/tmio_mmc.h
> > +++ b/drivers/mmc/host/tmio_mmc.h
> > @@ -237,12 +237,16 @@ static inline void tmio_mmc_kunmap_atomic(void *virt,
> >
> > #define STATUS_TO_TEXT(a) \
> > do { \
> > - if (status & TMIO_STAT_##a) \
> > + if (status & TMIO_STAT_##a) { \
> > + if (i++) \
> > + printk("|"); \
> > printk(#a); \
> > + } \
>
> Personally, I find it a bad idea to use variables in macros without
> explicitly passing them in the parameter list. Yes, this macro is already
> using "status" in that way, still, I don't think, that adding more such
> variables is good. Why not make it STATUS_TO_TEXT(a, status, i) and also
> add spaces for better yet readability like printk(" | ")?
Point taken, I will send v2 shortly.
Though the STATUS_TO_TEXT(a, status, i) change
does seem to make pr_debug_status() rather a lot noisier.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-02-04 21:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-04 8:33 [PATCH] tmio_mmc: Improve readability of the output of pr_debug_status() Simon Horman
2011-02-04 19:34 ` Guennadi Liakhovetski
2011-02-04 21:41 ` Simon Horman
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).