diff options
author | Joe Perches <joe@perches.com> | 2012-03-18 20:30:53 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-04-10 14:52:14 -0400 |
commit | 227842d1176019512d24236f7fb894f0fadd30d1 (patch) | |
tree | 431ec48aaacfbfbe33083cde0d038ec21284bfba | |
parent | 516304b0f45614fb8967dc86ff681499204cdbb1 (diff) |
ath5k: Introduce _ath5k_printk to reduce code/text
Macros can be converted to functions to reduce overall object size.
Convert the ATH5K_PRINTK macro to use _ath5k_printk.
Allyesconfig size is reduced ~10%
$ size drivers/net/wireless/ath/ath5k/built-in.o*
text data bss dec hex filename
211557 2032 40672 254261 3e135 drivers/net/wireless/ath/ath5k/built-in.o.new
235412 2032 47296 284740 45844 drivers/net/wireless/ath/ath5k/built-in.o.old
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath5k/ath5k.h | 9 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.c | 20 |
2 files changed, 25 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h index 954c3734da98..55ef93dd7438 100644 --- a/drivers/net/wireless/ath/ath5k/ath5k.h +++ b/drivers/net/wireless/ath/ath5k/ath5k.h | |||
@@ -79,11 +79,12 @@ | |||
79 | #define ATH5K_PRINTF(fmt, ...) \ | 79 | #define ATH5K_PRINTF(fmt, ...) \ |
80 | pr_warn("%s: " fmt, __func__, ##__VA_ARGS__) | 80 | pr_warn("%s: " fmt, __func__, ##__VA_ARGS__) |
81 | 81 | ||
82 | void __printf(3, 4) | ||
83 | _ath5k_printk(const struct ath5k_hw *ah, const char *level, | ||
84 | const char *fmt, ...); | ||
85 | |||
82 | #define ATH5K_PRINTK(_sc, _level, _fmt, ...) \ | 86 | #define ATH5K_PRINTK(_sc, _level, _fmt, ...) \ |
83 | printk(_level pr_fmt("%s%s" _fmt), \ | 87 | _ath5k_printk(_sc, _level, _fmt, ##__VA_ARGS__) |
84 | ((_sc) && (_sc)->hw) ? wiphy_name((_sc)->hw->wiphy) : "", \ | ||
85 | ((_sc) && (_sc)->hw) ? ": " : "", \ | ||
86 | ##__VA_ARGS__) | ||
87 | 88 | ||
88 | #define ATH5K_PRINTK_LIMIT(_sc, _level, _fmt, ...) \ | 89 | #define ATH5K_PRINTK_LIMIT(_sc, _level, _fmt, ...) \ |
89 | do { \ | 90 | do { \ |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index a9c0503237e9..3007bba12d94 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -3040,3 +3040,23 @@ ath5k_set_beacon_filter(struct ieee80211_hw *hw, bool enable) | |||
3040 | ath5k_hw_set_rx_filter(ah, rfilt); | 3040 | ath5k_hw_set_rx_filter(ah, rfilt); |
3041 | ah->filter_flags = rfilt; | 3041 | ah->filter_flags = rfilt; |
3042 | } | 3042 | } |
3043 | |||
3044 | void _ath5k_printk(const struct ath5k_hw *ah, const char *level, | ||
3045 | const char *fmt, ...) | ||
3046 | { | ||
3047 | struct va_format vaf; | ||
3048 | va_list args; | ||
3049 | |||
3050 | va_start(args, fmt); | ||
3051 | |||
3052 | vaf.fmt = fmt; | ||
3053 | vaf.va = &args; | ||
3054 | |||
3055 | if (ah && ah->hw) | ||
3056 | printk("%s" pr_fmt("%s: %pV"), | ||
3057 | level, wiphy_name(ah->hw->wiphy), &vaf); | ||
3058 | else | ||
3059 | printk("%s" pr_fmt("%pV"), level, &vaf); | ||
3060 | |||
3061 | va_end(args); | ||
3062 | } | ||