* [PATCH] iwl-debug: Shrink object by using dev_err and deduplicating formats
@ 2011-11-18 1:46 Joe Perches
2011-11-18 3:14 ` Guy, Wey-Yi
0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2011-11-18 1:46 UTC (permalink / raw)
To: Wey-Yi Guy, Intel Linux Wireless
Cc: John W. Linville, linux-wireless, netdev, linux-kernel
Using dev_err instead of dev_printk(KERN_ERR uses fewer
arguments and is a bit smaller.
Deduplicating formats used by IWL_DEBUG_QUIET_RFKILL also
makes the object a bit smaller.
Neatened the macros, used ##__VA_ARGS__.
$ size drivers/net/wireless/iwlwifi/built-in.o*
text data bss dec hex filename
462652 8646 92576 563874 89aa2 drivers/net/wireless/iwlwifi/built-in.o.new
467557 8646 92592 568795 8addb drivers/net/wireless/iwlwifi/built-in.o.old
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/wireless/iwlwifi/iwl-debug.h | 37 +++++++++++++++++-------------
1 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index 40ef97b..44a7bdd 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -47,20 +47,21 @@ do { \
} while (0)
#ifdef CONFIG_IWLWIFI_DEBUG
-#define IWL_DEBUG(m, level, fmt, args...) \
+#define IWL_DEBUG(m, level, fmt, ...) \
do { \
if (iwl_get_debug_level((m)->shrd) & (level)) \
- dev_printk(KERN_ERR, bus(m)->dev, \
- "%c %s " fmt, in_interrupt() ? 'I' : 'U', \
- __func__ , ## args); \
+ dev_err(bus(m)->dev, "%c %s " fmt, \
+ in_interrupt() ? 'I' : 'U', __func__, \
+ ##__VA_ARGS__); \
} while (0)
-#define IWL_DEBUG_LIMIT(m, level, fmt, args...) \
+#define IWL_DEBUG_LIMIT(m, level, fmt, ...) \
do { \
- if (iwl_get_debug_level((m)->shrd) & (level) && net_ratelimit())\
- dev_printk(KERN_ERR, bus(m)->dev, \
- "%c %s " fmt, in_interrupt() ? 'I' : 'U', \
- __func__ , ## args); \
+ if (iwl_get_debug_level((m)->shrd) & (level) && \
+ net_ratelimit()) \
+ dev_err(bus(m)->dev, "%c %s " fmt, \
+ in_interrupt() ? 'I' : 'U', __func__, \
+ ##__VA_ARGS__); \
} while (0)
#define iwl_print_hex_dump(m, level, p, len) \
@@ -70,14 +71,18 @@ do { \
DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
} while (0)
-#define IWL_DEBUG_QUIET_RFKILL(p, fmt, args...) \
+#define IWL_DEBUG_QUIET_RFKILL(p, fmt, ...) \
do { \
- if (!iwl_is_rfkill(p->shrd)) \
- dev_printk(KERN_ERR, bus(p)->dev, "%c %s " fmt, \
- (in_interrupt() ? 'I' : 'U'), __func__ , ##args); \
- else if (iwl_get_debug_level(p->shrd) & IWL_DL_RADIO) \
- dev_printk(KERN_ERR, bus(p)->dev, "(RFKILL) %c %s " fmt, \
- (in_interrupt() ? 'I' : 'U'), __func__ , ##args); \
+ if (!iwl_is_rfkill(p->shrd)) \
+ dev_err(bus(p)->dev, "%s%c %s " fmt, \
+ "", \
+ in_interrupt() ? 'I' : 'U', __func__, \
+ ##__VA_ARGS__); \
+ else if (iwl_get_debug_level(p->shrd) & IWL_DL_RADIO) \
+ dev_err(bus(p)->dev, "%s%c %s " fmt, \
+ "(RFKILL) ", \
+ in_interrupt() ? 'I' : 'U', __func__, \
+ ##__VA_ARGS__); \
} while (0)
#else
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iwl-debug: Shrink object by using dev_err and deduplicating formats
2011-11-18 1:46 [PATCH] iwl-debug: Shrink object by using dev_err and deduplicating formats Joe Perches
@ 2011-11-18 3:14 ` Guy, Wey-Yi
0 siblings, 0 replies; 2+ messages in thread
From: Guy, Wey-Yi @ 2011-11-18 3:14 UTC (permalink / raw)
To: Joe Perches
Cc: Intel Linux Wireless, John W. Linville,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
On Thu, 2011-11-17 at 17:46 -0800, Joe Perches wrote:
> Using dev_err instead of dev_printk(KERN_ERR uses fewer
> arguments and is a bit smaller.
>
> Deduplicating formats used by IWL_DEBUG_QUIET_RFKILL also
> makes the object a bit smaller.
>
> Neatened the macros, used ##__VA_ARGS__.
>
> $ size drivers/net/wireless/iwlwifi/built-in.o*
> text data bss dec hex filename
> 462652 8646 92576 563874 89aa2 drivers/net/wireless/iwlwifi/built-in.o.new
> 467557 8646 92592 568795 8addb drivers/net/wireless/iwlwifi/built-in.o.old
>
> Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
> ---
> \
very interesting. Thanks
Wey
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-18 4:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-18 1:46 [PATCH] iwl-debug: Shrink object by using dev_err and deduplicating formats Joe Perches
2011-11-18 3:14 ` Guy, Wey-Yi
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).