diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 14:02:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 14:02:17 -0400 |
commit | 996abf053eec4d67136be8b911bbaaf989cfb99c (patch) | |
tree | e2596756d7f74d06a937b2e71306cd3827ad9947 /drivers/mtd/ubi/debug.h | |
parent | 93082f0b15841b8926c38ef224d0e6f720000635 (diff) | |
parent | d37e6bf68fc1eb34a4ad21d9ae8890ed37ea80e7 (diff) |
Merge branch 'linux-next' of git://git.infradead.org/~dedekind/ubi-2.6
* 'linux-next' of git://git.infradead.org/~dedekind/ubi-2.6: (22 commits)
UBI: always start the background thread
UBI: fix gcc warning
UBI: remove pre-sqnum images support
UBI: fix kernel-doc errors and warnings
UBI: fix checkpatch.pl errors and warnings
UBI: bugfix - do not torture PEB needlessly
UBI: rework scrubbing messages
UBI: implement multiple volumes rename
UBI: fix and re-work debugging stuff
UBI: amend commentaries
UBI: fix error message
UBI: improve mkvol request validation
UBI: add ubi_sync() interface
UBI: fix 64-bit calculations
UBI: fix LEB locking
UBI: fix memory leak on error path
UBI: do not forget to free internal volumes
UBI: fix memory leak
UBI: avoid unnecessary division operations
UBI: fix buffer padding
...
Diffstat (limited to 'drivers/mtd/ubi/debug.h')
-rw-r--r-- | drivers/mtd/ubi/debug.h | 74 |
1 files changed, 47 insertions, 27 deletions
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h index 8ea99d8c9e1f..78e914d23ece 100644 --- a/drivers/mtd/ubi/debug.h +++ b/drivers/mtd/ubi/debug.h | |||
@@ -24,21 +24,16 @@ | |||
24 | #ifdef CONFIG_MTD_UBI_DEBUG | 24 | #ifdef CONFIG_MTD_UBI_DEBUG |
25 | #include <linux/random.h> | 25 | #include <linux/random.h> |
26 | 26 | ||
27 | #define ubi_assert(expr) BUG_ON(!(expr)) | ||
28 | #define dbg_err(fmt, ...) ubi_err(fmt, ##__VA_ARGS__) | 27 | #define dbg_err(fmt, ...) ubi_err(fmt, ##__VA_ARGS__) |
29 | #else | ||
30 | #define ubi_assert(expr) ({}) | ||
31 | #define dbg_err(fmt, ...) ({}) | ||
32 | #endif | ||
33 | 28 | ||
34 | #ifdef CONFIG_MTD_UBI_DEBUG_DISABLE_BGT | 29 | #define ubi_assert(expr) do { \ |
35 | #define DBG_DISABLE_BGT 1 | 30 | if (unlikely(!(expr))) { \ |
36 | #else | 31 | printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \ |
37 | #define DBG_DISABLE_BGT 0 | 32 | __func__, __LINE__, current->pid); \ |
38 | #endif | 33 | ubi_dbg_dump_stack(); \ |
34 | } \ | ||
35 | } while (0) | ||
39 | 36 | ||
40 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG | ||
41 | /* Generic debugging message */ | ||
42 | #define dbg_msg(fmt, ...) \ | 37 | #define dbg_msg(fmt, ...) \ |
43 | printk(KERN_DEBUG "UBI DBG (pid %d): %s: " fmt "\n", \ | 38 | printk(KERN_DEBUG "UBI DBG (pid %d): %s: " fmt "\n", \ |
44 | current->pid, __func__, ##__VA_ARGS__) | 39 | current->pid, __func__, ##__VA_ARGS__) |
@@ -61,36 +56,29 @@ void ubi_dbg_dump_sv(const struct ubi_scan_volume *sv); | |||
61 | void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type); | 56 | void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type); |
62 | void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); | 57 | void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); |
63 | 58 | ||
59 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG | ||
60 | /* General debugging messages */ | ||
61 | #define dbg_gen(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | ||
64 | #else | 62 | #else |
65 | 63 | #define dbg_gen(fmt, ...) ({}) | |
66 | #define dbg_msg(fmt, ...) ({}) | 64 | #endif |
67 | #define ubi_dbg_dump_stack() ({}) | ||
68 | #define ubi_dbg_dump_ec_hdr(ec_hdr) ({}) | ||
69 | #define ubi_dbg_dump_vid_hdr(vid_hdr) ({}) | ||
70 | #define ubi_dbg_dump_vol_info(vol) ({}) | ||
71 | #define ubi_dbg_dump_vtbl_record(r, idx) ({}) | ||
72 | #define ubi_dbg_dump_sv(sv) ({}) | ||
73 | #define ubi_dbg_dump_seb(seb, type) ({}) | ||
74 | #define ubi_dbg_dump_mkvol_req(req) ({}) | ||
75 | |||
76 | #endif /* CONFIG_MTD_UBI_DEBUG_MSG */ | ||
77 | 65 | ||
78 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG_EBA | 66 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG_EBA |
79 | /* Messages from the eraseblock association unit */ | 67 | /* Messages from the eraseblock association sub-system */ |
80 | #define dbg_eba(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | 68 | #define dbg_eba(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) |
81 | #else | 69 | #else |
82 | #define dbg_eba(fmt, ...) ({}) | 70 | #define dbg_eba(fmt, ...) ({}) |
83 | #endif | 71 | #endif |
84 | 72 | ||
85 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG_WL | 73 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG_WL |
86 | /* Messages from the wear-leveling unit */ | 74 | /* Messages from the wear-leveling sub-system */ |
87 | #define dbg_wl(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | 75 | #define dbg_wl(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) |
88 | #else | 76 | #else |
89 | #define dbg_wl(fmt, ...) ({}) | 77 | #define dbg_wl(fmt, ...) ({}) |
90 | #endif | 78 | #endif |
91 | 79 | ||
92 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG_IO | 80 | #ifdef CONFIG_MTD_UBI_DEBUG_MSG_IO |
93 | /* Messages from the input/output unit */ | 81 | /* Messages from the input/output sub-system */ |
94 | #define dbg_io(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | 82 | #define dbg_io(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) |
95 | #else | 83 | #else |
96 | #define dbg_io(fmt, ...) ({}) | 84 | #define dbg_io(fmt, ...) ({}) |
@@ -105,6 +93,12 @@ void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); | |||
105 | #define UBI_IO_DEBUG 0 | 93 | #define UBI_IO_DEBUG 0 |
106 | #endif | 94 | #endif |
107 | 95 | ||
96 | #ifdef CONFIG_MTD_UBI_DEBUG_DISABLE_BGT | ||
97 | #define DBG_DISABLE_BGT 1 | ||
98 | #else | ||
99 | #define DBG_DISABLE_BGT 0 | ||
100 | #endif | ||
101 | |||
108 | #ifdef CONFIG_MTD_UBI_DEBUG_EMULATE_BITFLIPS | 102 | #ifdef CONFIG_MTD_UBI_DEBUG_EMULATE_BITFLIPS |
109 | /** | 103 | /** |
110 | * ubi_dbg_is_bitflip - if it is time to emulate a bit-flip. | 104 | * ubi_dbg_is_bitflip - if it is time to emulate a bit-flip. |
@@ -149,4 +143,30 @@ static inline int ubi_dbg_is_erase_failure(void) | |||
149 | #define ubi_dbg_is_erase_failure() 0 | 143 | #define ubi_dbg_is_erase_failure() 0 |
150 | #endif | 144 | #endif |
151 | 145 | ||
146 | #else | ||
147 | |||
148 | #define ubi_assert(expr) ({}) | ||
149 | #define dbg_err(fmt, ...) ({}) | ||
150 | #define dbg_msg(fmt, ...) ({}) | ||
151 | #define dbg_gen(fmt, ...) ({}) | ||
152 | #define dbg_eba(fmt, ...) ({}) | ||
153 | #define dbg_wl(fmt, ...) ({}) | ||
154 | #define dbg_io(fmt, ...) ({}) | ||
155 | #define dbg_bld(fmt, ...) ({}) | ||
156 | #define ubi_dbg_dump_stack() ({}) | ||
157 | #define ubi_dbg_dump_ec_hdr(ec_hdr) ({}) | ||
158 | #define ubi_dbg_dump_vid_hdr(vid_hdr) ({}) | ||
159 | #define ubi_dbg_dump_vol_info(vol) ({}) | ||
160 | #define ubi_dbg_dump_vtbl_record(r, idx) ({}) | ||
161 | #define ubi_dbg_dump_sv(sv) ({}) | ||
162 | #define ubi_dbg_dump_seb(seb, type) ({}) | ||
163 | #define ubi_dbg_dump_mkvol_req(req) ({}) | ||
164 | |||
165 | #define UBI_IO_DEBUG 0 | ||
166 | #define DBG_DISABLE_BGT 0 | ||
167 | #define ubi_dbg_is_bitflip() 0 | ||
168 | #define ubi_dbg_is_write_failure() 0 | ||
169 | #define ubi_dbg_is_erase_failure() 0 | ||
170 | |||
171 | #endif /* !CONFIG_MTD_UBI_DEBUG */ | ||
152 | #endif /* !__UBI_DEBUG_H__ */ | 172 | #endif /* !__UBI_DEBUG_H__ */ |