Re: [PATCH] serial: samsung: Neaten dbg uses

From: Greg Kroah-Hartman
Date: Wed May 28 2014 - 15:25:51 EST


On Wed, May 28, 2014 at 12:27:13PM -0700, Greg Kroah-Hartman wrote:
> On Tue, May 20, 2014 at 02:05:50PM -0700, Joe Perches wrote:
> > Add format and argument checking and fix misuses in the dbg macro.
> >
> > Add __printf
> > Use %pR for resource
> > Add #include guard to samsung.h
> > Move static functions from .h to .c
> > Use vscnprintf instead of length unguarded vsprintf
> >
> > Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
> > ---
> >
> > compiled (no warnings)/untested.
> >
> > drivers/tty/serial/samsung.c | 35 +++++++++++++++++++++++++++++------
> > drivers/tty/serial/samsung.h | 23 +++--------------------
> > 2 files changed, 32 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
> > index 1f5505e..3293377 100644
> > --- a/drivers/tty/serial/samsung.c
> > +++ b/drivers/tty/serial/samsung.c
> > @@ -53,6 +53,29 @@
> >
> > #include "samsung.h"
> >
> > +#if defined(CONFIG_SERIAL_SAMSUNG_DEBUG) && \
> > + defined(CONFIG_DEBUG_LL) && \
> > + !defined(MODULE)
> > +
> > +extern void printascii(const char *);
> > +
> > +__printf(1, 2)
> > +static void dbg(const char *fmt, ...)
> > +{
> > + va_list va;
> > + char buff[256];
> > +
> > + va_start(va, fmt);
> > + vscnprintf(buff, sizeof(buf), fmt, va);
> > + va_end(va);
> > +
> > + printascii(buff);
> > +}
> > +
> > +#else
> > +#define dbg(fmt, ...) do { if (0) no_printk(fmt, ##__VA_ARGS__); } while (0)
> > +#endif
>
> Ick, what a mess. I'll take this, but I think I'll just convert this to
> dev_dbg() instead of dealing with a config option mess...

Hm, nevermind, in looking at this further, it's hard to debug a driver
with a console command if the driver is the console itself :)

I'll just leave this as-is after applying this patch.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/