@@ -32,8 +32,6 @@ struct ubi_mkvol_req;
3232#ifdef CONFIG_MTD_UBI_DEBUG
3333#include <linux/random.h>
3434
35- #define dbg_err (fmt , ...) ubi_err(fmt, ##__VA_ARGS__)
36-
3735#define ubi_assert (expr ) do { \
3836 if (unlikely(!(expr))) { \
3937 printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \
@@ -42,62 +40,37 @@ struct ubi_mkvol_req;
4240 } \
4341} while (0)
4442
45- #define dbg_msg (fmt , ...) \
46- printk(KERN_DEBUG "UBI DBG (pid %d): %s: " fmt "\n", \
47- current->pid, __func__, ##__VA_ARGS__)
48-
49- #define dbg_do_msg (typ , fmt , ...) do { \
50- if (ubi_msg_flags & typ) \
51- dbg_msg(fmt, ##__VA_ARGS__); \
52- } while (0)
43+ #define dbg_err (fmt , ...) ubi_err(fmt, ##__VA_ARGS__)
5344
5445#define ubi_dbg_dump_stack () dump_stack()
5546
56- void ubi_dbg_dump_ec_hdr (const struct ubi_ec_hdr * ec_hdr );
57- void ubi_dbg_dump_vid_hdr (const struct ubi_vid_hdr * vid_hdr );
58- void ubi_dbg_dump_vol_info (const struct ubi_volume * vol );
59- void ubi_dbg_dump_vtbl_record (const struct ubi_vtbl_record * r , int idx );
60- 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 );
62- void ubi_dbg_dump_mkvol_req (const struct ubi_mkvol_req * req );
63- void ubi_dbg_dump_flash (struct ubi_device * ubi , int pnum , int offset , int len );
64-
65- extern unsigned int ubi_msg_flags ;
66-
67- /*
68- * Debugging message type flags (must match msg_type_names in debug.c).
69- *
70- * UBI_MSG_GEN: general messages
71- * UBI_MSG_EBA: journal messages
72- * UBI_MSG_WL: mount messages
73- * UBI_MSG_IO: commit messages
74- * UBI_MSG_BLD: LEB find messages
75- */
76- enum {
77- UBI_MSG_GEN = 0x1 ,
78- UBI_MSG_EBA = 0x2 ,
79- UBI_MSG_WL = 0x4 ,
80- UBI_MSG_IO = 0x8 ,
81- UBI_MSG_BLD = 0x10 ,
82- };
83-
8447#define ubi_dbg_print_hex_dump (l , ps , pt , r , g , b , len , a ) \
8548 print_hex_dump(l, ps, pt, r, g, b, len, a)
8649
87- /* General debugging messages */
88- #define dbg_gen ( fmt , ...) dbg_do_msg(UBI_MSG_GEN, fmt, ##__VA_ARGS__)
50+ #define ubi_dbg_msg ( type , fmt , ...) \
51+ pr_debug("UBI DBG " type ": " fmt "\n" , ##__VA_ARGS__)
8952
53+ /* Just a debugging messages not related to any specific UBI subsystem */
54+ #define dbg_msg (fmt , ...) ubi_dbg_msg("msg", fmt, ##__VA_ARGS__)
55+ /* General debugging messages */
56+ #define dbg_gen (fmt , ...) ubi_dbg_msg("gen", fmt, ##__VA_ARGS__)
9057/* Messages from the eraseblock association sub-system */
91- #define dbg_eba (fmt , ...) dbg_do_msg(UBI_MSG_EBA, fmt, ##__VA_ARGS__)
92-
58+ #define dbg_eba (fmt , ...) ubi_dbg_msg("eba", fmt, ##__VA_ARGS__)
9359/* Messages from the wear-leveling sub-system */
94- #define dbg_wl (fmt , ...) dbg_do_msg(UBI_MSG_WL, fmt, ##__VA_ARGS__)
95-
60+ #define dbg_wl (fmt , ...) ubi_dbg_msg("wl", fmt, ##__VA_ARGS__)
9661/* Messages from the input/output sub-system */
97- #define dbg_io (fmt , ...) dbg_do_msg(UBI_MSG_IO, fmt, ##__VA_ARGS__)
98-
62+ #define dbg_io (fmt , ...) ubi_dbg_msg("io", fmt, ##__VA_ARGS__)
9963/* Initialization and build messages */
100- #define dbg_bld (fmt , ...) dbg_do_msg(UBI_MSG_BLD, fmt, ##__VA_ARGS__)
64+ #define dbg_bld (fmt , ...) ubi_dbg_msg("bld", fmt, ##__VA_ARGS__)
65+
66+ void ubi_dbg_dump_ec_hdr (const struct ubi_ec_hdr * ec_hdr );
67+ void ubi_dbg_dump_vid_hdr (const struct ubi_vid_hdr * vid_hdr );
68+ void ubi_dbg_dump_vol_info (const struct ubi_volume * vol );
69+ void ubi_dbg_dump_vtbl_record (const struct ubi_vtbl_record * r , int idx );
70+ void ubi_dbg_dump_sv (const struct ubi_scan_volume * sv );
71+ void ubi_dbg_dump_seb (const struct ubi_scan_leb * seb , int type );
72+ void ubi_dbg_dump_mkvol_req (const struct ubi_mkvol_req * req );
73+ void ubi_dbg_dump_flash (struct ubi_device * ubi , int pnum , int offset , int len );
10174
10275extern unsigned int ubi_chk_flags ;
10376
@@ -197,17 +170,17 @@ static inline int ubi_dbg_is_erase_failure(void)
197170 ubi_err(fmt, ##__VA_ARGS__); \
198171} while (0)
199172
200- #define dbg_msg (fmt , ...) do { \
173+ #define ubi_dbg_msg (fmt , ...) do { \
201174 if (0) \
202- printk(KERN_DEBUG "UBI DBG (pid %d): %s: " fmt "\n", \
203- current->pid, __func__, ##__VA_ARGS__); \
175+ pr_debug(fmt "\n", ##__VA_ARGS__); \
204176} while (0)
205177
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__)
178+ #define dbg_msg (fmt , ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
179+ #define dbg_gen (fmt , ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
180+ #define dbg_eba (fmt , ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
181+ #define dbg_wl (fmt , ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
182+ #define dbg_io (fmt , ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
183+ #define dbg_bld (fmt , ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
211184
212185static inline void ubi_dbg_dump_stack (void ) { return ; }
213186static inline void
0 commit comments