From: Joe Perches <joe@perches.com>
To: Patrick McHardy <kaber@trash.net>
Cc: David Miller <davem@davemloft.net>,
johannes@sipsolutions.net, harvey.harrison@gmail.com,
netdev@vger.kernel.org
Subject: Re: New sparse warning in net/mac80211/debugfs_sta.c
Date: Mon, 25 Feb 2008 11:58:22 -0800 [thread overview]
Message-ID: <1203969502.19319.279.camel@localhost> (raw)
In-Reply-To: <47C2AAC8.8020202@trash.net>
On Mon, 2008-02-25 at 12:47 +0100, Patrick McHardy wrote:
> It would be good if Joe could go through the remaining print_mac users
> and convert the remaining unintended function calls in fastpaths back
> to MAC_FMT. Grepping for "start_xmit" in commit 0795af5729b shows that
> at least 10 hard_start_xmit functions are affected and I expect that
> some of the changes in the wireless code affect fastpaths as well.
I don't mind doing that, as calling print_mac in these fastpaths in
unintentional and undesirable. But wouldn't it be better to find a
solution that removes all debug printk function calls that should
be optimized away?
I have not seen any response to a suggestion to convert debug printk
macros (dprintk, pr_debug, dev_dbg, etc) to:
#define pr_debug(fmt, arg...) \
do { if (0) printk(KERN_DEBUG fmt, ##arg); } while (0)
This preserves argument verification and gives the compiler the
capability to optimize out the printk and any functions the printk
might call.
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2df44e7..cd24112 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -293,10 +293,8 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
#define pr_debug(fmt, arg...) \
printk(KERN_DEBUG fmt, ##arg)
#else
-static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char * fmt, ...)
-{
- return 0;
-}
+#define pr_debug(fmt, arg...) \
+ do { if (0) printk(KERN_DEBUG fmt, ##arg); } while (0)
#endif
/*
diff --git a/include/linux/device.h b/include/linux/device.h
index 2258d89..79601b1 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -608,21 +608,15 @@ extern const char *dev_driver_string(struct device *dev);
#define dev_dbg(dev, format, arg...) \
dev_printk(KERN_DEBUG , dev , format , ## arg)
#else
-static inline int __attribute__ ((format (printf, 2, 3)))
-dev_dbg(struct device *dev, const char *fmt, ...)
-{
- return 0;
-}
+#define dev_dbg(dev, format, arg...) \
+ do { if (0) dev_printk(KERN_DEBUG , dev , format, ## arg); } while (0)
#endif
#ifdef VERBOSE_DEBUG
#define dev_vdbg dev_dbg
#else
-static inline int __attribute__ ((format (printf, 2, 3)))
-dev_vdbg(struct device *dev, const char *fmt, ...)
-{
- return 0;
-}
+#define dev_vdbg(dev, format, arg...) \
+ do { if (0) dev_printk(KERN_DEBUG , dev , format, ## arg); } while (0)
#endif
/* Create alias, so I can be autoloaded. */
next prev parent reply other threads:[~2008-02-25 19:59 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-21 9:34 New sparse warning in net/mac80211/debugfs_sta.c Harvey Harrison
2008-02-21 9:54 ` Johannes Berg
2008-02-21 10:03 ` David Miller
2008-02-21 10:08 ` Harvey Harrison
2008-02-21 10:12 ` David Miller
2008-02-21 10:16 ` Harvey Harrison
2008-02-21 10:22 ` [PATCH] mac80211: fix debugfs_sta print_mac() warning Johannes Berg
[not found] ` <20080221.015743.222059206.davem@davemloft.net>
2008-02-21 10:01 ` New sparse warning in net/mac80211/debugfs_sta.c Harvey Harrison
2008-02-21 10:05 ` David Miller
2008-02-21 10:14 ` Harvey Harrison
2008-02-21 10:17 ` Johannes Berg
2008-02-21 17:54 ` Joe Perches
2008-02-21 18:00 ` Patrick McHardy
2008-02-21 18:15 ` Patrick McHardy
2008-02-24 4:02 ` David Miller
2008-02-25 9:53 ` Johannes Berg
2008-02-25 16:53 ` Joe Perches
2008-02-25 17:29 ` Johannes Berg
2008-02-25 17:23 ` Johannes Berg
2008-02-25 19:52 ` David Miller
2008-02-25 19:56 ` Johannes Berg
2008-02-25 20:05 ` Johannes Berg
2008-02-25 20:14 ` David Miller
2008-02-25 20:12 ` David Miller
2008-02-25 11:47 ` Patrick McHardy
2008-02-25 19:58 ` Joe Perches [this message]
2008-04-08 20:18 ` Patrick McHardy
2008-04-08 21:02 ` Joe Perches
2008-04-08 21:16 ` David Miller
2008-04-08 21:19 ` Patrick McHardy
2008-04-08 22:09 ` Joe Perches
2008-04-08 22:30 ` David Miller
2008-04-08 22:41 ` Joe Perches
2008-04-08 22:32 ` Patrick McHardy
2008-02-21 17:17 ` Joe Perches
2008-02-21 17:45 ` Patrick McHardy
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=1203969502.19319.279.camel@localhost \
--to=joe@perches.com \
--cc=davem@davemloft.net \
--cc=harvey.harrison@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=kaber@trash.net \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).