All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@redhat.com>
To: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>, Greg KH <greg@kroah.com>,
	linux-next@vger.kernel.org, Greg Banks <gnb@sgi.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Linux Kernel Development <linux-kernel@vger.kernel.org>
Subject: Re: linux-next: driver-core tree build failure
Date: Tue, 10 Mar 2009 16:02:00 -0400	[thread overview]
Message-ID: <20090310200200.GB3091@redhat.com> (raw)
In-Reply-To: <20090310170841.2257de86@skybase>

On Tue, Mar 10, 2009 at 05:08:41PM +0100, Martin Schwidefsky wrote:
> On Tue, 10 Mar 2009 16:29:50 +0100 (CET)
> Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> wrote:
> 
> > > The same could be done with the problematic pr_fmt definition:
> > > 
> > > #define pr_fmt(fmt)     __func__ ": " fmt
> > 
> > No, that also doesn't work:
> > 
> > | crypto/zlib.c:150: error: expected '}' before string constant
> > | crypto/zlib.c:150: error: expected ')' before '__func__'
> > | crypto/zlib.c:162: error: expected '}' before string constant
> > | crypto/zlib.c:162: error: expected ')' before '__func__'
> > | crypto/zlib.c:166: error: expected '}' before string constant
> > | crypto/zlib.c:166: error: expected ')' before '__func__'
> > | crypto/zlib.c:170: error: expected '}' before string constant
> > | crypto/zlib.c:170: error: expected ')' before '__func__'
> > 
> > > > BTW, Martin: Is `#define pr_fmt(fmt)     "%s: " fmt, __func__' a valid and
> > > > intended usage of your pr_fmt() infrastructure?
> > > 
> > > The indended use is a simple prefix to the format string. To paste an
> > > additional parameter is an interesting use of the pr_fmt macro ..
> > 
> > Bummer, I was so happy I could do things like
> > 
> > | #define pr_fmt(fmt)	"%s:%u: " fmt, __func__, __LINE__
> 
> Actually that seem like a nice thing to have. With the upstream version of
> dynamic_pr_debug this works, there the format string is used only on a printk.
> git commit 25b67b75587d43ff3f09ad88c03c70a38372d95d introduces the code
> that pastes the format string to the _ddebug structure.
> 

hmmm...yeah, some macro magic in include/linux/dynamic_debug.h converts
the 'fmt' arg into a series of strings. It doesn't look as pretty in the
dynamic debug control file:

crypto/zlib.c:333 [zlib]zlib_decompress_final - "\042%s: \042
\042avail_in %u, avail_out %u (consumed %u, produced %u)\n\042,
__func__"

with all those '\042' there, which are the '"' characters, but we
probably could live with it.

patch below.

thanks,

-Jason



Signed-off-by: Jason Baron <jbaron@redhat.com>


diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 07781aa..16cf212 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -50,28 +50,30 @@ extern int ddebug_remove_module(char *mod_name);
 					__ret = 1;			     \
 	__ret; })
 
-#define dynamic_pr_debug(fmt, ...) do {					\
-	static struct _ddebug descriptor				\
-	__used								\
-	__attribute__((section("__verbose"), aligned(8))) =		\
-	{ KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH,	\
-		DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT };	\
-	if (__dynamic_dbg_enabled(descriptor))				\
-		printk(KERN_DEBUG KBUILD_MODNAME ":" fmt,		\
-				##__VA_ARGS__);				\
+#define STRINGIFY(args...) #args
+
+#define dynamic_pr_debug(fmt, ...) do {					  \
+	static struct _ddebug descriptor				  \
+	__used								  \
+	__attribute__((section("__verbose"), aligned(8))) =		  \
+	{ KBUILD_MODNAME, __func__, __FILE__, STRINGIFY(fmt), DEBUG_HASH, \
+		DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT };	  \
+	if (__dynamic_dbg_enabled(descriptor))				  \
+		printk(KERN_DEBUG KBUILD_MODNAME ":" fmt,		  \
+				##__VA_ARGS__);				  \
 	} while (0)
 
 
-#define dynamic_dev_dbg(dev, fmt, ...) do {				\
-	static struct _ddebug descriptor				\
-	__used								\
-	__attribute__((section("__verbose"), aligned(8))) =		\
-	{ KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH,	\
-		DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT };	\
-	if (__dynamic_dbg_enabled(descriptor))				\
-			dev_printk(KERN_DEBUG, dev,			\
-					KBUILD_MODNAME ": " fmt,	\
-					##__VA_ARGS__);			\
+#define dynamic_dev_dbg(dev, fmt, ...) do {				  \
+	static struct _ddebug descriptor				  \
+	__used								  \
+	__attribute__((section("__verbose"), aligned(8))) =		  \
+	{ KBUILD_MODNAME, __func__, __FILE__, STRINGIFY(fmt), DEBUG_HASH, \
+		DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT };	  \
+	if (__dynamic_dbg_enabled(descriptor))				  \
+			dev_printk(KERN_DEBUG, dev,			  \
+					KBUILD_MODNAME ": " fmt,	  \
+					##__VA_ARGS__);			  \
 	} while (0)
 
 #else

  reply	other threads:[~2009-03-10 20:02 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-10  8:24 linux-next: driver-core tree build failure Stephen Rothwell
2009-03-10 13:31 ` Geert Uytterhoeven
2009-03-10 13:38   ` Herbert Xu
2009-03-10 13:53   ` Martin Schwidefsky
2009-03-10 15:29     ` Geert Uytterhoeven
2009-03-10 16:08       ` Martin Schwidefsky
2009-03-10 20:02         ` Jason Baron [this message]
2009-03-11  3:30           ` Greg KH
2009-03-11  8:33           ` Geert Uytterhoeven
2009-03-11 10:07           ` Greg Banks
2009-03-11 10:50             ` Geert Uytterhoeven
2009-03-11 15:12             ` Jason Baron
  -- strict thread matches above, loose matches on Subject: below --
2009-07-14  6:33 Stephen Rothwell
2009-07-14  7:31 ` David Brownell
2009-07-16 22:50   ` Greg KH
2009-06-23  6:01 Stephen Rothwell
2009-06-23 15:29 ` Greg KH
2009-06-23 16:28   ` Greg KH
2009-05-12  3:44 Stephen Rothwell
2009-05-12  4:05 ` Greg KH
2009-05-13  0:13   ` Greg KH
2009-05-13  1:39     ` Stephen Rothwell
2009-05-04  6:25 Stephen Rothwell
2009-05-04 13:00 ` Kay Sievers
2009-05-05  4:18   ` Stephen Rothwell
2009-05-05  4:29     ` Greg KH
2009-05-09 11:16 ` Stephen Rothwell
2009-05-09 13:51   ` Greg KH
2009-03-26  7:34 Stephen Rothwell
2009-03-26 23:00 ` Jesse Barnes
2009-03-16  9:47 Stephen Rothwell
2009-03-22 12:22 ` Stephen Rothwell
2009-03-23  4:23   ` David Miller
2009-01-26  0:50 Stephen Rothwell
2009-01-26  1:10 ` Greg KH
2009-01-26 12:19   ` Kay Sievers
2009-01-26 17:40     ` Greg KH
2008-12-22 12:59 Stephen Rothwell
2008-12-22 14:50 ` Mark McLoughlin
2008-12-23  4:29   ` Greg KH
2008-12-29  6:34     ` Stephen Rothwell
2008-12-30 15:28       ` Stephen Rothwell
2009-01-02  7:26         ` Greg KH
2009-01-03  4:32           ` Stephen Rothwell
2008-12-11  0:21 Stephen Rothwell
2008-12-11  4:55 ` Greg KH
2008-11-19  0:30 Stephen Rothwell
2008-11-19  0:40 ` Kay Sievers
2008-11-19  2:22   ` Stephen Rothwell
2008-11-19  2:24     ` Stephen Rothwell
2008-11-19  6:36     ` Greg KH
2008-11-19  5:43 ` Stephen Rothwell
2008-11-19  6:26   ` Greg KH
2008-11-19  6:51     ` Stephen Rothwell
2008-11-19  6:55       ` Greg KH
2008-09-12  3:53 Stephen Rothwell
2008-09-15 18:58 ` Greg KH
2008-08-15  8:25 Stephen Rothwell
2008-08-16  5:31 ` Greg KH

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=20090310200200.GB3091@redhat.com \
    --to=jbaron@redhat.com \
    --cc=Geert.Uytterhoeven@sonycom.com \
    --cc=gnb@sgi.com \
    --cc=greg@kroah.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=sfr@canb.auug.org.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.