From ae9ec3588474a36f2a18893d25c8b6254788404a Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Tue, 17 May 2011 12:50:08 +0300 Subject: [PATCH] --- yaml --- r: 250476 b: refs/heads/master c: 3802243a189b0f153acb03f531daf35d40bc38bb h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/drivers/mtd/ubi/debug.h | 33 +++++++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 9c88e6d4d54a..c5f7845bd32b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1426414431a8d37a6e631e0b5e2ad6186b81876a +refs/heads/master: 3802243a189b0f153acb03f531daf35d40bc38bb diff --git a/trunk/drivers/mtd/ubi/debug.h b/trunk/drivers/mtd/ubi/debug.h index 0b0c2888c656..bdd2c73fa3a1 100644 --- a/trunk/drivers/mtd/ubi/debug.h +++ b/trunk/drivers/mtd/ubi/debug.h @@ -184,14 +184,31 @@ static inline int ubi_dbg_is_erase_failure(void) #else -#define ubi_assert(expr) ({}) -#define dbg_err(fmt, ...) ({}) -#define dbg_msg(fmt, ...) ({}) -#define dbg_gen(fmt, ...) ({}) -#define dbg_eba(fmt, ...) ({}) -#define dbg_wl(fmt, ...) ({}) -#define dbg_io(fmt, ...) ({}) -#define dbg_bld(fmt, ...) ({}) +/* Use "if (0)" to make compiler check arguments even if debugging is off */ +#define ubi_assert(expr) do { \ + if (0) { \ + printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \ + __func__, __LINE__, current->pid); \ + } \ +} while (0) + +#define dbg_err(fmt, ...) do { \ + if (0) \ + ubi_err(fmt, ##__VA_ARGS__); \ +} while (0) + +#define dbg_msg(fmt, ...) do { \ + if (0) \ + printk(KERN_DEBUG "UBI DBG (pid %d): %s: " fmt "\n", \ + current->pid, __func__, ##__VA_ARGS__); \ +} while (0) + +#define dbg_gen(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) +#define dbg_eba(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) +#define dbg_wl(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) +#define dbg_io(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) +#define dbg_bld(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) + #define ubi_dbg_dump_stack() ({}) #define ubi_dbg_dump_ec_hdr(ec_hdr) ({}) #define ubi_dbg_dump_vid_hdr(vid_hdr) ({})