diff options
author | Brian Norris <computersforpeace@gmail.com> | 2011-09-20 21:34:25 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-21 02:19:06 -0400 |
commit | d57f40544a41fdfe90fd863b6865138c5a82f1cc (patch) | |
tree | 4d5e8f6d0a62e8fa06ccfabd13fe9364b19db1b5 /drivers/mtd/tests | |
parent | 7387ce773256f446bdd0280b2449b635441f906e (diff) |
mtd: utilize `mtd_is_*()' functions
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Diffstat (limited to 'drivers/mtd/tests')
-rw-r--r-- | drivers/mtd/tests/mtd_pagetest.c | 28 | ||||
-rw-r--r-- | drivers/mtd/tests/mtd_readtest.c | 2 | ||||
-rw-r--r-- | drivers/mtd/tests/mtd_speedtest.c | 8 | ||||
-rw-r--r-- | drivers/mtd/tests/mtd_stresstest.c | 2 | ||||
-rw-r--r-- | drivers/mtd/tests/mtd_subpagetest.c | 8 | ||||
-rw-r--r-- | drivers/mtd/tests/mtd_torturetest.c | 2 |
6 files changed, 25 insertions, 25 deletions
diff --git a/drivers/mtd/tests/mtd_pagetest.c b/drivers/mtd/tests/mtd_pagetest.c index 00b937e38c1d..186b14c02307 100644 --- a/drivers/mtd/tests/mtd_pagetest.c +++ b/drivers/mtd/tests/mtd_pagetest.c | |||
@@ -128,7 +128,7 @@ static int verify_eraseblock(int ebnum) | |||
128 | for (j = 0; j < pgcnt - 1; ++j, addr += pgsize) { | 128 | for (j = 0; j < pgcnt - 1; ++j, addr += pgsize) { |
129 | /* Do a read to set the internal dataRAMs to different data */ | 129 | /* Do a read to set the internal dataRAMs to different data */ |
130 | err = mtd->read(mtd, addr0, bufsize, &read, twopages); | 130 | err = mtd->read(mtd, addr0, bufsize, &read, twopages); |
131 | if (err == -EUCLEAN) | 131 | if (mtd_is_bitflip(err)) |
132 | err = 0; | 132 | err = 0; |
133 | if (err || read != bufsize) { | 133 | if (err || read != bufsize) { |
134 | printk(PRINT_PREF "error: read failed at %#llx\n", | 134 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -136,7 +136,7 @@ static int verify_eraseblock(int ebnum) | |||
136 | return err; | 136 | return err; |
137 | } | 137 | } |
138 | err = mtd->read(mtd, addrn - bufsize, bufsize, &read, twopages); | 138 | err = mtd->read(mtd, addrn - bufsize, bufsize, &read, twopages); |
139 | if (err == -EUCLEAN) | 139 | if (mtd_is_bitflip(err)) |
140 | err = 0; | 140 | err = 0; |
141 | if (err || read != bufsize) { | 141 | if (err || read != bufsize) { |
142 | printk(PRINT_PREF "error: read failed at %#llx\n", | 142 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -146,7 +146,7 @@ static int verify_eraseblock(int ebnum) | |||
146 | memset(twopages, 0, bufsize); | 146 | memset(twopages, 0, bufsize); |
147 | read = 0; | 147 | read = 0; |
148 | err = mtd->read(mtd, addr, bufsize, &read, twopages); | 148 | err = mtd->read(mtd, addr, bufsize, &read, twopages); |
149 | if (err == -EUCLEAN) | 149 | if (mtd_is_bitflip(err)) |
150 | err = 0; | 150 | err = 0; |
151 | if (err || read != bufsize) { | 151 | if (err || read != bufsize) { |
152 | printk(PRINT_PREF "error: read failed at %#llx\n", | 152 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -164,7 +164,7 @@ static int verify_eraseblock(int ebnum) | |||
164 | unsigned long oldnext = next; | 164 | unsigned long oldnext = next; |
165 | /* Do a read to set the internal dataRAMs to different data */ | 165 | /* Do a read to set the internal dataRAMs to different data */ |
166 | err = mtd->read(mtd, addr0, bufsize, &read, twopages); | 166 | err = mtd->read(mtd, addr0, bufsize, &read, twopages); |
167 | if (err == -EUCLEAN) | 167 | if (mtd_is_bitflip(err)) |
168 | err = 0; | 168 | err = 0; |
169 | if (err || read != bufsize) { | 169 | if (err || read != bufsize) { |
170 | printk(PRINT_PREF "error: read failed at %#llx\n", | 170 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -172,7 +172,7 @@ static int verify_eraseblock(int ebnum) | |||
172 | return err; | 172 | return err; |
173 | } | 173 | } |
174 | err = mtd->read(mtd, addrn - bufsize, bufsize, &read, twopages); | 174 | err = mtd->read(mtd, addrn - bufsize, bufsize, &read, twopages); |
175 | if (err == -EUCLEAN) | 175 | if (mtd_is_bitflip(err)) |
176 | err = 0; | 176 | err = 0; |
177 | if (err || read != bufsize) { | 177 | if (err || read != bufsize) { |
178 | printk(PRINT_PREF "error: read failed at %#llx\n", | 178 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -182,7 +182,7 @@ static int verify_eraseblock(int ebnum) | |||
182 | memset(twopages, 0, bufsize); | 182 | memset(twopages, 0, bufsize); |
183 | read = 0; | 183 | read = 0; |
184 | err = mtd->read(mtd, addr, bufsize, &read, twopages); | 184 | err = mtd->read(mtd, addr, bufsize, &read, twopages); |
185 | if (err == -EUCLEAN) | 185 | if (mtd_is_bitflip(err)) |
186 | err = 0; | 186 | err = 0; |
187 | if (err || read != bufsize) { | 187 | if (err || read != bufsize) { |
188 | printk(PRINT_PREF "error: read failed at %#llx\n", | 188 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -231,7 +231,7 @@ static int crosstest(void) | |||
231 | read = 0; | 231 | read = 0; |
232 | addr = addrn - pgsize - pgsize; | 232 | addr = addrn - pgsize - pgsize; |
233 | err = mtd->read(mtd, addr, pgsize, &read, pp1); | 233 | err = mtd->read(mtd, addr, pgsize, &read, pp1); |
234 | if (err == -EUCLEAN) | 234 | if (mtd_is_bitflip(err)) |
235 | err = 0; | 235 | err = 0; |
236 | if (err || read != pgsize) { | 236 | if (err || read != pgsize) { |
237 | printk(PRINT_PREF "error: read failed at %#llx\n", | 237 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -244,7 +244,7 @@ static int crosstest(void) | |||
244 | read = 0; | 244 | read = 0; |
245 | addr = addrn - pgsize - pgsize - pgsize; | 245 | addr = addrn - pgsize - pgsize - pgsize; |
246 | err = mtd->read(mtd, addr, pgsize, &read, pp1); | 246 | err = mtd->read(mtd, addr, pgsize, &read, pp1); |
247 | if (err == -EUCLEAN) | 247 | if (mtd_is_bitflip(err)) |
248 | err = 0; | 248 | err = 0; |
249 | if (err || read != pgsize) { | 249 | if (err || read != pgsize) { |
250 | printk(PRINT_PREF "error: read failed at %#llx\n", | 250 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -258,7 +258,7 @@ static int crosstest(void) | |||
258 | addr = addr0; | 258 | addr = addr0; |
259 | printk(PRINT_PREF "reading page at %#llx\n", (long long)addr); | 259 | printk(PRINT_PREF "reading page at %#llx\n", (long long)addr); |
260 | err = mtd->read(mtd, addr, pgsize, &read, pp2); | 260 | err = mtd->read(mtd, addr, pgsize, &read, pp2); |
261 | if (err == -EUCLEAN) | 261 | if (mtd_is_bitflip(err)) |
262 | err = 0; | 262 | err = 0; |
263 | if (err || read != pgsize) { | 263 | if (err || read != pgsize) { |
264 | printk(PRINT_PREF "error: read failed at %#llx\n", | 264 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -272,7 +272,7 @@ static int crosstest(void) | |||
272 | addr = addrn - pgsize; | 272 | addr = addrn - pgsize; |
273 | printk(PRINT_PREF "reading page at %#llx\n", (long long)addr); | 273 | printk(PRINT_PREF "reading page at %#llx\n", (long long)addr); |
274 | err = mtd->read(mtd, addr, pgsize, &read, pp3); | 274 | err = mtd->read(mtd, addr, pgsize, &read, pp3); |
275 | if (err == -EUCLEAN) | 275 | if (mtd_is_bitflip(err)) |
276 | err = 0; | 276 | err = 0; |
277 | if (err || read != pgsize) { | 277 | if (err || read != pgsize) { |
278 | printk(PRINT_PREF "error: read failed at %#llx\n", | 278 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -286,7 +286,7 @@ static int crosstest(void) | |||
286 | addr = addr0; | 286 | addr = addr0; |
287 | printk(PRINT_PREF "reading page at %#llx\n", (long long)addr); | 287 | printk(PRINT_PREF "reading page at %#llx\n", (long long)addr); |
288 | err = mtd->read(mtd, addr, pgsize, &read, pp4); | 288 | err = mtd->read(mtd, addr, pgsize, &read, pp4); |
289 | if (err == -EUCLEAN) | 289 | if (mtd_is_bitflip(err)) |
290 | err = 0; | 290 | err = 0; |
291 | if (err || read != pgsize) { | 291 | if (err || read != pgsize) { |
292 | printk(PRINT_PREF "error: read failed at %#llx\n", | 292 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -345,7 +345,7 @@ static int erasecrosstest(void) | |||
345 | printk(PRINT_PREF "reading 1st page of block %d\n", ebnum); | 345 | printk(PRINT_PREF "reading 1st page of block %d\n", ebnum); |
346 | memset(readbuf, 0, pgsize); | 346 | memset(readbuf, 0, pgsize); |
347 | err = mtd->read(mtd, addr0, pgsize, &read, readbuf); | 347 | err = mtd->read(mtd, addr0, pgsize, &read, readbuf); |
348 | if (err == -EUCLEAN) | 348 | if (mtd_is_bitflip(err)) |
349 | err = 0; | 349 | err = 0; |
350 | if (err || read != pgsize) { | 350 | if (err || read != pgsize) { |
351 | printk(PRINT_PREF "error: read failed at %#llx\n", | 351 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -383,7 +383,7 @@ static int erasecrosstest(void) | |||
383 | printk(PRINT_PREF "reading 1st page of block %d\n", ebnum); | 383 | printk(PRINT_PREF "reading 1st page of block %d\n", ebnum); |
384 | memset(readbuf, 0, pgsize); | 384 | memset(readbuf, 0, pgsize); |
385 | err = mtd->read(mtd, addr0, pgsize, &read, readbuf); | 385 | err = mtd->read(mtd, addr0, pgsize, &read, readbuf); |
386 | if (err == -EUCLEAN) | 386 | if (mtd_is_bitflip(err)) |
387 | err = 0; | 387 | err = 0; |
388 | if (err || read != pgsize) { | 388 | if (err || read != pgsize) { |
389 | printk(PRINT_PREF "error: read failed at %#llx\n", | 389 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -439,7 +439,7 @@ static int erasetest(void) | |||
439 | 439 | ||
440 | printk(PRINT_PREF "reading 1st page of block %d\n", ebnum); | 440 | printk(PRINT_PREF "reading 1st page of block %d\n", ebnum); |
441 | err = mtd->read(mtd, addr0, pgsize, &read, twopages); | 441 | err = mtd->read(mtd, addr0, pgsize, &read, twopages); |
442 | if (err == -EUCLEAN) | 442 | if (mtd_is_bitflip(err)) |
443 | err = 0; | 443 | err = 0; |
444 | if (err || read != pgsize) { | 444 | if (err || read != pgsize) { |
445 | printk(PRINT_PREF "error: read failed at %#llx\n", | 445 | printk(PRINT_PREF "error: read failed at %#llx\n", |
diff --git a/drivers/mtd/tests/mtd_readtest.c b/drivers/mtd/tests/mtd_readtest.c index 587e1e371c6c..756045345f00 100644 --- a/drivers/mtd/tests/mtd_readtest.c +++ b/drivers/mtd/tests/mtd_readtest.c | |||
@@ -75,7 +75,7 @@ static int read_eraseblock_by_page(int ebnum) | |||
75 | ops.datbuf = NULL; | 75 | ops.datbuf = NULL; |
76 | ops.oobbuf = oobbuf; | 76 | ops.oobbuf = oobbuf; |
77 | ret = mtd->read_oob(mtd, addr, &ops); | 77 | ret = mtd->read_oob(mtd, addr, &ops); |
78 | if ((ret && ret != -EUCLEAN) || | 78 | if ((ret && !mtd_is_bitflip(ret)) || |
79 | ops.oobretlen != mtd->oobsize) { | 79 | ops.oobretlen != mtd->oobsize) { |
80 | printk(PRINT_PREF "error: read oob failed at " | 80 | printk(PRINT_PREF "error: read oob failed at " |
81 | "%#llx\n", (long long)addr); | 81 | "%#llx\n", (long long)addr); |
diff --git a/drivers/mtd/tests/mtd_speedtest.c b/drivers/mtd/tests/mtd_speedtest.c index 627d4e2466a3..79d53ee62295 100644 --- a/drivers/mtd/tests/mtd_speedtest.c +++ b/drivers/mtd/tests/mtd_speedtest.c | |||
@@ -216,7 +216,7 @@ static int read_eraseblock(int ebnum) | |||
216 | 216 | ||
217 | err = mtd->read(mtd, addr, mtd->erasesize, &read, iobuf); | 217 | err = mtd->read(mtd, addr, mtd->erasesize, &read, iobuf); |
218 | /* Ignore corrected ECC errors */ | 218 | /* Ignore corrected ECC errors */ |
219 | if (err == -EUCLEAN) | 219 | if (mtd_is_bitflip(err)) |
220 | err = 0; | 220 | err = 0; |
221 | if (err || read != mtd->erasesize) { | 221 | if (err || read != mtd->erasesize) { |
222 | printk(PRINT_PREF "error: read failed at %#llx\n", addr); | 222 | printk(PRINT_PREF "error: read failed at %#llx\n", addr); |
@@ -237,7 +237,7 @@ static int read_eraseblock_by_page(int ebnum) | |||
237 | for (i = 0; i < pgcnt; i++) { | 237 | for (i = 0; i < pgcnt; i++) { |
238 | err = mtd->read(mtd, addr, pgsize, &read, buf); | 238 | err = mtd->read(mtd, addr, pgsize, &read, buf); |
239 | /* Ignore corrected ECC errors */ | 239 | /* Ignore corrected ECC errors */ |
240 | if (err == -EUCLEAN) | 240 | if (mtd_is_bitflip(err)) |
241 | err = 0; | 241 | err = 0; |
242 | if (err || read != pgsize) { | 242 | if (err || read != pgsize) { |
243 | printk(PRINT_PREF "error: read failed at %#llx\n", | 243 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -263,7 +263,7 @@ static int read_eraseblock_by_2pages(int ebnum) | |||
263 | for (i = 0; i < n; i++) { | 263 | for (i = 0; i < n; i++) { |
264 | err = mtd->read(mtd, addr, sz, &read, buf); | 264 | err = mtd->read(mtd, addr, sz, &read, buf); |
265 | /* Ignore corrected ECC errors */ | 265 | /* Ignore corrected ECC errors */ |
266 | if (err == -EUCLEAN) | 266 | if (mtd_is_bitflip(err)) |
267 | err = 0; | 267 | err = 0; |
268 | if (err || read != sz) { | 268 | if (err || read != sz) { |
269 | printk(PRINT_PREF "error: read failed at %#llx\n", | 269 | printk(PRINT_PREF "error: read failed at %#llx\n", |
@@ -278,7 +278,7 @@ static int read_eraseblock_by_2pages(int ebnum) | |||
278 | if (pgcnt % 2) { | 278 | if (pgcnt % 2) { |
279 | err = mtd->read(mtd, addr, pgsize, &read, buf); | 279 | err = mtd->read(mtd, addr, pgsize, &read, buf); |
280 | /* Ignore corrected ECC errors */ | 280 | /* Ignore corrected ECC errors */ |
281 | if (err == -EUCLEAN) | 281 | if (mtd_is_bitflip(err)) |
282 | err = 0; | 282 | err = 0; |
283 | if (err || read != pgsize) { | 283 | if (err || read != pgsize) { |
284 | printk(PRINT_PREF "error: read failed at %#llx\n", | 284 | printk(PRINT_PREF "error: read failed at %#llx\n", |
diff --git a/drivers/mtd/tests/mtd_stresstest.c b/drivers/mtd/tests/mtd_stresstest.c index 531625fc9259..3c9008adbe3b 100644 --- a/drivers/mtd/tests/mtd_stresstest.c +++ b/drivers/mtd/tests/mtd_stresstest.c | |||
@@ -154,7 +154,7 @@ static int do_read(void) | |||
154 | } | 154 | } |
155 | addr = eb * mtd->erasesize + offs; | 155 | addr = eb * mtd->erasesize + offs; |
156 | err = mtd->read(mtd, addr, len, &read, readbuf); | 156 | err = mtd->read(mtd, addr, len, &read, readbuf); |
157 | if (err == -EUCLEAN) | 157 | if (mtd_is_bitflip(err)) |
158 | err = 0; | 158 | err = 0; |
159 | if (unlikely(err || read != len)) { | 159 | if (unlikely(err || read != len)) { |
160 | printk(PRINT_PREF "error: read failed at 0x%llx\n", | 160 | printk(PRINT_PREF "error: read failed at 0x%llx\n", |
diff --git a/drivers/mtd/tests/mtd_subpagetest.c b/drivers/mtd/tests/mtd_subpagetest.c index 334eae53a3db..2b51842d08fa 100644 --- a/drivers/mtd/tests/mtd_subpagetest.c +++ b/drivers/mtd/tests/mtd_subpagetest.c | |||
@@ -198,7 +198,7 @@ static int verify_eraseblock(int ebnum) | |||
198 | read = 0; | 198 | read = 0; |
199 | err = mtd->read(mtd, addr, subpgsize, &read, readbuf); | 199 | err = mtd->read(mtd, addr, subpgsize, &read, readbuf); |
200 | if (unlikely(err || read != subpgsize)) { | 200 | if (unlikely(err || read != subpgsize)) { |
201 | if (err == -EUCLEAN && read == subpgsize) { | 201 | if (mtd_is_bitflip(err) && read == subpgsize) { |
202 | printk(PRINT_PREF "ECC correction at %#llx\n", | 202 | printk(PRINT_PREF "ECC correction at %#llx\n", |
203 | (long long)addr); | 203 | (long long)addr); |
204 | err = 0; | 204 | err = 0; |
@@ -226,7 +226,7 @@ static int verify_eraseblock(int ebnum) | |||
226 | read = 0; | 226 | read = 0; |
227 | err = mtd->read(mtd, addr, subpgsize, &read, readbuf); | 227 | err = mtd->read(mtd, addr, subpgsize, &read, readbuf); |
228 | if (unlikely(err || read != subpgsize)) { | 228 | if (unlikely(err || read != subpgsize)) { |
229 | if (err == -EUCLEAN && read == subpgsize) { | 229 | if (mtd_is_bitflip(err) && read == subpgsize) { |
230 | printk(PRINT_PREF "ECC correction at %#llx\n", | 230 | printk(PRINT_PREF "ECC correction at %#llx\n", |
231 | (long long)addr); | 231 | (long long)addr); |
232 | err = 0; | 232 | err = 0; |
@@ -264,7 +264,7 @@ static int verify_eraseblock2(int ebnum) | |||
264 | read = 0; | 264 | read = 0; |
265 | err = mtd->read(mtd, addr, subpgsize * k, &read, readbuf); | 265 | err = mtd->read(mtd, addr, subpgsize * k, &read, readbuf); |
266 | if (unlikely(err || read != subpgsize * k)) { | 266 | if (unlikely(err || read != subpgsize * k)) { |
267 | if (err == -EUCLEAN && read == subpgsize * k) { | 267 | if (mtd_is_bitflip(err) && read == subpgsize * k) { |
268 | printk(PRINT_PREF "ECC correction at %#llx\n", | 268 | printk(PRINT_PREF "ECC correction at %#llx\n", |
269 | (long long)addr); | 269 | (long long)addr); |
270 | err = 0; | 270 | err = 0; |
@@ -298,7 +298,7 @@ static int verify_eraseblock_ff(int ebnum) | |||
298 | read = 0; | 298 | read = 0; |
299 | err = mtd->read(mtd, addr, subpgsize, &read, readbuf); | 299 | err = mtd->read(mtd, addr, subpgsize, &read, readbuf); |
300 | if (unlikely(err || read != subpgsize)) { | 300 | if (unlikely(err || read != subpgsize)) { |
301 | if (err == -EUCLEAN && read == subpgsize) { | 301 | if (mtd_is_bitflip(err) && read == subpgsize) { |
302 | printk(PRINT_PREF "ECC correction at %#llx\n", | 302 | printk(PRINT_PREF "ECC correction at %#llx\n", |
303 | (long long)addr); | 303 | (long long)addr); |
304 | err = 0; | 304 | err = 0; |
diff --git a/drivers/mtd/tests/mtd_torturetest.c b/drivers/mtd/tests/mtd_torturetest.c index 5c6c3d248901..25786ce97c8e 100644 --- a/drivers/mtd/tests/mtd_torturetest.c +++ b/drivers/mtd/tests/mtd_torturetest.c | |||
@@ -138,7 +138,7 @@ static inline int check_eraseblock(int ebnum, unsigned char *buf) | |||
138 | 138 | ||
139 | retry: | 139 | retry: |
140 | err = mtd->read(mtd, addr, len, &read, check_buf); | 140 | err = mtd->read(mtd, addr, len, &read, check_buf); |
141 | if (err == -EUCLEAN) | 141 | if (mtd_is_bitflip(err)) |
142 | printk(PRINT_PREF "single bit flip occurred at EB %d " | 142 | printk(PRINT_PREF "single bit flip occurred at EB %d " |
143 | "MTD reported that it was fixed.\n", ebnum); | 143 | "MTD reported that it was fixed.\n", ebnum); |
144 | else if (err) { | 144 | else if (err) { |