public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org,
	autofs@linux.kernel.org, Ian Kent <raven@themaw.net>
Subject: Re: [PATCH] autofs4: Use no_printk() for no-op DPRINTK() and use __VA_ARGS__ too
Date: Mon, 08 Aug 2011 09:11:52 -0700	[thread overview]
Message-ID: <1312819912.1643.9.camel@Joe-Laptop> (raw)
In-Reply-To: <20110808151038.17366.38130.stgit@warthog.procyon.org.uk>

On Mon, 2011-08-08 at 16:10 +0100, David Howells wrote:
> Use no_printk() for autofs's no-op DPRINTK() to prevent unused statements from
> becoming accidentally obsolete, and use __VA_ARGS__ too as that's the standard
> way.
[]
> diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
> index 475f9c5..c3a419f 100644
> --- a/fs/autofs4/autofs_i.h
> +++ b/fs/autofs4/autofs_i.h
> @@ -40,13 +40,17 @@
>  /* #define DEBUG */
>  
>  #ifdef DEBUG
> -#define DPRINTK(fmt, args...)				\
> +#define DPRINTK(fmt, ...)				\
>  do {							\
>  	printk(KERN_DEBUG "pid %d: %s: " fmt "\n",	\
> -		current->pid, __func__, ##args);	\
> +		current->pid, __func__, ##__VA_ARGS__);	\
>  } while (0)
>  #else
> -#define DPRINTK(fmt, args...) do {} while (0)
> +#define DPRINTK(fmt, ...)					\
> +do {								\
> +	no_printk(KERN_DEBUG "pid %d: %s: " fmt "\n",		\
> +		  current->pid, __func__, ##__VA_ARGS__);	\
> +} while (0)

single statement macros don't need do {} while (0),
and this could be

#define DPRINTK(fmt, args...)					\
	pr_debug("pid %d: %s: " fmt "\n",			\
		 current->pid, __func__, ##__VA_ARGS__)

When using dynamic debug __func__ and pid are unnecessary as
these can be added to any pr_debug output with '+f' and '+t'
so I think those should not be added either.

I think the DPRINTK macro should be removed altogether and
pr_debug should be used instead.



      parent reply	other threads:[~2011-08-08 16:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-08 15:10 [PATCH] autofs4: Use no_printk() for no-op DPRINTK() and use __VA_ARGS__ too David Howells
2011-08-08 16:09 ` Linus Torvalds
2011-08-09  0:56   ` [PATCH] autofs4: Use pr_fmt and pr_<level> Joe Perches
2011-08-08 16:11 ` Joe Perches [this message]

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=1312819912.1643.9.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=autofs@linux.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raven@themaw.net \
    --cc=torvalds@osdl.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