diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-17 08:46:01 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-20 01:30:34 -0400 |
commit | ab50ff684707031ed4bad2fdd313208ae392e5bb (patch) | |
tree | 8e16e8f0c858a2b3dde789aafd3a98167cf0193b /drivers/mtd/ubi | |
parent | ebfce01a6dfa2bd30a16efdeb417862ea0355d3b (diff) |
UBI: switch to dynamic printks
Remove custom dynamic prints and the module parameter to toggle them and use
the generic kernel dynamic printk infrastructure.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r-- | drivers/mtd/ubi/debug.c | 3 | ||||
-rw-r--r-- | drivers/mtd/ubi/debug.h | 83 |
2 files changed, 28 insertions, 58 deletions
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index 0cd5beabe9c9..2224cbe41ddf 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c | |||
@@ -30,15 +30,12 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/moduleparam.h> | 31 | #include <linux/moduleparam.h> |
32 | 32 | ||
33 | unsigned int ubi_msg_flags; | ||
34 | unsigned int ubi_chk_flags; | 33 | unsigned int ubi_chk_flags; |
35 | unsigned int ubi_tst_flags; | 34 | unsigned int ubi_tst_flags; |
36 | 35 | ||
37 | module_param_named(debug_msgs, ubi_msg_flags, uint, S_IRUGO | S_IWUSR); | ||
38 | module_param_named(debug_chks, ubi_chk_flags, uint, S_IRUGO | S_IWUSR); | 36 | module_param_named(debug_chks, ubi_chk_flags, uint, S_IRUGO | S_IWUSR); |
39 | module_param_named(debug_tsts, ubi_chk_flags, uint, S_IRUGO | S_IWUSR); | 37 | module_param_named(debug_tsts, ubi_chk_flags, uint, S_IRUGO | S_IWUSR); |
40 | 38 | ||
41 | MODULE_PARM_DESC(debug_msgs, "Debug message type flags"); | ||
42 | MODULE_PARM_DESC(debug_chks, "Debug check flags"); | 39 | MODULE_PARM_DESC(debug_chks, "Debug check flags"); |
43 | MODULE_PARM_DESC(debug_tsts, "Debug special test flags"); | 40 | MODULE_PARM_DESC(debug_tsts, "Debug special test flags"); |
44 | 41 | ||
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h index b2dba2c20387..3f1a09c5c438 100644 --- a/drivers/mtd/ubi/debug.h +++ b/drivers/mtd/ubi/debug.h | |||
@@ -32,8 +32,6 @@ struct ubi_mkvol_req; | |||
32 | #ifdef CONFIG_MTD_UBI_DEBUG | 32 | #ifdef CONFIG_MTD_UBI_DEBUG |
33 | #include <linux/random.h> | 33 | #include <linux/random.h> |
34 | 34 | ||
35 | #define dbg_err(fmt, ...) ubi_err(fmt, ##__VA_ARGS__) | ||
36 | |||
37 | #define ubi_assert(expr) do { \ | 35 | #define ubi_assert(expr) do { \ |
38 | if (unlikely(!(expr))) { \ | 36 | if (unlikely(!(expr))) { \ |
39 | printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \ | 37 | printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \ |
@@ -42,62 +40,37 @@ struct ubi_mkvol_req; | |||
42 | } \ | 40 | } \ |
43 | } while (0) | 41 | } while (0) |
44 | 42 | ||
45 | #define dbg_msg(fmt, ...) \ | 43 | #define dbg_err(fmt, ...) ubi_err(fmt, ##__VA_ARGS__) |
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) | ||
53 | 44 | ||
54 | #define ubi_dbg_dump_stack() dump_stack() | 45 | #define ubi_dbg_dump_stack() dump_stack() |
55 | 46 | ||
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 | |||
84 | #define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a) \ | 47 | #define ubi_dbg_print_hex_dump(l, ps, pt, r, g, b, len, a) \ |
85 | print_hex_dump(l, ps, pt, r, g, b, len, a) | 48 | print_hex_dump(l, ps, pt, r, g, b, len, a) |
86 | 49 | ||
87 | /* General debugging messages */ | 50 | #define ubi_dbg_msg(type, fmt, ...) \ |
88 | #define dbg_gen(fmt, ...) dbg_do_msg(UBI_MSG_GEN, fmt, ##__VA_ARGS__) | 51 | pr_debug("UBI DBG " type ": " fmt "\n", ##__VA_ARGS__) |
89 | 52 | ||
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__) | ||
90 | /* Messages from the eraseblock association sub-system */ | 57 | /* Messages from the eraseblock association sub-system */ |
91 | #define dbg_eba(fmt, ...) dbg_do_msg(UBI_MSG_EBA, fmt, ##__VA_ARGS__) | 58 | #define dbg_eba(fmt, ...) ubi_dbg_msg("eba", fmt, ##__VA_ARGS__) |
92 | |||
93 | /* Messages from the wear-leveling sub-system */ | 59 | /* Messages from the wear-leveling sub-system */ |
94 | #define dbg_wl(fmt, ...) dbg_do_msg(UBI_MSG_WL, fmt, ##__VA_ARGS__) | 60 | #define dbg_wl(fmt, ...) ubi_dbg_msg("wl", fmt, ##__VA_ARGS__) |
95 | |||
96 | /* Messages from the input/output sub-system */ | 61 | /* Messages from the input/output sub-system */ |
97 | #define dbg_io(fmt, ...) dbg_do_msg(UBI_MSG_IO, fmt, ##__VA_ARGS__) | 62 | #define dbg_io(fmt, ...) ubi_dbg_msg("io", fmt, ##__VA_ARGS__) |
98 | |||
99 | /* Initialization and build messages */ | 63 | /* 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); | ||
101 | 74 | ||
102 | extern unsigned int ubi_chk_flags; | 75 | extern unsigned int ubi_chk_flags; |
103 | 76 | ||
@@ -197,17 +170,17 @@ static inline int ubi_dbg_is_erase_failure(void) | |||
197 | ubi_err(fmt, ##__VA_ARGS__); \ | 170 | ubi_err(fmt, ##__VA_ARGS__); \ |
198 | } while (0) | 171 | } while (0) |
199 | 172 | ||
200 | #define dbg_msg(fmt, ...) do { \ | 173 | #define ubi_dbg_msg(fmt, ...) do { \ |
201 | if (0) \ | 174 | if (0) \ |
202 | printk(KERN_DEBUG "UBI DBG (pid %d): %s: " fmt "\n", \ | 175 | pr_debug(fmt "\n", ##__VA_ARGS__); \ |
203 | current->pid, __func__, ##__VA_ARGS__); \ | ||
204 | } while (0) | 176 | } while (0) |
205 | 177 | ||
206 | #define dbg_gen(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | 178 | #define dbg_msg(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) |
207 | #define dbg_eba(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | 179 | #define dbg_gen(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) |
208 | #define dbg_wl(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | 180 | #define dbg_eba(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) |
209 | #define dbg_io(fmt, ...) dbg_msg(fmt, ##__VA_ARGS__) | 181 | #define dbg_wl(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__) |
210 | #define dbg_bld(fmt, ...) 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__) | ||
211 | 184 | ||
212 | static inline void ubi_dbg_dump_stack(void) { return; } | 185 | static inline void ubi_dbg_dump_stack(void) { return; } |
213 | static inline void | 186 | static inline void |