diff options
author | Joe Perches <joe@perches.com> | 2011-10-31 20:11:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-31 20:30:54 -0400 |
commit | b9075fa968a0a4347aef35e235e2995c0e57dddd (patch) | |
tree | cf9f9716784e790d8a43339653256d9cf9178ff3 /drivers | |
parent | ae29bc92da01a2e9d278a9a58c3b307d41cc0254 (diff) |
treewide: use __printf not __attribute__((format(printf,...)))
Standardize the style for compiler based printf format verification.
Standardized the location of __printf too.
Done via script and a little typing.
$ grep -rPl --include=*.[ch] -w "__attribute__" * | \
grep -vP "^(tools|scripts|include/linux/compiler-gcc.h)" | \
xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'
[akpm@linux-foundation.org: revert arch bits]
Signed-off-by: Joe Perches <joe@perches.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/isdn/hisax/callc.c | 4 | ||||
-rw-r--r-- | drivers/isdn/hisax/hisax.h | 4 | ||||
-rw-r--r-- | drivers/isdn/hisax/isdnl1.h | 2 | ||||
-rw-r--r-- | drivers/isdn/hisax/isdnl3.c | 2 | ||||
-rw-r--r-- | drivers/isdn/hisax/st5481_d.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath5k/debug.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/debug.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/b43/b43.h | 12 | ||||
-rw-r--r-- | drivers/net/wireless/b43legacy/b43legacy.h | 16 | ||||
-rw-r--r-- | drivers/staging/iio/trigger.h | 3 |
12 files changed, 29 insertions, 34 deletions
diff --git a/drivers/isdn/hisax/callc.c b/drivers/isdn/hisax/callc.c index 37e685eafd24..c4897e1075d8 100644 --- a/drivers/isdn/hisax/callc.c +++ b/drivers/isdn/hisax/callc.c | |||
@@ -65,7 +65,7 @@ hisax_findcard(int driverid) | |||
65 | return (struct IsdnCardState *) 0; | 65 | return (struct IsdnCardState *) 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | static __attribute__((format(printf, 3, 4))) void | 68 | static __printf(3, 4) void |
69 | link_debug(struct Channel *chanp, int direction, char *fmt, ...) | 69 | link_debug(struct Channel *chanp, int direction, char *fmt, ...) |
70 | { | 70 | { |
71 | va_list args; | 71 | va_list args; |
@@ -1068,7 +1068,7 @@ init_d_st(struct Channel *chanp) | |||
1068 | return 0; | 1068 | return 0; |
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | static __attribute__((format(printf, 2, 3))) void | 1071 | static __printf(2, 3) void |
1072 | callc_debug(struct FsmInst *fi, char *fmt, ...) | 1072 | callc_debug(struct FsmInst *fi, char *fmt, ...) |
1073 | { | 1073 | { |
1074 | va_list args; | 1074 | va_list args; |
diff --git a/drivers/isdn/hisax/hisax.h b/drivers/isdn/hisax/hisax.h index 0a5c42a3f125..aff45a11a92d 100644 --- a/drivers/isdn/hisax/hisax.h +++ b/drivers/isdn/hisax/hisax.h | |||
@@ -1287,9 +1287,9 @@ int jiftime(char *s, long mark); | |||
1287 | 1287 | ||
1288 | int HiSax_command(isdn_ctrl * ic); | 1288 | int HiSax_command(isdn_ctrl * ic); |
1289 | int HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb); | 1289 | int HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb); |
1290 | __attribute__((format(printf, 3, 4))) | 1290 | __printf(3, 4) |
1291 | void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...); | 1291 | void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...); |
1292 | __attribute__((format(printf, 3, 0))) | 1292 | __printf(3, 0) |
1293 | void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, va_list args); | 1293 | void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, va_list args); |
1294 | void HiSax_reportcard(int cardnr, int sel); | 1294 | void HiSax_reportcard(int cardnr, int sel); |
1295 | int QuickHex(char *txt, u_char * p, int cnt); | 1295 | int QuickHex(char *txt, u_char * p, int cnt); |
diff --git a/drivers/isdn/hisax/isdnl1.h b/drivers/isdn/hisax/isdnl1.h index 425d86116f2b..66ddcab19bba 100644 --- a/drivers/isdn/hisax/isdnl1.h +++ b/drivers/isdn/hisax/isdnl1.h | |||
@@ -21,7 +21,7 @@ | |||
21 | #define B_XMTBUFREADY 1 | 21 | #define B_XMTBUFREADY 1 |
22 | #define B_ACKPENDING 2 | 22 | #define B_ACKPENDING 2 |
23 | 23 | ||
24 | __attribute__((format(printf, 2, 3))) | 24 | __printf(2, 3) |
25 | void debugl1(struct IsdnCardState *cs, char *fmt, ...); | 25 | void debugl1(struct IsdnCardState *cs, char *fmt, ...); |
26 | void DChannel_proc_xmt(struct IsdnCardState *cs); | 26 | void DChannel_proc_xmt(struct IsdnCardState *cs); |
27 | void DChannel_proc_rcv(struct IsdnCardState *cs); | 27 | void DChannel_proc_rcv(struct IsdnCardState *cs); |
diff --git a/drivers/isdn/hisax/isdnl3.c b/drivers/isdn/hisax/isdnl3.c index ad291f21b201..1c24e4457b6f 100644 --- a/drivers/isdn/hisax/isdnl3.c +++ b/drivers/isdn/hisax/isdnl3.c | |||
@@ -66,7 +66,7 @@ static char *strL3Event[] = | |||
66 | "EV_TIMEOUT", | 66 | "EV_TIMEOUT", |
67 | }; | 67 | }; |
68 | 68 | ||
69 | static __attribute__((format(printf, 2, 3))) void | 69 | static __printf(2, 3) void |
70 | l3m_debug(struct FsmInst *fi, char *fmt, ...) | 70 | l3m_debug(struct FsmInst *fi, char *fmt, ...) |
71 | { | 71 | { |
72 | va_list args; | 72 | va_list args; |
diff --git a/drivers/isdn/hisax/st5481_d.c b/drivers/isdn/hisax/st5481_d.c index 44082637a09f..db247b79e561 100644 --- a/drivers/isdn/hisax/st5481_d.c +++ b/drivers/isdn/hisax/st5481_d.c | |||
@@ -167,7 +167,7 @@ static struct FsmNode L1FnList[] __initdata = | |||
167 | {ST_L1_F8, EV_IND_RSY, l1_ignore}, | 167 | {ST_L1_F8, EV_IND_RSY, l1_ignore}, |
168 | }; | 168 | }; |
169 | 169 | ||
170 | static __attribute__((format(printf, 2, 3))) | 170 | static __printf(2, 3) |
171 | void l1m_debug(struct FsmInst *fi, char *fmt, ...) | 171 | void l1m_debug(struct FsmInst *fi, char *fmt, ...) |
172 | { | 172 | { |
173 | va_list args; | 173 | va_list args; |
@@ -270,7 +270,7 @@ static char *strDoutEvent[] = | |||
270 | "EV_DOUT_UNDERRUN", | 270 | "EV_DOUT_UNDERRUN", |
271 | }; | 271 | }; |
272 | 272 | ||
273 | static __attribute__((format(printf, 2, 3))) | 273 | static __printf(2, 3) |
274 | void dout_debug(struct FsmInst *fi, char *fmt, ...) | 274 | void dout_debug(struct FsmInst *fi, char *fmt, ...) |
275 | { | 275 | { |
276 | va_list args; | 276 | va_list args; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index fca66165110e..8fda331c65df 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -581,8 +581,9 @@ extern const struct ethtool_ops mlx4_en_ethtool_ops; | |||
581 | * printk / logging functions | 581 | * printk / logging functions |
582 | */ | 582 | */ |
583 | 583 | ||
584 | __printf(3, 4) | ||
584 | int en_print(const char *level, const struct mlx4_en_priv *priv, | 585 | int en_print(const char *level, const struct mlx4_en_priv *priv, |
585 | const char *format, ...) __attribute__ ((format (printf, 3, 4))); | 586 | const char *format, ...); |
586 | 587 | ||
587 | #define en_dbg(mlevel, priv, format, arg...) \ | 588 | #define en_dbg(mlevel, priv, format, arg...) \ |
588 | do { \ | 589 | do { \ |
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index 908fdbc3e0ee..0f9ee46cfc97 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h | |||
@@ -173,8 +173,7 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry); | |||
173 | void ath_hw_cycle_counters_update(struct ath_common *common); | 173 | void ath_hw_cycle_counters_update(struct ath_common *common); |
174 | int32_t ath_hw_get_listen_time(struct ath_common *common); | 174 | int32_t ath_hw_get_listen_time(struct ath_common *common); |
175 | 175 | ||
176 | extern __attribute__((format (printf, 2, 3))) | 176 | extern __printf(2, 3) void ath_printk(const char *level, const char *fmt, ...); |
177 | void ath_printk(const char *level, const char *fmt, ...); | ||
178 | 177 | ||
179 | #define _ath_printk(level, common, fmt, ...) \ | 178 | #define _ath_printk(level, common, fmt, ...) \ |
180 | do { \ | 179 | do { \ |
@@ -258,7 +257,7 @@ do { \ | |||
258 | 257 | ||
259 | #else | 258 | #else |
260 | 259 | ||
261 | static inline __attribute__((format (printf, 3, 4))) | 260 | static inline __attribute__ ((format (printf, 3, 4))) |
262 | void ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask, | 261 | void ath_dbg(struct ath_common *common, enum ATH_DEBUG dbg_mask, |
263 | const char *fmt, ...) | 262 | const char *fmt, ...) |
264 | { | 263 | { |
diff --git a/drivers/net/wireless/ath/ath5k/debug.h b/drivers/net/wireless/ath/ath5k/debug.h index 7f37df3125fd..0a3f916a1ef3 100644 --- a/drivers/net/wireless/ath/ath5k/debug.h +++ b/drivers/net/wireless/ath/ath5k/debug.h | |||
@@ -141,10 +141,10 @@ ath5k_debug_printtxbuf(struct ath5k_hw *ah, struct ath5k_buf *bf); | |||
141 | 141 | ||
142 | #include <linux/compiler.h> | 142 | #include <linux/compiler.h> |
143 | 143 | ||
144 | static inline void __attribute__ ((format (printf, 3, 4))) | 144 | static inline __printf(3, 4) void |
145 | ATH5K_DBG(struct ath5k_hw *ah, unsigned int m, const char *fmt, ...) {} | 145 | ATH5K_DBG(struct ath5k_hw *ah, unsigned int m, const char *fmt, ...) {} |
146 | 146 | ||
147 | static inline void __attribute__ ((format (printf, 3, 4))) | 147 | static inline __printf(3, 4) void |
148 | ATH5K_DBG_UNLIMIT(struct ath5k_hw *ah, unsigned int m, const char *fmt, ...) | 148 | ATH5K_DBG_UNLIMIT(struct ath5k_hw *ah, unsigned int m, const char *fmt, ...) |
149 | {} | 149 | {} |
150 | 150 | ||
diff --git a/drivers/net/wireless/ath/ath6kl/debug.h b/drivers/net/wireless/ath/ath6kl/debug.h index 9288a3ce1e39..7b7675f70a10 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.h +++ b/drivers/net/wireless/ath/ath6kl/debug.h | |||
@@ -44,8 +44,8 @@ enum ATH6K_DEBUG_MASK { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | extern unsigned int debug_mask; | 46 | extern unsigned int debug_mask; |
47 | extern int ath6kl_printk(const char *level, const char *fmt, ...) | 47 | extern __printf(2, 3) |
48 | __attribute__ ((format (printf, 2, 3))); | 48 | int ath6kl_printk(const char *level, const char *fmt, ...); |
49 | 49 | ||
50 | #define ath6kl_info(fmt, ...) \ | 50 | #define ath6kl_info(fmt, ...) \ |
51 | ath6kl_printk(KERN_INFO, fmt, ##__VA_ARGS__) | 51 | ath6kl_printk(KERN_INFO, fmt, ##__VA_ARGS__) |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 447a2307c9d9..37110dfd2c96 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -1011,14 +1011,10 @@ static inline bool b43_using_pio_transfers(struct b43_wldev *dev) | |||
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | /* Message printing */ | 1013 | /* Message printing */ |
1014 | void b43info(struct b43_wl *wl, const char *fmt, ...) | 1014 | __printf(2, 3) void b43info(struct b43_wl *wl, const char *fmt, ...); |
1015 | __attribute__ ((format(printf, 2, 3))); | 1015 | __printf(2, 3) void b43err(struct b43_wl *wl, const char *fmt, ...); |
1016 | void b43err(struct b43_wl *wl, const char *fmt, ...) | 1016 | __printf(2, 3) void b43warn(struct b43_wl *wl, const char *fmt, ...); |
1017 | __attribute__ ((format(printf, 2, 3))); | 1017 | __printf(2, 3) void b43dbg(struct b43_wl *wl, const char *fmt, ...); |
1018 | void b43warn(struct b43_wl *wl, const char *fmt, ...) | ||
1019 | __attribute__ ((format(printf, 2, 3))); | ||
1020 | void b43dbg(struct b43_wl *wl, const char *fmt, ...) | ||
1021 | __attribute__ ((format(printf, 2, 3))); | ||
1022 | 1018 | ||
1023 | 1019 | ||
1024 | /* A WARN_ON variant that vanishes when b43 debugging is disabled. | 1020 | /* A WARN_ON variant that vanishes when b43 debugging is disabled. |
diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h index 12b518251581..1d4fc9db7f5e 100644 --- a/drivers/net/wireless/b43legacy/b43legacy.h +++ b/drivers/net/wireless/b43legacy/b43legacy.h | |||
@@ -810,15 +810,15 @@ struct b43legacy_lopair *b43legacy_get_lopair(struct b43legacy_phy *phy, | |||
810 | 810 | ||
811 | 811 | ||
812 | /* Message printing */ | 812 | /* Message printing */ |
813 | void b43legacyinfo(struct b43legacy_wl *wl, const char *fmt, ...) | 813 | __printf(2, 3) |
814 | __attribute__((format(printf, 2, 3))); | 814 | void b43legacyinfo(struct b43legacy_wl *wl, const char *fmt, ...); |
815 | void b43legacyerr(struct b43legacy_wl *wl, const char *fmt, ...) | 815 | __printf(2, 3) |
816 | __attribute__((format(printf, 2, 3))); | 816 | void b43legacyerr(struct b43legacy_wl *wl, const char *fmt, ...); |
817 | void b43legacywarn(struct b43legacy_wl *wl, const char *fmt, ...) | 817 | __printf(2, 3) |
818 | __attribute__((format(printf, 2, 3))); | 818 | void b43legacywarn(struct b43legacy_wl *wl, const char *fmt, ...); |
819 | #if B43legacy_DEBUG | 819 | #if B43legacy_DEBUG |
820 | void b43legacydbg(struct b43legacy_wl *wl, const char *fmt, ...) | 820 | __printf(2, 3) |
821 | __attribute__((format(printf, 2, 3))); | 821 | void b43legacydbg(struct b43legacy_wl *wl, const char *fmt, ...); |
822 | #else /* DEBUG */ | 822 | #else /* DEBUG */ |
823 | # define b43legacydbg(wl, fmt...) do { /* nothing */ } while (0) | 823 | # define b43legacydbg(wl, fmt...) do { /* nothing */ } while (0) |
824 | #endif /* DEBUG */ | 824 | #endif /* DEBUG */ |
diff --git a/drivers/staging/iio/trigger.h b/drivers/staging/iio/trigger.h index 598fcb3599f9..5cc42a655c88 100644 --- a/drivers/staging/iio/trigger.h +++ b/drivers/staging/iio/trigger.h | |||
@@ -115,8 +115,7 @@ void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time); | |||
115 | 115 | ||
116 | irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private); | 116 | irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private); |
117 | 117 | ||
118 | struct iio_trigger *iio_allocate_trigger(const char *fmt, ...) | 118 | __printf(1, 2) struct iio_trigger *iio_allocate_trigger(const char *fmt, ...); |
119 | __attribute__((format(printf, 1, 2))); | ||
120 | void iio_free_trigger(struct iio_trigger *trig); | 119 | void iio_free_trigger(struct iio_trigger *trig); |
121 | 120 | ||
122 | #endif /* _IIO_TRIGGER_H_ */ | 121 | #endif /* _IIO_TRIGGER_H_ */ |