diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-08-02 12:44:00 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-09-17 13:31:20 -0400 |
commit | 611aa19fd60fe57059d9972fa6ae29f7472a13cf (patch) | |
tree | a87f71ef393eec3e904291d1d5da1f2fdc5bb11b /drivers | |
parent | 4b60912e52bc6ccdf587f2b92f3435ee2678d730 (diff) |
ieee1394: safer definition of empty macros
A deactivated macro, defined as "#define foo(bar)", will result in
silent corruption if somebody forgets a semicolon after a call to foo.
Replace it by "#define foo(bar) do {} while (0)" which will reveal any
respective syntax errors.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ieee1394/dv1394.c | 4 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394_core.c | 2 | ||||
-rw-r--r-- | drivers/ieee1394/ieee1394_types.h | 2 | ||||
-rw-r--r-- | drivers/ieee1394/ohci1394.c | 8 | ||||
-rw-r--r-- | drivers/ieee1394/raw1394.c | 2 | ||||
-rw-r--r-- | drivers/ieee1394/sbp2.c | 18 | ||||
-rw-r--r-- | drivers/ieee1394/video1394.c | 2 |
7 files changed, 19 insertions, 19 deletions
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index 6e71d68b1099..6c72f04b2b5d 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
@@ -137,13 +137,13 @@ | |||
137 | #if DV1394_DEBUG_LEVEL >= 2 | 137 | #if DV1394_DEBUG_LEVEL >= 2 |
138 | #define irq_printk( args... ) printk( args ) | 138 | #define irq_printk( args... ) printk( args ) |
139 | #else | 139 | #else |
140 | #define irq_printk( args... ) | 140 | #define irq_printk( args... ) do {} while (0) |
141 | #endif | 141 | #endif |
142 | 142 | ||
143 | #if DV1394_DEBUG_LEVEL >= 1 | 143 | #if DV1394_DEBUG_LEVEL >= 1 |
144 | #define debug_printk( args... ) printk( args) | 144 | #define debug_printk( args... ) printk( args) |
145 | #else | 145 | #else |
146 | #define debug_printk( args... ) | 146 | #define debug_printk( args... ) do {} while (0) |
147 | #endif | 147 | #endif |
148 | 148 | ||
149 | /* issue a dummy PCI read to force the preceding write | 149 | /* issue a dummy PCI read to force the preceding write |
diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c index 991c378496f8..5fccf9f7a1d2 100644 --- a/drivers/ieee1394/ieee1394_core.c +++ b/drivers/ieee1394/ieee1394_core.c | |||
@@ -85,7 +85,7 @@ static void dump_packet(const char *text, quadlet_t *data, int size, int speed) | |||
85 | printk("\n"); | 85 | printk("\n"); |
86 | } | 86 | } |
87 | #else | 87 | #else |
88 | #define dump_packet(a,b,c,d) | 88 | #define dump_packet(a,b,c,d) do {} while (0) |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | static void abort_requests(struct hpsb_host *host); | 91 | static void abort_requests(struct hpsb_host *host); |
diff --git a/drivers/ieee1394/ieee1394_types.h b/drivers/ieee1394/ieee1394_types.h index a8de375e79b7..9803aaa15be0 100644 --- a/drivers/ieee1394/ieee1394_types.h +++ b/drivers/ieee1394/ieee1394_types.h | |||
@@ -41,7 +41,7 @@ typedef u16 arm_length_t; | |||
41 | #define HPSB_VERBOSE(fmt, args...) HPSB_PRINT(KERN_DEBUG, fmt , ## args) | 41 | #define HPSB_VERBOSE(fmt, args...) HPSB_PRINT(KERN_DEBUG, fmt , ## args) |
42 | #define HPSB_DEBUG_TLABELS | 42 | #define HPSB_DEBUG_TLABELS |
43 | #else | 43 | #else |
44 | #define HPSB_VERBOSE(fmt, args...) | 44 | #define HPSB_VERBOSE(fmt, args...) do {} while (0) |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #ifdef __BIG_ENDIAN | 47 | #ifdef __BIG_ENDIAN |
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 330dcf7c699d..ea14c831ff41 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c | |||
@@ -136,7 +136,7 @@ | |||
136 | #define DBGMSG(fmt, args...) \ | 136 | #define DBGMSG(fmt, args...) \ |
137 | printk(KERN_INFO "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args) | 137 | printk(KERN_INFO "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args) |
138 | #else | 138 | #else |
139 | #define DBGMSG(fmt, args...) | 139 | #define DBGMSG(fmt, args...) do {} while (0) |
140 | #endif | 140 | #endif |
141 | 141 | ||
142 | #ifdef CONFIG_IEEE1394_OHCI_DMA_DEBUG | 142 | #ifdef CONFIG_IEEE1394_OHCI_DMA_DEBUG |
@@ -148,8 +148,8 @@ printk(KERN_INFO "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host-> | |||
148 | --global_outstanding_dmas, ## args) | 148 | --global_outstanding_dmas, ## args) |
149 | static int global_outstanding_dmas = 0; | 149 | static int global_outstanding_dmas = 0; |
150 | #else | 150 | #else |
151 | #define OHCI_DMA_ALLOC(fmt, args...) | 151 | #define OHCI_DMA_ALLOC(fmt, args...) do {} while (0) |
152 | #define OHCI_DMA_FREE(fmt, args...) | 152 | #define OHCI_DMA_FREE(fmt, args...) do {} while (0) |
153 | #endif | 153 | #endif |
154 | 154 | ||
155 | /* print general (card independent) information */ | 155 | /* print general (card independent) information */ |
@@ -210,7 +210,7 @@ static inline void packet_swab(quadlet_t *data, int tcode) | |||
210 | } | 210 | } |
211 | #else | 211 | #else |
212 | /* Don't waste cycles on same sex byte swaps */ | 212 | /* Don't waste cycles on same sex byte swaps */ |
213 | #define packet_swab(w,x) | 213 | #define packet_swab(w,x) do {} while (0) |
214 | #endif /* !LITTLE_ENDIAN */ | 214 | #endif /* !LITTLE_ENDIAN */ |
215 | 215 | ||
216 | /*********************************** | 216 | /*********************************** |
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index 840b705fd5dd..47e667593244 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -67,7 +67,7 @@ | |||
67 | #define DBGMSG(fmt, args...) \ | 67 | #define DBGMSG(fmt, args...) \ |
68 | printk(KERN_INFO "raw1394:" fmt "\n" , ## args) | 68 | printk(KERN_INFO "raw1394:" fmt "\n" , ## args) |
69 | #else | 69 | #else |
70 | #define DBGMSG(fmt, args...) | 70 | #define DBGMSG(fmt, args...) do {} while (0) |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | static LIST_HEAD(host_info_list); | 73 | static LIST_HEAD(host_info_list); |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 1c8ce7acba82..668b4512deff 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -203,9 +203,9 @@ static u32 global_outstanding_command_orbs = 0; | |||
203 | #define outstanding_orb_incr global_outstanding_command_orbs++ | 203 | #define outstanding_orb_incr global_outstanding_command_orbs++ |
204 | #define outstanding_orb_decr global_outstanding_command_orbs-- | 204 | #define outstanding_orb_decr global_outstanding_command_orbs-- |
205 | #else | 205 | #else |
206 | #define SBP2_ORB_DEBUG(fmt, args...) | 206 | #define SBP2_ORB_DEBUG(fmt, args...) do {} while (0) |
207 | #define outstanding_orb_incr | 207 | #define outstanding_orb_incr do {} while (0) |
208 | #define outstanding_orb_decr | 208 | #define outstanding_orb_decr do {} while (0) |
209 | #endif | 209 | #endif |
210 | 210 | ||
211 | #ifdef CONFIG_IEEE1394_SBP2_DEBUG_DMA | 211 | #ifdef CONFIG_IEEE1394_SBP2_DEBUG_DMA |
@@ -217,8 +217,8 @@ static u32 global_outstanding_command_orbs = 0; | |||
217 | --global_outstanding_dmas, ## args) | 217 | --global_outstanding_dmas, ## args) |
218 | static u32 global_outstanding_dmas = 0; | 218 | static u32 global_outstanding_dmas = 0; |
219 | #else | 219 | #else |
220 | #define SBP2_DMA_ALLOC(fmt, args...) | 220 | #define SBP2_DMA_ALLOC(fmt, args...) do {} while (0) |
221 | #define SBP2_DMA_FREE(fmt, args...) | 221 | #define SBP2_DMA_FREE(fmt, args...) do {} while (0) |
222 | #endif | 222 | #endif |
223 | 223 | ||
224 | #if CONFIG_IEEE1394_SBP2_DEBUG >= 2 | 224 | #if CONFIG_IEEE1394_SBP2_DEBUG >= 2 |
@@ -232,7 +232,7 @@ static u32 global_outstanding_dmas = 0; | |||
232 | #define SBP2_NOTICE(fmt, args...) HPSB_NOTICE("sbp2: "fmt, ## args) | 232 | #define SBP2_NOTICE(fmt, args...) HPSB_NOTICE("sbp2: "fmt, ## args) |
233 | #define SBP2_WARN(fmt, args...) HPSB_WARN("sbp2: "fmt, ## args) | 233 | #define SBP2_WARN(fmt, args...) HPSB_WARN("sbp2: "fmt, ## args) |
234 | #else | 234 | #else |
235 | #define SBP2_DEBUG(fmt, args...) | 235 | #define SBP2_DEBUG(fmt, args...) do {} while (0) |
236 | #define SBP2_INFO(fmt, args...) HPSB_INFO("sbp2: "fmt, ## args) | 236 | #define SBP2_INFO(fmt, args...) HPSB_INFO("sbp2: "fmt, ## args) |
237 | #define SBP2_NOTICE(fmt, args...) HPSB_NOTICE("sbp2: "fmt, ## args) | 237 | #define SBP2_NOTICE(fmt, args...) HPSB_NOTICE("sbp2: "fmt, ## args) |
238 | #define SBP2_WARN(fmt, args...) HPSB_WARN("sbp2: "fmt, ## args) | 238 | #define SBP2_WARN(fmt, args...) HPSB_WARN("sbp2: "fmt, ## args) |
@@ -375,8 +375,8 @@ static inline void sbp2util_cpu_to_be32_buffer(void *buffer, int length) | |||
375 | } | 375 | } |
376 | #else /* BIG_ENDIAN */ | 376 | #else /* BIG_ENDIAN */ |
377 | /* Why waste the cpu cycles? */ | 377 | /* Why waste the cpu cycles? */ |
378 | #define sbp2util_be32_to_cpu_buffer(x,y) | 378 | #define sbp2util_be32_to_cpu_buffer(x,y) do {} while (0) |
379 | #define sbp2util_cpu_to_be32_buffer(x,y) | 379 | #define sbp2util_cpu_to_be32_buffer(x,y) do {} while (0) |
380 | #endif | 380 | #endif |
381 | 381 | ||
382 | #ifdef CONFIG_IEEE1394_SBP2_PACKET_DUMP | 382 | #ifdef CONFIG_IEEE1394_SBP2_PACKET_DUMP |
@@ -412,7 +412,7 @@ static void sbp2util_packet_dump(void *buffer, int length, char *dump_name, | |||
412 | return; | 412 | return; |
413 | } | 413 | } |
414 | #else | 414 | #else |
415 | #define sbp2util_packet_dump(w,x,y,z) | 415 | #define sbp2util_packet_dump(w,x,y,z) do {} while (0) |
416 | #endif | 416 | #endif |
417 | 417 | ||
418 | static DECLARE_WAIT_QUEUE_HEAD(access_wq); | 418 | static DECLARE_WAIT_QUEUE_HEAD(access_wq); |
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index af78b840dc26..9bc65059cc69 100644 --- a/drivers/ieee1394/video1394.c +++ b/drivers/ieee1394/video1394.c | |||
@@ -129,7 +129,7 @@ struct file_ctx { | |||
129 | #define DBGMSG(card, fmt, args...) \ | 129 | #define DBGMSG(card, fmt, args...) \ |
130 | printk(KERN_INFO "video1394_%d: " fmt "\n" , card , ## args) | 130 | printk(KERN_INFO "video1394_%d: " fmt "\n" , card , ## args) |
131 | #else | 131 | #else |
132 | #define DBGMSG(card, fmt, args...) | 132 | #define DBGMSG(card, fmt, args...) do {} while (0) |
133 | #endif | 133 | #endif |
134 | 134 | ||
135 | /* print general (card independent) information */ | 135 | /* print general (card independent) information */ |