diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-17 05:50:08 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-20 01:30:34 -0400 |
commit | 3802243a189b0f153acb03f531daf35d40bc38bb (patch) | |
tree | 073eb1a7fcc3304ab048eb540d87565feadc0bfb /drivers/mtd/ubi/debug.h | |
parent | 1426414431a8d37a6e631e0b5e2ad6186b81876a (diff) |
UBI: improve checking in debugging prints
When debugging is disabled, define debugging prints as if (0) printk() to make
sure that the compiler still the format string in debugging messages even if
debugging is disabled.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/debug.h')
-rw-r--r-- | drivers/mtd/ubi/debug.h | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h index 0b0c2888c656..bdd2c73fa3a1 100644 --- a/drivers/mtd/ubi/debug.h +++ b/drivers/mtd/ubi/debug.h | |||
@@ -184,14 +184,31 @@ static inline int ubi_dbg_is_erase_failure(void) | |||
184 | 184 | ||
185 | #else | 185 | #else |
186 | 186 | ||
187 | #define ubi_assert(expr) ({}) | 187 | /* Use "if (0)" to make compiler check arguments even if debugging is off */ |
188 | #define dbg_err(fmt, ...) ({}) | 188 | #define ubi_assert(expr) do { \ |
189 | #define dbg_msg(fmt, ...) ({}) | 189 | if (0) { \ |
190 | #define dbg_gen(fmt, ...) ({}) | 190 | printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \ |
191 | #define dbg_eba(fmt, ...) ({}) | 191 | __func__, __LINE__, current->pid); \ |
192 | #define dbg_wl(fmt, ...) ({}) | 192 | } \ |
193 | #define dbg_io(fmt, ...) ({}) | 193 | } while (0) |
194 | #define dbg_bld(fmt, ...) ({}) | 194 | |
195 | #define dbg_err(fmt, ...) do { \ | ||
196 | if (0) \ | ||
197 | ubi_err(fmt, ##__VA_ARGS__); \ | ||
198 | } while (0) | ||
199 | |||
200 | #define dbg_msg(fmt, ...) do { \ | ||
201 | if (0) \ | ||
202 | printk(KERN_DEBUG "UBI DBG (pid %d): %s: " fmt "\n", \ | ||
203 | current->pid, __func__, ##__VA_ARGS__); \ | ||
204 | } while (0) | ||
205 | |||
206 | #define dbg_gen(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | ||
207 | #define dbg_eba(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | ||
208 | #define dbg_wl(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | ||
209 | #define dbg_io(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | ||
210 | #define dbg_bld(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | ||
211 | |||
195 | #define ubi_dbg_dump_stack() ({}) | 212 | #define ubi_dbg_dump_stack() ({}) |
196 | #define ubi_dbg_dump_ec_hdr(ec_hdr) ({}) | 213 | #define ubi_dbg_dump_ec_hdr(ec_hdr) ({}) |
197 | #define ubi_dbg_dump_vid_hdr(vid_hdr) ({}) | 214 | #define ubi_dbg_dump_vid_hdr(vid_hdr) ({}) |