aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/tests
diff options
context:
space:
mode:
authorVikram Narayanan <vikram186@gmail.com>2012-10-10 13:42:02 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-11-15 08:37:49 -0500
commit04810274a982009ab26e2f15c32149c184e9e8e5 (patch)
tree3c489a21f5058be089a0c17dbc162c1d8b92cc26 /drivers/mtd/tests
parent95637c3a0e2db200fd4030e7ed5f1138d81f16ae (diff)
mtd: mtd_oobtest: printk -> pr_{info,err,crit}
Use pr_info() and pr_err() while defining pr_fmt(). This saves a few characters, joins a few lines, and makes the code a little more readable (and grep-able). Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Vikram Narayanan <vikram186@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd/tests')
-rw-r--r--drivers/mtd/tests/mtd_oobtest.c171
1 files changed, 84 insertions, 87 deletions
diff --git a/drivers/mtd/tests/mtd_oobtest.c b/drivers/mtd/tests/mtd_oobtest.c
index ed9b62827f1..e86bb29419a 100644
--- a/drivers/mtd/tests/mtd_oobtest.c
+++ b/drivers/mtd/tests/mtd_oobtest.c
@@ -19,6 +19,8 @@
19 * Author: Adrian Hunter <ext-adrian.hunter@nokia.com> 19 * Author: Adrian Hunter <ext-adrian.hunter@nokia.com>
20 */ 20 */
21 21
22#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23
22#include <asm/div64.h> 24#include <asm/div64.h>
23#include <linux/init.h> 25#include <linux/init.h>
24#include <linux/module.h> 26#include <linux/module.h>
@@ -28,8 +30,6 @@
28#include <linux/slab.h> 30#include <linux/slab.h>
29#include <linux/sched.h> 31#include <linux/sched.h>
30 32
31#define PRINT_PREF KERN_INFO "mtd_oobtest: "
32
33static int dev = -EINVAL; 33static int dev = -EINVAL;
34module_param(dev, int, S_IRUGO); 34module_param(dev, int, S_IRUGO);
35MODULE_PARM_DESC(dev, "MTD device number to use"); 35MODULE_PARM_DESC(dev, "MTD device number to use");
@@ -80,13 +80,12 @@ static int erase_eraseblock(int ebnum)
80 80
81 err = mtd_erase(mtd, &ei); 81 err = mtd_erase(mtd, &ei);
82 if (err) { 82 if (err) {
83 printk(PRINT_PREF "error %d while erasing EB %d\n", err, ebnum); 83 pr_err("error %d while erasing EB %d\n", err, ebnum);
84 return err; 84 return err;
85 } 85 }
86 86
87 if (ei.state == MTD_ERASE_FAILED) { 87 if (ei.state == MTD_ERASE_FAILED) {
88 printk(PRINT_PREF "some erase error occurred at EB %d\n", 88 pr_err("some erase error occurred at EB %d\n", ebnum);
89 ebnum);
90 return -EIO; 89 return -EIO;
91 } 90 }
92 91
@@ -98,7 +97,7 @@ static int erase_whole_device(void)
98 int err; 97 int err;
99 unsigned int i; 98 unsigned int i;
100 99
101 printk(PRINT_PREF "erasing whole device\n"); 100 pr_info("erasing whole device\n");
102 for (i = 0; i < ebcnt; ++i) { 101 for (i = 0; i < ebcnt; ++i) {
103 if (bbt[i]) 102 if (bbt[i])
104 continue; 103 continue;
@@ -107,7 +106,7 @@ static int erase_whole_device(void)
107 return err; 106 return err;
108 cond_resched(); 107 cond_resched();
109 } 108 }
110 printk(PRINT_PREF "erased %u eraseblocks\n", i); 109 pr_info("erased %u eraseblocks\n", i);
111 return 0; 110 return 0;
112} 111}
113 112
@@ -141,9 +140,9 @@ static int write_eraseblock(int ebnum)
141 ops.oobbuf = writebuf; 140 ops.oobbuf = writebuf;
142 err = mtd_write_oob(mtd, addr, &ops); 141 err = mtd_write_oob(mtd, addr, &ops);
143 if (err || ops.oobretlen != use_len) { 142 if (err || ops.oobretlen != use_len) {
144 printk(PRINT_PREF "error: writeoob failed at %#llx\n", 143 pr_err("error: writeoob failed at %#llx\n",
145 (long long)addr); 144 (long long)addr);
146 printk(PRINT_PREF "error: use_len %d, use_offset %d\n", 145 pr_err("error: use_len %d, use_offset %d\n",
147 use_len, use_offset); 146 use_len, use_offset);
148 errcnt += 1; 147 errcnt += 1;
149 return err ? err : -1; 148 return err ? err : -1;
@@ -160,7 +159,7 @@ static int write_whole_device(void)
160 int err; 159 int err;
161 unsigned int i; 160 unsigned int i;
162 161
163 printk(PRINT_PREF "writing OOBs of whole device\n"); 162 pr_info("writing OOBs of whole device\n");
164 for (i = 0; i < ebcnt; ++i) { 163 for (i = 0; i < ebcnt; ++i) {
165 if (bbt[i]) 164 if (bbt[i])
166 continue; 165 continue;
@@ -168,10 +167,10 @@ static int write_whole_device(void)
168 if (err) 167 if (err)
169 return err; 168 return err;
170 if (i % 256 == 0) 169 if (i % 256 == 0)
171 printk(PRINT_PREF "written up to eraseblock %u\n", i); 170 pr_info("written up to eraseblock %u\n", i);
172 cond_resched(); 171 cond_resched();
173 } 172 }
174 printk(PRINT_PREF "written %u eraseblocks\n", i); 173 pr_info("written %u eraseblocks\n", i);
175 return 0; 174 return 0;
176} 175}
177 176
@@ -194,17 +193,17 @@ static int verify_eraseblock(int ebnum)
194 ops.oobbuf = readbuf; 193 ops.oobbuf = readbuf;
195 err = mtd_read_oob(mtd, addr, &ops); 194 err = mtd_read_oob(mtd, addr, &ops);
196 if (err || ops.oobretlen != use_len) { 195 if (err || ops.oobretlen != use_len) {
197 printk(PRINT_PREF "error: readoob failed at %#llx\n", 196 pr_err("error: readoob failed at %#llx\n",
198 (long long)addr); 197 (long long)addr);
199 errcnt += 1; 198 errcnt += 1;
200 return err ? err : -1; 199 return err ? err : -1;
201 } 200 }
202 if (memcmp(readbuf, writebuf, use_len)) { 201 if (memcmp(readbuf, writebuf, use_len)) {
203 printk(PRINT_PREF "error: verify failed at %#llx\n", 202 pr_err("error: verify failed at %#llx\n",
204 (long long)addr); 203 (long long)addr);
205 errcnt += 1; 204 errcnt += 1;
206 if (errcnt > 1000) { 205 if (errcnt > 1000) {
207 printk(PRINT_PREF "error: too many errors\n"); 206 pr_err("error: too many errors\n");
208 return -1; 207 return -1;
209 } 208 }
210 } 209 }
@@ -221,29 +220,28 @@ static int verify_eraseblock(int ebnum)
221 ops.oobbuf = readbuf; 220 ops.oobbuf = readbuf;
222 err = mtd_read_oob(mtd, addr, &ops); 221 err = mtd_read_oob(mtd, addr, &ops);
223 if (err || ops.oobretlen != mtd->ecclayout->oobavail) { 222 if (err || ops.oobretlen != mtd->ecclayout->oobavail) {
224 printk(PRINT_PREF "error: readoob failed at " 223 pr_err("error: readoob failed at %#llx\n",
225 "%#llx\n", (long long)addr); 224 (long long)addr);
226 errcnt += 1; 225 errcnt += 1;
227 return err ? err : -1; 226 return err ? err : -1;
228 } 227 }
229 if (memcmp(readbuf + use_offset, writebuf, use_len)) { 228 if (memcmp(readbuf + use_offset, writebuf, use_len)) {
230 printk(PRINT_PREF "error: verify failed at " 229 pr_err("error: verify failed at %#llx\n",
231 "%#llx\n", (long long)addr); 230 (long long)addr);
232 errcnt += 1; 231 errcnt += 1;
233 if (errcnt > 1000) { 232 if (errcnt > 1000) {
234 printk(PRINT_PREF "error: too many " 233 pr_err("error: too many errors\n");
235 "errors\n");
236 return -1; 234 return -1;
237 } 235 }
238 } 236 }
239 for (k = 0; k < use_offset; ++k) 237 for (k = 0; k < use_offset; ++k)
240 if (readbuf[k] != 0xff) { 238 if (readbuf[k] != 0xff) {
241 printk(PRINT_PREF "error: verify 0xff " 239 pr_err("error: verify 0xff "
242 "failed at %#llx\n", 240 "failed at %#llx\n",
243 (long long)addr); 241 (long long)addr);
244 errcnt += 1; 242 errcnt += 1;
245 if (errcnt > 1000) { 243 if (errcnt > 1000) {
246 printk(PRINT_PREF "error: too " 244 pr_err("error: too "
247 "many errors\n"); 245 "many errors\n");
248 return -1; 246 return -1;
249 } 247 }
@@ -251,12 +249,12 @@ static int verify_eraseblock(int ebnum)
251 for (k = use_offset + use_len; 249 for (k = use_offset + use_len;
252 k < mtd->ecclayout->oobavail; ++k) 250 k < mtd->ecclayout->oobavail; ++k)
253 if (readbuf[k] != 0xff) { 251 if (readbuf[k] != 0xff) {
254 printk(PRINT_PREF "error: verify 0xff " 252 pr_err("error: verify 0xff "
255 "failed at %#llx\n", 253 "failed at %#llx\n",
256 (long long)addr); 254 (long long)addr);
257 errcnt += 1; 255 errcnt += 1;
258 if (errcnt > 1000) { 256 if (errcnt > 1000) {
259 printk(PRINT_PREF "error: too " 257 pr_err("error: too "
260 "many errors\n"); 258 "many errors\n");
261 return -1; 259 return -1;
262 } 260 }
@@ -286,17 +284,17 @@ static int verify_eraseblock_in_one_go(int ebnum)
286 ops.oobbuf = readbuf; 284 ops.oobbuf = readbuf;
287 err = mtd_read_oob(mtd, addr, &ops); 285 err = mtd_read_oob(mtd, addr, &ops);
288 if (err || ops.oobretlen != len) { 286 if (err || ops.oobretlen != len) {
289 printk(PRINT_PREF "error: readoob failed at %#llx\n", 287 pr_err("error: readoob failed at %#llx\n",
290 (long long)addr); 288 (long long)addr);
291 errcnt += 1; 289 errcnt += 1;
292 return err ? err : -1; 290 return err ? err : -1;
293 } 291 }
294 if (memcmp(readbuf, writebuf, len)) { 292 if (memcmp(readbuf, writebuf, len)) {
295 printk(PRINT_PREF "error: verify failed at %#llx\n", 293 pr_err("error: verify failed at %#llx\n",
296 (long long)addr); 294 (long long)addr);
297 errcnt += 1; 295 errcnt += 1;
298 if (errcnt > 1000) { 296 if (errcnt > 1000) {
299 printk(PRINT_PREF "error: too many errors\n"); 297 pr_err("error: too many errors\n");
300 return -1; 298 return -1;
301 } 299 }
302 } 300 }
@@ -309,7 +307,7 @@ static int verify_all_eraseblocks(void)
309 int err; 307 int err;
310 unsigned int i; 308 unsigned int i;
311 309
312 printk(PRINT_PREF "verifying all eraseblocks\n"); 310 pr_info("verifying all eraseblocks\n");
313 for (i = 0; i < ebcnt; ++i) { 311 for (i = 0; i < ebcnt; ++i) {
314 if (bbt[i]) 312 if (bbt[i])
315 continue; 313 continue;
@@ -317,10 +315,10 @@ static int verify_all_eraseblocks(void)
317 if (err) 315 if (err)
318 return err; 316 return err;
319 if (i % 256 == 0) 317 if (i % 256 == 0)
320 printk(PRINT_PREF "verified up to eraseblock %u\n", i); 318 pr_info("verified up to eraseblock %u\n", i);
321 cond_resched(); 319 cond_resched();
322 } 320 }
323 printk(PRINT_PREF "verified %u eraseblocks\n", i); 321 pr_info("verified %u eraseblocks\n", i);
324 return 0; 322 return 0;
325} 323}
326 324
@@ -331,7 +329,7 @@ static int is_block_bad(int ebnum)
331 329
332 ret = mtd_block_isbad(mtd, addr); 330 ret = mtd_block_isbad(mtd, addr);
333 if (ret) 331 if (ret)
334 printk(PRINT_PREF "block %d is bad\n", ebnum); 332 pr_info("block %d is bad\n", ebnum);
335 return ret; 333 return ret;
336} 334}
337 335
@@ -341,18 +339,18 @@ static int scan_for_bad_eraseblocks(void)
341 339
342 bbt = kmalloc(ebcnt, GFP_KERNEL); 340 bbt = kmalloc(ebcnt, GFP_KERNEL);
343 if (!bbt) { 341 if (!bbt) {
344 printk(PRINT_PREF "error: cannot allocate memory\n"); 342 pr_err("error: cannot allocate memory\n");
345 return -ENOMEM; 343 return -ENOMEM;
346 } 344 }
347 345
348 printk(PRINT_PREF "scanning for bad eraseblocks\n"); 346 pr_info("scanning for bad eraseblocks\n");
349 for (i = 0; i < ebcnt; ++i) { 347 for (i = 0; i < ebcnt; ++i) {
350 bbt[i] = is_block_bad(i) ? 1 : 0; 348 bbt[i] = is_block_bad(i) ? 1 : 0;
351 if (bbt[i]) 349 if (bbt[i])
352 bad += 1; 350 bad += 1;
353 cond_resched(); 351 cond_resched();
354 } 352 }
355 printk(PRINT_PREF "scanned %d eraseblocks, %d are bad\n", i, bad); 353 pr_info("scanned %d eraseblocks, %d are bad\n", i, bad);
356 return 0; 354 return 0;
357} 355}
358 356
@@ -368,22 +366,22 @@ static int __init mtd_oobtest_init(void)
368 printk(KERN_INFO "=================================================\n"); 366 printk(KERN_INFO "=================================================\n");
369 367
370 if (dev < 0) { 368 if (dev < 0) {
371 printk(PRINT_PREF "Please specify a valid mtd-device via module paramter\n"); 369 pr_info("Please specify a valid mtd-device via module paramter\n");
372 printk(KERN_CRIT "CAREFUL: This test wipes all data on the specified MTD device!\n"); 370 pr_crit(KERN_CRIT "CAREFUL: This test wipes all data on the specified MTD device!\n");
373 return -EINVAL; 371 return -EINVAL;
374 } 372 }
375 373
376 printk(PRINT_PREF "MTD device: %d\n", dev); 374 pr_info("MTD device: %d\n", dev);
377 375
378 mtd = get_mtd_device(NULL, dev); 376 mtd = get_mtd_device(NULL, dev);
379 if (IS_ERR(mtd)) { 377 if (IS_ERR(mtd)) {
380 err = PTR_ERR(mtd); 378 err = PTR_ERR(mtd);
381 printk(PRINT_PREF "error: cannot get MTD device\n"); 379 pr_err("error: cannot get MTD device\n");
382 return err; 380 return err;
383 } 381 }
384 382
385 if (mtd->type != MTD_NANDFLASH) { 383 if (mtd->type != MTD_NANDFLASH) {
386 printk(PRINT_PREF "this test requires NAND flash\n"); 384 pr_info("this test requires NAND flash\n");
387 goto out; 385 goto out;
388 } 386 }
389 387
@@ -392,7 +390,7 @@ static int __init mtd_oobtest_init(void)
392 ebcnt = tmp; 390 ebcnt = tmp;
393 pgcnt = mtd->erasesize / mtd->writesize; 391 pgcnt = mtd->erasesize / mtd->writesize;
394 392
395 printk(PRINT_PREF "MTD device size %llu, eraseblock size %u, " 393 pr_info("MTD device size %llu, eraseblock size %u, "
396 "page size %u, count of eraseblocks %u, pages per " 394 "page size %u, count of eraseblocks %u, pages per "
397 "eraseblock %u, OOB size %u\n", 395 "eraseblock %u, OOB size %u\n",
398 (unsigned long long)mtd->size, mtd->erasesize, 396 (unsigned long long)mtd->size, mtd->erasesize,
@@ -401,12 +399,12 @@ static int __init mtd_oobtest_init(void)
401 err = -ENOMEM; 399 err = -ENOMEM;
402 readbuf = kmalloc(mtd->erasesize, GFP_KERNEL); 400 readbuf = kmalloc(mtd->erasesize, GFP_KERNEL);
403 if (!readbuf) { 401 if (!readbuf) {
404 printk(PRINT_PREF "error: cannot allocate memory\n"); 402 pr_err("error: cannot allocate memory\n");
405 goto out; 403 goto out;
406 } 404 }
407 writebuf = kmalloc(mtd->erasesize, GFP_KERNEL); 405 writebuf = kmalloc(mtd->erasesize, GFP_KERNEL);
408 if (!writebuf) { 406 if (!writebuf) {
409 printk(PRINT_PREF "error: cannot allocate memory\n"); 407 pr_err("error: cannot allocate memory\n");
410 goto out; 408 goto out;
411 } 409 }
412 410
@@ -420,7 +418,7 @@ static int __init mtd_oobtest_init(void)
420 vary_offset = 0; 418 vary_offset = 0;
421 419
422 /* First test: write all OOB, read it back and verify */ 420 /* First test: write all OOB, read it back and verify */
423 printk(PRINT_PREF "test 1 of 5\n"); 421 pr_info("test 1 of 5\n");
424 422
425 err = erase_whole_device(); 423 err = erase_whole_device();
426 if (err) 424 if (err)
@@ -440,7 +438,7 @@ static int __init mtd_oobtest_init(void)
440 * Second test: write all OOB, a block at a time, read it back and 438 * Second test: write all OOB, a block at a time, read it back and
441 * verify. 439 * verify.
442 */ 440 */
443 printk(PRINT_PREF "test 2 of 5\n"); 441 pr_info("test 2 of 5\n");
444 442
445 err = erase_whole_device(); 443 err = erase_whole_device();
446 if (err) 444 if (err)
@@ -453,7 +451,7 @@ static int __init mtd_oobtest_init(void)
453 451
454 /* Check all eraseblocks */ 452 /* Check all eraseblocks */
455 simple_srand(3); 453 simple_srand(3);
456 printk(PRINT_PREF "verifying all eraseblocks\n"); 454 pr_info("verifying all eraseblocks\n");
457 for (i = 0; i < ebcnt; ++i) { 455 for (i = 0; i < ebcnt; ++i) {
458 if (bbt[i]) 456 if (bbt[i])
459 continue; 457 continue;
@@ -461,16 +459,16 @@ static int __init mtd_oobtest_init(void)
461 if (err) 459 if (err)
462 goto out; 460 goto out;
463 if (i % 256 == 0) 461 if (i % 256 == 0)
464 printk(PRINT_PREF "verified up to eraseblock %u\n", i); 462 pr_info("verified up to eraseblock %u\n", i);
465 cond_resched(); 463 cond_resched();
466 } 464 }
467 printk(PRINT_PREF "verified %u eraseblocks\n", i); 465 pr_info("verified %u eraseblocks\n", i);
468 466
469 /* 467 /*
470 * Third test: write OOB at varying offsets and lengths, read it back 468 * Third test: write OOB at varying offsets and lengths, read it back
471 * and verify. 469 * and verify.
472 */ 470 */
473 printk(PRINT_PREF "test 3 of 5\n"); 471 pr_info("test 3 of 5\n");
474 472
475 err = erase_whole_device(); 473 err = erase_whole_device();
476 if (err) 474 if (err)
@@ -503,7 +501,7 @@ static int __init mtd_oobtest_init(void)
503 vary_offset = 0; 501 vary_offset = 0;
504 502
505 /* Fourth test: try to write off end of device */ 503 /* Fourth test: try to write off end of device */
506 printk(PRINT_PREF "test 4 of 5\n"); 504 pr_info("test 4 of 5\n");
507 505
508 err = erase_whole_device(); 506 err = erase_whole_device();
509 if (err) 507 if (err)
@@ -522,14 +520,14 @@ static int __init mtd_oobtest_init(void)
522 ops.ooboffs = mtd->ecclayout->oobavail; 520 ops.ooboffs = mtd->ecclayout->oobavail;
523 ops.datbuf = NULL; 521 ops.datbuf = NULL;
524 ops.oobbuf = writebuf; 522 ops.oobbuf = writebuf;
525 printk(PRINT_PREF "attempting to start write past end of OOB\n"); 523 pr_info("attempting to start write past end of OOB\n");
526 printk(PRINT_PREF "an error is expected...\n"); 524 pr_info("an error is expected...\n");
527 err = mtd_write_oob(mtd, addr0, &ops); 525 err = mtd_write_oob(mtd, addr0, &ops);
528 if (err) { 526 if (err) {
529 printk(PRINT_PREF "error occurred as expected\n"); 527 pr_info("error occurred as expected\n");
530 err = 0; 528 err = 0;
531 } else { 529 } else {
532 printk(PRINT_PREF "error: can write past end of OOB\n"); 530 pr_err("error: can write past end of OOB\n");
533 errcnt += 1; 531 errcnt += 1;
534 } 532 }
535 533
@@ -542,19 +540,19 @@ static int __init mtd_oobtest_init(void)
542 ops.ooboffs = mtd->ecclayout->oobavail; 540 ops.ooboffs = mtd->ecclayout->oobavail;
543 ops.datbuf = NULL; 541 ops.datbuf = NULL;
544 ops.oobbuf = readbuf; 542 ops.oobbuf = readbuf;
545 printk(PRINT_PREF "attempting to start read past end of OOB\n"); 543 pr_info("attempting to start read past end of OOB\n");
546 printk(PRINT_PREF "an error is expected...\n"); 544 pr_info("an error is expected...\n");
547 err = mtd_read_oob(mtd, addr0, &ops); 545 err = mtd_read_oob(mtd, addr0, &ops);
548 if (err) { 546 if (err) {
549 printk(PRINT_PREF "error occurred as expected\n"); 547 pr_info("error occurred as expected\n");
550 err = 0; 548 err = 0;
551 } else { 549 } else {
552 printk(PRINT_PREF "error: can read past end of OOB\n"); 550 pr_err("error: can read past end of OOB\n");
553 errcnt += 1; 551 errcnt += 1;
554 } 552 }
555 553
556 if (bbt[ebcnt - 1]) 554 if (bbt[ebcnt - 1])
557 printk(PRINT_PREF "skipping end of device tests because last " 555 pr_info("skipping end of device tests because last "
558 "block is bad\n"); 556 "block is bad\n");
559 else { 557 else {
560 /* Attempt to write off end of device */ 558 /* Attempt to write off end of device */
@@ -566,14 +564,14 @@ static int __init mtd_oobtest_init(void)
566 ops.ooboffs = 0; 564 ops.ooboffs = 0;
567 ops.datbuf = NULL; 565 ops.datbuf = NULL;
568 ops.oobbuf = writebuf; 566 ops.oobbuf = writebuf;
569 printk(PRINT_PREF "attempting to write past end of device\n"); 567 pr_info("attempting to write past end of device\n");
570 printk(PRINT_PREF "an error is expected...\n"); 568 pr_info("an error is expected...\n");
571 err = mtd_write_oob(mtd, mtd->size - mtd->writesize, &ops); 569 err = mtd_write_oob(mtd, mtd->size - mtd->writesize, &ops);
572 if (err) { 570 if (err) {
573 printk(PRINT_PREF "error occurred as expected\n"); 571 pr_info("error occurred as expected\n");
574 err = 0; 572 err = 0;
575 } else { 573 } else {
576 printk(PRINT_PREF "error: wrote past end of device\n"); 574 pr_err("error: wrote past end of device\n");
577 errcnt += 1; 575 errcnt += 1;
578 } 576 }
579 577
@@ -586,14 +584,14 @@ static int __init mtd_oobtest_init(void)
586 ops.ooboffs = 0; 584 ops.ooboffs = 0;
587 ops.datbuf = NULL; 585 ops.datbuf = NULL;
588 ops.oobbuf = readbuf; 586 ops.oobbuf = readbuf;
589 printk(PRINT_PREF "attempting to read past end of device\n"); 587 pr_info("attempting to read past end of device\n");
590 printk(PRINT_PREF "an error is expected...\n"); 588 pr_info("an error is expected...\n");
591 err = mtd_read_oob(mtd, mtd->size - mtd->writesize, &ops); 589 err = mtd_read_oob(mtd, mtd->size - mtd->writesize, &ops);
592 if (err) { 590 if (err) {
593 printk(PRINT_PREF "error occurred as expected\n"); 591 pr_info("error occurred as expected\n");
594 err = 0; 592 err = 0;
595 } else { 593 } else {
596 printk(PRINT_PREF "error: read past end of device\n"); 594 pr_err("error: read past end of device\n");
597 errcnt += 1; 595 errcnt += 1;
598 } 596 }
599 597
@@ -610,14 +608,14 @@ static int __init mtd_oobtest_init(void)
610 ops.ooboffs = 1; 608 ops.ooboffs = 1;
611 ops.datbuf = NULL; 609 ops.datbuf = NULL;
612 ops.oobbuf = writebuf; 610 ops.oobbuf = writebuf;
613 printk(PRINT_PREF "attempting to write past end of device\n"); 611 pr_info("attempting to write past end of device\n");
614 printk(PRINT_PREF "an error is expected...\n"); 612 pr_info("an error is expected...\n");
615 err = mtd_write_oob(mtd, mtd->size - mtd->writesize, &ops); 613 err = mtd_write_oob(mtd, mtd->size - mtd->writesize, &ops);
616 if (err) { 614 if (err) {
617 printk(PRINT_PREF "error occurred as expected\n"); 615 pr_info("error occurred as expected\n");
618 err = 0; 616 err = 0;
619 } else { 617 } else {
620 printk(PRINT_PREF "error: wrote past end of device\n"); 618 pr_err("error: wrote past end of device\n");
621 errcnt += 1; 619 errcnt += 1;
622 } 620 }
623 621
@@ -630,20 +628,20 @@ static int __init mtd_oobtest_init(void)
630 ops.ooboffs = 1; 628 ops.ooboffs = 1;
631 ops.datbuf = NULL; 629 ops.datbuf = NULL;
632 ops.oobbuf = readbuf; 630 ops.oobbuf = readbuf;
633 printk(PRINT_PREF "attempting to read past end of device\n"); 631 pr_info("attempting to read past end of device\n");
634 printk(PRINT_PREF "an error is expected...\n"); 632 pr_info("an error is expected...\n");
635 err = mtd_read_oob(mtd, mtd->size - mtd->writesize, &ops); 633 err = mtd_read_oob(mtd, mtd->size - mtd->writesize, &ops);
636 if (err) { 634 if (err) {
637 printk(PRINT_PREF "error occurred as expected\n"); 635 pr_info("error occurred as expected\n");
638 err = 0; 636 err = 0;
639 } else { 637 } else {
640 printk(PRINT_PREF "error: read past end of device\n"); 638 pr_err("error: read past end of device\n");
641 errcnt += 1; 639 errcnt += 1;
642 } 640 }
643 } 641 }
644 642
645 /* Fifth test: write / read across block boundaries */ 643 /* Fifth test: write / read across block boundaries */
646 printk(PRINT_PREF "test 5 of 5\n"); 644 pr_info("test 5 of 5\n");
647 645
648 /* Erase all eraseblocks */ 646 /* Erase all eraseblocks */
649 err = erase_whole_device(); 647 err = erase_whole_device();
@@ -652,7 +650,7 @@ static int __init mtd_oobtest_init(void)
652 650
653 /* Write all eraseblocks */ 651 /* Write all eraseblocks */
654 simple_srand(11); 652 simple_srand(11);
655 printk(PRINT_PREF "writing OOBs of whole device\n"); 653 pr_info("writing OOBs of whole device\n");
656 for (i = 0; i < ebcnt - 1; ++i) { 654 for (i = 0; i < ebcnt - 1; ++i) {
657 int cnt = 2; 655 int cnt = 2;
658 int pg; 656 int pg;
@@ -674,17 +672,16 @@ static int __init mtd_oobtest_init(void)
674 if (err) 672 if (err)
675 goto out; 673 goto out;
676 if (i % 256 == 0) 674 if (i % 256 == 0)
677 printk(PRINT_PREF "written up to eraseblock " 675 pr_info("written up to eraseblock %u\n", i);
678 "%u\n", i);
679 cond_resched(); 676 cond_resched();
680 addr += mtd->writesize; 677 addr += mtd->writesize;
681 } 678 }
682 } 679 }
683 printk(PRINT_PREF "written %u eraseblocks\n", i); 680 pr_info("written %u eraseblocks\n", i);
684 681
685 /* Check all eraseblocks */ 682 /* Check all eraseblocks */
686 simple_srand(11); 683 simple_srand(11);
687 printk(PRINT_PREF "verifying all eraseblocks\n"); 684 pr_info("verifying all eraseblocks\n");
688 for (i = 0; i < ebcnt - 1; ++i) { 685 for (i = 0; i < ebcnt - 1; ++i) {
689 if (bbt[i] || bbt[i + 1]) 686 if (bbt[i] || bbt[i + 1])
690 continue; 687 continue;
@@ -702,28 +699,28 @@ static int __init mtd_oobtest_init(void)
702 if (err) 699 if (err)
703 goto out; 700 goto out;
704 if (memcmp(readbuf, writebuf, mtd->ecclayout->oobavail * 2)) { 701 if (memcmp(readbuf, writebuf, mtd->ecclayout->oobavail * 2)) {
705 printk(PRINT_PREF "error: verify failed at %#llx\n", 702 pr_err("error: verify failed at %#llx\n",
706 (long long)addr); 703 (long long)addr);
707 errcnt += 1; 704 errcnt += 1;
708 if (errcnt > 1000) { 705 if (errcnt > 1000) {
709 printk(PRINT_PREF "error: too many errors\n"); 706 pr_err("error: too many errors\n");
710 goto out; 707 goto out;
711 } 708 }
712 } 709 }
713 if (i % 256 == 0) 710 if (i % 256 == 0)
714 printk(PRINT_PREF "verified up to eraseblock %u\n", i); 711 pr_info("verified up to eraseblock %u\n", i);
715 cond_resched(); 712 cond_resched();
716 } 713 }
717 printk(PRINT_PREF "verified %u eraseblocks\n", i); 714 pr_info("verified %u eraseblocks\n", i);
718 715
719 printk(PRINT_PREF "finished with %d errors\n", errcnt); 716 pr_info("finished with %d errors\n", errcnt);
720out: 717out:
721 kfree(bbt); 718 kfree(bbt);
722 kfree(writebuf); 719 kfree(writebuf);
723 kfree(readbuf); 720 kfree(readbuf);
724 put_mtd_device(mtd); 721 put_mtd_device(mtd);
725 if (err) 722 if (err)
726 printk(PRINT_PREF "error %d occurred\n", err); 723 pr_info("error %d occurred\n", err);
727 printk(KERN_INFO "=================================================\n"); 724 printk(KERN_INFO "=================================================\n");
728 return err; 725 return err;
729} 726}