Skip to content

Commit aa44d1d

Browse files
committed
UBI: remove Kconfig debugging option
This patch kills the UBI debugging Kconfig option completely and makes all the debugging stuff to be always compiled-in. It was pain in the neck to maintain this useless option because all users I am aware of have debugging enabled anyway - how else will you diagnose errors otherwise? Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
1 parent 718c00b commit aa44d1d

8 files changed

Lines changed: 0 additions & 120 deletions

File tree

‎drivers/mtd/ubi/Kconfig‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,4 @@ config MTD_UBI_GLUEBI
5252
work on top of UBI. Do not enable this unless you use legacy
5353
software.
5454

55-
config MTD_UBI_DEBUG
56-
bool "UBI debugging"
57-
depends on SYSFS
58-
select DEBUG_FS
59-
select KALLSYMS
60-
help
61-
This option enables UBI debugging.
62-
6355
endif # MTD_UBI

‎drivers/mtd/ubi/debug.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr)
106106
vid_hdr, UBI_VID_HDR_SIZE, 1);
107107
}
108108

109-
#ifdef CONFIG_MTD_UBI_DEBUG
110-
111109
/**
112110
* ubi_dump_vol_info - dump volume information.
113111
* @vol: UBI volume description object
@@ -474,5 +472,3 @@ void ubi_debugfs_exit_dev(struct ubi_device *ubi)
474472
{
475473
debugfs_remove_recursive(ubi->dbg->dfs_dir);
476474
}
477-
478-
#endif /* CONFIG_MTD_UBI_DEBUG */

‎drivers/mtd/ubi/debug.h‎

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len);
2525
void ubi_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr);
2626
void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr);
2727

28-
#ifdef CONFIG_MTD_UBI_DEBUG
2928
#include <linux/random.h>
3029

3130
#define ubi_assert(expr) do { \
@@ -166,66 +165,4 @@ static inline int ubi_dbg_is_erase_failure(const struct ubi_device *ubi)
166165
return 0;
167166
}
168167

169-
#else
170-
171-
/* Use "if (0)" to make compiler check arguments even if debugging is off */
172-
#define ubi_assert(expr) do { \
173-
if (0) { \
174-
printk(KERN_CRIT "UBI assert failed in %s at %u (pid %d)\n", \
175-
__func__, __LINE__, current->pid); \
176-
} \
177-
} while (0)
178-
179-
#define dbg_err(fmt, ...) do { \
180-
if (0) \
181-
ubi_err(fmt, ##__VA_ARGS__); \
182-
} while (0)
183-
184-
#define ubi_dbg_msg(fmt, ...) do { \
185-
if (0) \
186-
printk(KERN_DEBUG fmt "\n", ##__VA_ARGS__); \
187-
} while (0)
188-
189-
#define dbg_msg(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
190-
#define dbg_gen(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
191-
#define dbg_eba(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
192-
#define dbg_wl(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
193-
#define dbg_io(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
194-
#define dbg_bld(fmt, ...) ubi_dbg_msg(fmt, ##__VA_ARGS__)
195-
196-
static inline void
197-
ubi_dump_vol_info(const struct ubi_volume *vol) { return; }
198-
static inline void
199-
ubi_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx) { return; }
200-
static inline void ubi_dump_sv(const struct ubi_scan_volume *sv) { return; }
201-
static inline void ubi_dump_seb(const struct ubi_scan_leb *seb,
202-
int type) { return; }
203-
static inline void
204-
ubi_dump_mkvol_req(const struct ubi_mkvol_req *req) { return; }
205-
static inline void
206-
ubi_dbg_print_hex_dump(const char *l, const char *ps, int pt, int r,
207-
int g, const void *b, size_t len, bool a) { return; }
208-
static inline int ubi_dbg_check_all_ff(struct ubi_device *ubi,
209-
int pnum, int offset,
210-
int len) { return 0; }
211-
static inline int ubi_dbg_check_write(struct ubi_device *ubi,
212-
const void *buf, int pnum,
213-
int offset, int len) { return 0; }
214-
215-
static inline int ubi_debugging_init_dev(struct ubi_device *ubi) { return 0; }
216-
static inline void ubi_debugging_exit_dev(struct ubi_device *ubi) { return; }
217-
static inline int ubi_debugfs_init(void) { return 0; }
218-
static inline void ubi_debugfs_exit(void) { return; }
219-
static inline int ubi_debugfs_init_dev(struct ubi_device *ubi) { return 0; }
220-
static inline void ubi_debugfs_exit_dev(struct ubi_device *ubi) { return; }
221-
222-
static inline int
223-
ubi_dbg_is_bgt_disabled(const struct ubi_device *ubi) { return 0; }
224-
static inline int ubi_dbg_is_bitflip(const struct ubi_device *ubi) { return 0; }
225-
static inline int
226-
ubi_dbg_is_write_failure(const struct ubi_device *ubi) { return 0; }
227-
static inline int
228-
ubi_dbg_is_erase_failure(const struct ubi_device *ubi) { return 0; }
229-
230-
#endif /* !CONFIG_MTD_UBI_DEBUG */
231168
#endif /* !__UBI_DEBUG_H__ */

‎drivers/mtd/ubi/io.c‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,13 @@
9191
#include <linux/slab.h>
9292
#include "ubi.h"
9393

94-
#ifdef CONFIG_MTD_UBI_DEBUG
9594
static int paranoid_check_not_bad(const struct ubi_device *ubi, int pnum);
9695
static int paranoid_check_peb_ec_hdr(const struct ubi_device *ubi, int pnum);
9796
static int paranoid_check_ec_hdr(const struct ubi_device *ubi, int pnum,
9897
const struct ubi_ec_hdr *ec_hdr);
9998
static int paranoid_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum);
10099
static int paranoid_check_vid_hdr(const struct ubi_device *ubi, int pnum,
101100
const struct ubi_vid_hdr *vid_hdr);
102-
#else
103-
#define paranoid_check_not_bad(ubi, pnum) 0
104-
#define paranoid_check_peb_ec_hdr(ubi, pnum) 0
105-
#define paranoid_check_ec_hdr(ubi, pnum, ec_hdr) 0
106-
#define paranoid_check_peb_vid_hdr(ubi, pnum) 0
107-
#define paranoid_check_vid_hdr(ubi, pnum, vid_hdr) 0
108-
#endif
109101

110102
/**
111103
* ubi_io_read - read data from a physical eraseblock.
@@ -1131,8 +1123,6 @@ int ubi_io_write_vid_hdr(struct ubi_device *ubi, int pnum,
11311123
return err;
11321124
}
11331125

1134-
#ifdef CONFIG_MTD_UBI_DEBUG
1135-
11361126
/**
11371127
* paranoid_check_not_bad - ensure that a physical eraseblock is not bad.
11381128
* @ubi: UBI device description object
@@ -1447,5 +1437,3 @@ int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len)
14471437
vfree(buf);
14481438
return err;
14491439
}
1450-
1451-
#endif /* CONFIG_MTD_UBI_DEBUG */

‎drivers/mtd/ubi/scan.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,7 @@
8888
#include <linux/random.h>
8989
#include "ubi.h"
9090

91-
#ifdef CONFIG_MTD_UBI_DEBUG
9291
static int paranoid_check_si(struct ubi_device *ubi, struct ubi_scan_info *si);
93-
#else
94-
#define paranoid_check_si(ubi, si) 0
95-
#endif
9692

9793
/* Temporary variables used during scanning */
9894
static struct ubi_ec_hdr *ech;
@@ -1329,8 +1325,6 @@ void ubi_scan_destroy_si(struct ubi_scan_info *si)
13291325
kfree(si);
13301326
}
13311327

1332-
#ifdef CONFIG_MTD_UBI_DEBUG
1333-
13341328
/**
13351329
* paranoid_check_si - check the scanning information.
13361330
* @ubi: UBI device description object
@@ -1601,5 +1595,3 @@ static int paranoid_check_si(struct ubi_device *ubi, struct ubi_scan_info *si)
16011595
dump_stack();
16021596
return -EINVAL;
16031597
}
1604-
1605-
#endif /* CONFIG_MTD_UBI_DEBUG */

‎drivers/mtd/ubi/vmt.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@
2929
#include <linux/export.h>
3030
#include "ubi.h"
3131

32-
#ifdef CONFIG_MTD_UBI_DEBUG
3332
static int paranoid_check_volumes(struct ubi_device *ubi);
34-
#else
35-
#define paranoid_check_volumes(ubi) 0
36-
#endif
3733

3834
static ssize_t vol_attribute_show(struct device *dev,
3935
struct device_attribute *attr, char *buf);
@@ -712,8 +708,6 @@ void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol)
712708
volume_sysfs_close(vol);
713709
}
714710

715-
#ifdef CONFIG_MTD_UBI_DEBUG
716-
717711
/**
718712
* paranoid_check_volume - check volume information.
719713
* @ubi: UBI device description object
@@ -883,4 +877,3 @@ static int paranoid_check_volumes(struct ubi_device *ubi)
883877

884878
return err;
885879
}
886-
#endif

‎drivers/mtd/ubi/vtbl.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@
6262
#include <asm/div64.h>
6363
#include "ubi.h"
6464

65-
#ifdef CONFIG_MTD_UBI_DEBUG
6665
static void paranoid_vtbl_check(const struct ubi_device *ubi);
67-
#else
68-
#define paranoid_vtbl_check(ubi)
69-
#endif
7066

7167
/* Empty volume table record */
7268
static struct ubi_vtbl_record empty_vtbl_record;
@@ -858,8 +854,6 @@ int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_scan_info *si)
858854
return err;
859855
}
860856

861-
#ifdef CONFIG_MTD_UBI_DEBUG
862-
863857
/**
864858
* paranoid_vtbl_check - check volume table.
865859
* @ubi: UBI device description object
@@ -874,5 +868,3 @@ static void paranoid_vtbl_check(const struct ubi_device *ubi)
874868
BUG();
875869
}
876870
}
877-
878-
#endif /* CONFIG_MTD_UBI_DEBUG */

‎drivers/mtd/ubi/wl.c‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,12 @@ struct ubi_work {
155155
int torture;
156156
};
157157

158-
#ifdef CONFIG_MTD_UBI_DEBUG
159158
static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec);
160159
static int paranoid_check_in_wl_tree(const struct ubi_device *ubi,
161160
struct ubi_wl_entry *e,
162161
struct rb_root *root);
163162
static int paranoid_check_in_pq(const struct ubi_device *ubi,
164163
struct ubi_wl_entry *e);
165-
#else
166-
#define paranoid_check_ec(ubi, pnum, ec) 0
167-
#define paranoid_check_in_wl_tree(ubi, e, root)
168-
#define paranoid_check_in_pq(ubi, e) 0
169-
#endif
170164

171165
/**
172166
* wl_tree_add - add a wear-leveling entry to a WL RB-tree.
@@ -1526,8 +1520,6 @@ void ubi_wl_close(struct ubi_device *ubi)
15261520
kfree(ubi->lookuptbl);
15271521
}
15281522

1529-
#ifdef CONFIG_MTD_UBI_DEBUG
1530-
15311523
/**
15321524
* paranoid_check_ec - make sure that the erase counter of a PEB is correct.
15331525
* @ubi: UBI device description object
@@ -1624,5 +1616,3 @@ static int paranoid_check_in_pq(const struct ubi_device *ubi,
16241616
dump_stack();
16251617
return -EINVAL;
16261618
}
1627-
1628-
#endif /* CONFIG_MTD_UBI_DEBUG */

0 commit comments

Comments
 (0)