diff options
Diffstat (limited to 'drivers/mtd/ubi/debug.h')
-rw-r--r-- | drivers/mtd/ubi/debug.h | 98 |
1 files changed, 12 insertions, 86 deletions
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h index ead2cd16ba75..d5d2645b51a7 100644 --- a/drivers/mtd/ubi/debug.h +++ b/drivers/mtd/ubi/debug.h | |||
@@ -21,21 +21,20 @@ | |||
21 | #ifndef __UBI_DEBUG_H__ | 21 | #ifndef __UBI_DEBUG_H__ |
22 | #define __UBI_DEBUG_H__ | 22 | #define __UBI_DEBUG_H__ |
23 | 23 | ||
24 | #ifdef CONFIG_MTD_UBI_DEBUG | 24 | void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len); |
25 | void ubi_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr); | ||
26 | void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr); | ||
27 | |||
25 | #include <linux/random.h> | 28 | #include <linux/random.h> |
26 | 29 | ||
27 | #define ubi_assert(expr) do { \ | 30 | #define ubi_assert(expr) do { \ |
28 | if (unlikely(!(expr))) { \ | 31 | if (unlikely(!(expr))) { \ |
29 | printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \ | 32 | printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \ |
30 | __func__, __LINE__, current->pid); \ | 33 | __func__, __LINE__, current->pid); \ |
31 | ubi_dbg_dump_stack(); \ | 34 | dump_stack(); \ |
32 | } \ | 35 | } \ |
33 | } while (0) | 36 | } while (0) |
34 | 37 | ||
35 | #define dbg_err(fmt, ...) ubi_err(fmt, ##__VA_ARGS__) | ||
36 | |||
37 | #define ubi_dbg_dump_stack() dump_stack() | ||
38 | |||
39 | #define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a) \ | 38 | #define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a) \ |
40 | print_hex_dump(l, ps, pt, r, g, b, len, a) | 39 | print_hex_dump(l, ps, pt, r, g, b, len, a) |
41 | 40 | ||
@@ -58,17 +57,13 @@ | |||
58 | /* Initialization and build messages */ | 57 | /* Initialization and build messages */ |
59 | #define dbg_bld(fmt, ...) ubi_dbg_msg("bld", fmt, ##__VA_ARGS__) | 58 | #define dbg_bld(fmt, ...) ubi_dbg_msg("bld", fmt, ##__VA_ARGS__) |
60 | 59 | ||
61 | void ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr); | 60 | void ubi_dump_vol_info(const struct ubi_volume *vol); |
62 | void ubi_dbg_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr); | 61 | void ubi_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx); |
63 | void ubi_dbg_dump_vol_info(const struct ubi_volume *vol); | 62 | void ubi_dump_av(const struct ubi_ainf_volume *av); |
64 | void ubi_dbg_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx); | 63 | void ubi_dump_aeb(const struct ubi_ainf_peb *aeb, int type); |
65 | void ubi_dbg_dump_sv(const struct ubi_scan_volume *sv); | 64 | void ubi_dump_mkvol_req(const struct ubi_mkvol_req *req); |
66 | void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type); | 65 | int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, |
67 | void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); | 66 | int len); |
68 | void ubi_dbg_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len); | ||
69 | int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len); | ||
70 | int ubi_dbg_check_write(struct ubi_device *ubi, const void *buf, int pnum, | ||
71 | int offset, int len); | ||
72 | int ubi_debugging_init_dev(struct ubi_device *ubi); | 67 | int ubi_debugging_init_dev(struct ubi_device *ubi); |
73 | void ubi_debugging_exit_dev(struct ubi_device *ubi); | 68 | void ubi_debugging_exit_dev(struct ubi_device *ubi); |
74 | int ubi_debugfs_init(void); | 69 | int ubi_debugfs_init(void); |
@@ -167,73 +162,4 @@ static inline int ubi_dbg_is_erase_failure(const struct ubi_device *ubi) | |||
167 | return 0; | 162 | return 0; |
168 | } | 163 | } |
169 | 164 | ||
170 | #else | ||
171 | |||
172 | /* Use "if (0)" to make compiler check arguments even if debugging is off */ | ||
173 | #define ubi_assert(expr) do { \ | ||
174 | if (0) { \ | ||
175 | printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \ | ||
176 | __func__, __LINE__, current->pid); \ | ||
177 | } \ | ||
178 | } while (0) | ||
179 | |||
180 | #define dbg_err(fmt, ...) do { \ | ||
181 | if (0) \ | ||
182 | ubi_err(fmt, ##__VA_ARGS__); \ | ||
183 | } while (0) | ||
184 | |||
185 | #define ubi_dbg_msg(fmt, ...) do { \ | ||
186 | if (0) \ | ||
187 | printk(KERN_DEBUG fmt "\n", ##__VA_ARGS__); \ | ||
188 | } while (0) | ||
189 | |||
190 | #define dbg_msg(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) | ||
191 | #define dbg_gen(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) | ||
192 | #define dbg_eba(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) | ||
193 | #define dbg_wl(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) | ||
194 | #define dbg_io(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) | ||
195 | #define dbg_bld(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) | ||
196 | |||
197 | static inline void ubi_dbg_dump_stack(void) { return; } | ||
198 | static inline void | ||
199 | ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr) { return; } | ||
200 | static inline void | ||
201 | ubi_dbg_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr) { return; } | ||
202 | static inline void | ||
203 | ubi_dbg_dump_vol_info(const struct ubi_volume *vol) { return; } | ||
204 | static inline void | ||
205 | ubi_dbg_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx) { return; } | ||
206 | static inline void ubi_dbg_dump_sv(const struct ubi_scan_volume *sv) { return; } | ||
207 | static inline void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, | ||
208 | int type) { return; } | ||
209 | static inline void | ||
210 | ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req) { return; } | ||
211 | static inline void ubi_dbg_dump_flash(struct ubi_device *ubi, | ||
212 | int pnum, int offset, int len) { return; } | ||
213 | static inline void | ||
214 | ubi_dbg_print_hex_dump(const char *l, const char *ps, int pt, int r, | ||
215 | int g, const void *b, size_t len, bool a) { return; } | ||
216 | static inline int ubi_dbg_check_all_ff(struct ubi_device *ubi, | ||
217 | int pnum, int offset, | ||
218 | int len) { return 0; } | ||
219 | static inline int ubi_dbg_check_write(struct ubi_device *ubi, | ||
220 | const void *buf, int pnum, | ||
221 | int offset, int len) { return 0; } | ||
222 | |||
223 | static inline int ubi_debugging_init_dev(struct ubi_device *ubi) { return 0; } | ||
224 | static inline void ubi_debugging_exit_dev(struct ubi_device *ubi) { return; } | ||
225 | static inline int ubi_debugfs_init(void) { return 0; } | ||
226 | static inline void ubi_debugfs_exit(void) { return; } | ||
227 | static inline int ubi_debugfs_init_dev(struct ubi_device *ubi) { return 0; } | ||
228 | static inline void ubi_debugfs_exit_dev(struct ubi_device *ubi) { return; } | ||
229 | |||
230 | static inline int | ||
231 | ubi_dbg_is_bgt_disabled(const struct ubi_device *ubi) { return 0; } | ||
232 | static inline int ubi_dbg_is_bitflip(const struct ubi_device *ubi) { return 0; } | ||
233 | static inline int | ||
234 | ubi_dbg_is_write_failure(const struct ubi_device *ubi) { return 0; } | ||
235 | static inline int | ||
236 | ubi_dbg_is_erase_failure(const struct ubi_device *ubi) { return 0; } | ||
237 | |||
238 | #endif /* !CONFIG_MTD_UBI_DEBUG */ | ||
239 | #endif /* !__UBI_DEBUG_H__ */ | 165 | #endif /* !__UBI_DEBUG_H__ */ |