Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ath: Make ath_printk void not int and remove unused struct ath_common *

Changing the return type and removing the unused argument from
ath_printk reduces code size.

Add an __always_unused struct ath_common * to the macros
that call ath_printk to avoid unused variable warnings.

$ size drivers/net/wireless/ath/built-in.o*
text data bss dec hex filename
1159859 16235 212000 1388094 152e3e drivers/net/wireless/ath/built-in.o.new
1164175 16235 212032 1392442 153f3a drivers/net/wireless/ath/built-in.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Joe Perches and committed by
John W. Linville
29e76245 7b8112d6

+18 -17
+16 -11
drivers/net/wireless/ath/ath.h
··· 178 178 void ath_hw_cycle_counters_update(struct ath_common *common); 179 179 int32_t ath_hw_get_listen_time(struct ath_common *common); 180 180 181 - extern __attribute__((format (printf, 3, 4))) 182 - int ath_printk(const char *level, struct ath_common *common, 183 - const char *fmt, ...); 181 + extern __attribute__((format (printf, 2, 3))) 182 + void ath_printk(const char *level, const char *fmt, ...); 183 + 184 + #define _ath_printk(level, common, fmt, ...) \ 185 + do { \ 186 + __always_unused struct ath_common *unused = common; \ 187 + ath_printk(level, fmt, ##__VA_ARGS__); \ 188 + } while (0) 184 189 185 190 #define ath_emerg(common, fmt, ...) \ 186 - ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__) 191 + _ath_printk(KERN_EMERG, common, fmt, ##__VA_ARGS__) 187 192 #define ath_alert(common, fmt, ...) \ 188 - ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__) 193 + _ath_printk(KERN_ALERT, common, fmt, ##__VA_ARGS__) 189 194 #define ath_crit(common, fmt, ...) \ 190 - ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__) 195 + _ath_printk(KERN_CRIT, common, fmt, ##__VA_ARGS__) 191 196 #define ath_err(common, fmt, ...) \ 192 - ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__) 197 + _ath_printk(KERN_ERR, common, fmt, ##__VA_ARGS__) 193 198 #define ath_warn(common, fmt, ...) \ 194 - ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__) 199 + _ath_printk(KERN_WARNING, common, fmt, ##__VA_ARGS__) 195 200 #define ath_notice(common, fmt, ...) \ 196 - ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__) 201 + _ath_printk(KERN_NOTICE, common, fmt, ##__VA_ARGS__) 197 202 #define ath_info(common, fmt, ...) \ 198 - ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__) 203 + _ath_printk(KERN_INFO, common, fmt, ##__VA_ARGS__) 199 204 200 205 /** 201 206 * enum ath_debug_level - atheros wireless debug level ··· 255 250 #define ath_dbg(common, dbg_mask, fmt, ...) \ 256 251 do { \ 257 252 if ((common)->debug_mask & dbg_mask) \ 258 - ath_printk(KERN_DEBUG, common, fmt, ##__VA_ARGS__); \ 253 + _ath_printk(KERN_DEBUG, common, fmt, ##__VA_ARGS__); \ 259 254 } while (0) 260 255 261 256 #define ATH_DBG_WARN(foo, arg...) WARN(foo, arg)
+2 -6
drivers/net/wireless/ath/main.c
··· 57 57 } 58 58 EXPORT_SYMBOL(ath_rxbuf_alloc); 59 59 60 - int ath_printk(const char *level, struct ath_common *common, 61 - const char *fmt, ...) 60 + void ath_printk(const char *level, const char *fmt, ...) 62 61 { 63 62 struct va_format vaf; 64 63 va_list args; 65 - int rtn; 66 64 67 65 va_start(args, fmt); 68 66 69 67 vaf.fmt = fmt; 70 68 vaf.va = &args; 71 69 72 - rtn = printk("%sath: %pV", level, &vaf); 70 + printk("%sath: %pV", level, &vaf); 73 71 74 72 va_end(args); 75 - 76 - return rtn; 77 73 } 78 74 EXPORT_SYMBOL(ath_printk);