aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/debug.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/debug.h')
-rw-r--r--drivers/mtd/ubi/debug.h98
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 24void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len);
25void ubi_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr);
26void 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
61void ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr); 60void ubi_dump_vol_info(const struct ubi_volume *vol);
62void ubi_dbg_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr); 61void ubi_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx);
63void ubi_dbg_dump_vol_info(const struct ubi_volume *vol); 62void ubi_dump_av(const struct ubi_ainf_volume *av);
64void ubi_dbg_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx); 63void ubi_dump_aeb(const struct ubi_ainf_peb *aeb, int type);
65void ubi_dbg_dump_sv(const struct ubi_scan_volume *sv); 64void ubi_dump_mkvol_req(const struct ubi_mkvol_req *req);
66void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb, int type); 65int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset,
67void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); 66 int len);
68void ubi_dbg_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len);
69int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len);
70int ubi_dbg_check_write(struct ubi_device *ubi, const void *buf, int pnum,
71 int offset, int len);
72int ubi_debugging_init_dev(struct ubi_device *ubi); 67int ubi_debugging_init_dev(struct ubi_device *ubi);
73void ubi_debugging_exit_dev(struct ubi_device *ubi); 68void ubi_debugging_exit_dev(struct ubi_device *ubi);
74int ubi_debugfs_init(void); 69int 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
197static inline void ubi_dbg_dump_stack(void) { return; }
198static inline void
199ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr) { return; }
200static inline void
201ubi_dbg_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr) { return; }
202static inline void
203ubi_dbg_dump_vol_info(const struct ubi_volume *vol) { return; }
204static inline void
205ubi_dbg_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx) { return; }
206static inline void ubi_dbg_dump_sv(const struct ubi_scan_volume *sv) { return; }
207static inline void ubi_dbg_dump_seb(const struct ubi_scan_leb *seb,
208 int type) { return; }
209static inline void
210ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req) { return; }
211static inline void ubi_dbg_dump_flash(struct ubi_device *ubi,
212 int pnum, int offset, int len) { return; }
213static inline void
214ubi_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; }
216static inline int ubi_dbg_check_all_ff(struct ubi_device *ubi,
217 int pnum, int offset,
218 int len) { return 0; }
219static inline int ubi_dbg_check_write(struct ubi_device *ubi,
220 const void *buf, int pnum,
221 int offset, int len) { return 0; }
222
223static inline int ubi_debugging_init_dev(struct ubi_device *ubi) { return 0; }
224static inline void ubi_debugging_exit_dev(struct ubi_device *ubi) { return; }
225static inline int ubi_debugfs_init(void) { return 0; }
226static inline void ubi_debugfs_exit(void) { return; }
227static inline int ubi_debugfs_init_dev(struct ubi_device *ubi) { return 0; }
228static inline void ubi_debugfs_exit_dev(struct ubi_device *ubi) { return; }
229
230static inline int
231ubi_dbg_is_bgt_disabled(const struct ubi_device *ubi) { return 0; }
232static inline int ubi_dbg_is_bitflip(const struct ubi_device *ubi) { return 0; }
233static inline int
234ubi_dbg_is_write_failure(const struct ubi_device *ubi) { return 0; }
235static inline int
236ubi_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__ */