aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/ubi/attach.c4
-rw-r--r--drivers/mtd/ubi/debug.h9
-rw-r--r--drivers/mtd/ubi/io.c14
-rw-r--r--drivers/mtd/ubi/vmt.c2
-rw-r--r--drivers/mtd/ubi/vtbl.c2
-rw-r--r--drivers/mtd/ubi/wl.c6
6 files changed, 23 insertions, 14 deletions
diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
index 72fed3027304..c071d410488f 100644
--- a/drivers/mtd/ubi/attach.c
+++ b/drivers/mtd/ubi/attach.c
@@ -1448,7 +1448,7 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)
1448 goto out_wl; 1448 goto out_wl;
1449 1449
1450#ifdef CONFIG_MTD_UBI_FASTMAP 1450#ifdef CONFIG_MTD_UBI_FASTMAP
1451 if (ubi->fm && ubi->dbg->chk_gen) { 1451 if (ubi->fm && ubi_dbg_chk_gen(ubi)) {
1452 struct ubi_attach_info *scan_ai; 1452 struct ubi_attach_info *scan_ai;
1453 1453
1454 scan_ai = alloc_ai("ubi_ckh_aeb_slab_cache"); 1454 scan_ai = alloc_ai("ubi_ckh_aeb_slab_cache");
@@ -1498,7 +1498,7 @@ static int self_check_ai(struct ubi_device *ubi, struct ubi_attach_info *ai)
1498 struct ubi_ainf_peb *aeb, *last_aeb; 1498 struct ubi_ainf_peb *aeb, *last_aeb;
1499 uint8_t *buf; 1499 uint8_t *buf;
1500 1500
1501 if (!ubi->dbg->chk_gen) 1501 if (!ubi_dbg_chk_gen(ubi))
1502 return 0; 1502 return 0;
1503 1503
1504 /* 1504 /*
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h
index 3dbc877d9663..0add8d8a1672 100644
--- a/drivers/mtd/ubi/debug.h
+++ b/drivers/mtd/ubi/debug.h
@@ -158,4 +158,13 @@ static inline int ubi_dbg_is_erase_failure(const struct ubi_device *ubi)
158 return 0; 158 return 0;
159} 159}
160 160
161static inline int ubi_dbg_chk_io(const struct ubi_device *ubi)
162{
163 return ubi->dbg->chk_io;
164}
165
166static inline int ubi_dbg_chk_gen(const struct ubi_device *ubi)
167{
168 return ubi->dbg->chk_gen;
169}
161#endif /* !__UBI_DEBUG_H__ */ 170#endif /* !__UBI_DEBUG_H__ */
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 78a1dcbf2107..bf79def40126 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -1132,7 +1132,7 @@ static int self_check_not_bad(const struct ubi_device *ubi, int pnum)
1132{ 1132{
1133 int err; 1133 int err;
1134 1134
1135 if (!ubi->dbg->chk_io) 1135 if (!ubi_dbg_chk_io(ubi))
1136 return 0; 1136 return 0;
1137 1137
1138 err = ubi_io_is_bad(ubi, pnum); 1138 err = ubi_io_is_bad(ubi, pnum);
@@ -1159,7 +1159,7 @@ static int self_check_ec_hdr(const struct ubi_device *ubi, int pnum,
1159 int err; 1159 int err;
1160 uint32_t magic; 1160 uint32_t magic;
1161 1161
1162 if (!ubi->dbg->chk_io) 1162 if (!ubi_dbg_chk_io(ubi))
1163 return 0; 1163 return 0;
1164 1164
1165 magic = be32_to_cpu(ec_hdr->magic); 1165 magic = be32_to_cpu(ec_hdr->magic);
@@ -1197,7 +1197,7 @@ static int self_check_peb_ec_hdr(const struct ubi_device *ubi, int pnum)
1197 uint32_t crc, hdr_crc; 1197 uint32_t crc, hdr_crc;
1198 struct ubi_ec_hdr *ec_hdr; 1198 struct ubi_ec_hdr *ec_hdr;
1199 1199
1200 if (!ubi->dbg->chk_io) 1200 if (!ubi_dbg_chk_io(ubi))
1201 return 0; 1201 return 0;
1202 1202
1203 ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS); 1203 ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS);
@@ -1241,7 +1241,7 @@ static int self_check_vid_hdr(const struct ubi_device *ubi, int pnum,
1241 int err; 1241 int err;
1242 uint32_t magic; 1242 uint32_t magic;
1243 1243
1244 if (!ubi->dbg->chk_io) 1244 if (!ubi_dbg_chk_io(ubi))
1245 return 0; 1245 return 0;
1246 1246
1247 magic = be32_to_cpu(vid_hdr->magic); 1247 magic = be32_to_cpu(vid_hdr->magic);
@@ -1282,7 +1282,7 @@ static int self_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum)
1282 struct ubi_vid_hdr *vid_hdr; 1282 struct ubi_vid_hdr *vid_hdr;
1283 void *p; 1283 void *p;
1284 1284
1285 if (!ubi->dbg->chk_io) 1285 if (!ubi_dbg_chk_io(ubi))
1286 return 0; 1286 return 0;
1287 1287
1288 vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS); 1288 vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS);
@@ -1334,7 +1334,7 @@ static int self_check_write(struct ubi_device *ubi, const void *buf, int pnum,
1334 void *buf1; 1334 void *buf1;
1335 loff_t addr = (loff_t)pnum * ubi->peb_size + offset; 1335 loff_t addr = (loff_t)pnum * ubi->peb_size + offset;
1336 1336
1337 if (!ubi->dbg->chk_io) 1337 if (!ubi_dbg_chk_io(ubi))
1338 return 0; 1338 return 0;
1339 1339
1340 buf1 = __vmalloc(len, GFP_NOFS, PAGE_KERNEL); 1340 buf1 = __vmalloc(len, GFP_NOFS, PAGE_KERNEL);
@@ -1398,7 +1398,7 @@ int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len)
1398 void *buf; 1398 void *buf;
1399 loff_t addr = (loff_t)pnum * ubi->peb_size + offset; 1399 loff_t addr = (loff_t)pnum * ubi->peb_size + offset;
1400 1400
1401 if (!ubi->dbg->chk_io) 1401 if (!ubi_dbg_chk_io(ubi))
1402 return 0; 1402 return 0;
1403 1403
1404 buf = __vmalloc(len, GFP_NOFS, PAGE_KERNEL); 1404 buf = __vmalloc(len, GFP_NOFS, PAGE_KERNEL);
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 99ef8a14e668..8330703c098f 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -847,7 +847,7 @@ static int self_check_volumes(struct ubi_device *ubi)
847{ 847{
848 int i, err = 0; 848 int i, err = 0;
849 849
850 if (!ubi->dbg->chk_gen) 850 if (!ubi_dbg_chk_gen(ubi))
851 return 0; 851 return 0;
852 852
853 for (i = 0; i < ubi->vtbl_slots; i++) { 853 for (i = 0; i < ubi->vtbl_slots; i++) {
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 926e3df14fb2..d77b1c1d7c72 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -858,7 +858,7 @@ out_free:
858 */ 858 */
859static void self_vtbl_check(const struct ubi_device *ubi) 859static void self_vtbl_check(const struct ubi_device *ubi)
860{ 860{
861 if (!ubi->dbg->chk_gen) 861 if (!ubi_dbg_chk_gen(ubi))
862 return; 862 return;
863 863
864 if (vtbl_check(ubi, ubi->vtbl)) { 864 if (vtbl_check(ubi, ubi->vtbl)) {
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index ae955174f6ef..c687538a8e3b 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -2043,7 +2043,7 @@ static int self_check_ec(struct ubi_device *ubi, int pnum, int ec)
2043 long long read_ec; 2043 long long read_ec;
2044 struct ubi_ec_hdr *ec_hdr; 2044 struct ubi_ec_hdr *ec_hdr;
2045 2045
2046 if (!ubi->dbg->chk_gen) 2046 if (!ubi_dbg_chk_gen(ubi))
2047 return 0; 2047 return 0;
2048 2048
2049 ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS); 2049 ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS);
@@ -2083,7 +2083,7 @@ out_free:
2083static int self_check_in_wl_tree(const struct ubi_device *ubi, 2083static int self_check_in_wl_tree(const struct ubi_device *ubi,
2084 struct ubi_wl_entry *e, struct rb_root *root) 2084 struct ubi_wl_entry *e, struct rb_root *root)
2085{ 2085{
2086 if (!ubi->dbg->chk_gen) 2086 if (!ubi_dbg_chk_gen(ubi))
2087 return 0; 2087 return 0;
2088 2088
2089 if (in_wl_tree(e, root)) 2089 if (in_wl_tree(e, root))
@@ -2109,7 +2109,7 @@ static int self_check_in_pq(const struct ubi_device *ubi,
2109 struct ubi_wl_entry *p; 2109 struct ubi_wl_entry *p;
2110 int i; 2110 int i;
2111 2111
2112 if (!ubi->dbg->chk_gen) 2112 if (!ubi_dbg_chk_gen(ubi))
2113 return 0; 2113 return 0;
2114 2114
2115 for (i = 0; i < UBI_PROT_QUEUE_LEN; ++i) 2115 for (i = 0; i < UBI_PROT_QUEUE_LEN; ++i)