public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Joe Perches <joe@perches.com>
Cc: Kukjin Kim <kgene.kim@samsung.com>,
	Jingoo Han <jg1.han@samsung.com>,
	Doug Anderson <dianders@chromium.org>,
	Jiri Slaby <jslaby@suse.cz>,
	linux-serial@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] serial: samsung: Neaten dbg uses
Date: Wed, 28 May 2014 12:27:13 -0700	[thread overview]
Message-ID: <20140528192713.GA24902@kroah.com> (raw)
In-Reply-To: <1400619950.26709.39.camel@joe-AO725>

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@perches.com>
> ---
> 
> 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...

thanks,

greg k-h

  reply	other threads:[~2014-05-28 19:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 21:05 [PATCH] serial: samsung: Neaten dbg uses Joe Perches
2014-05-28 19:27 ` Greg Kroah-Hartman [this message]
2014-05-28 19:29   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140528192713.GA24902@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=dianders@chromium.org \
    --cc=jg1.han@samsung.com \
    --cc=joe@perches.com \
    --cc=jslaby@suse.cz \
    --cc=kgene.kim@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox