diff options
author | Shmulik Ladkani <shmulik.ladkani@gmail.com> | 2012-08-20 09:29:15 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-09-29 10:10:37 -0400 |
commit | eceb84b1886acb38e618f3dfb51cd4e53f2ddb97 (patch) | |
tree | bc06d3dc83572db25d48c3fc085c71e8af2671cc | |
parent | 19da4158d33053c6e91e95ee0663d625b2d32a77 (diff) |
mtd: nand: rename create_bbt()'s 'len' variable to 'numpages'
Rename 'len' variable of create_bbt/scan_block_fast/scan_block_full to
'numpages', since it really means number of pages to scan when
searching for the BBM (and not the byte length of the scan).
Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Reviewed-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r-- | drivers/mtd/nand/nand_bbt.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c index 9a5402e320bf..24b0a4c3c39f 100644 --- a/drivers/mtd/nand/nand_bbt.c +++ b/drivers/mtd/nand/nand_bbt.c | |||
@@ -401,7 +401,7 @@ static void read_abs_bbts(struct mtd_info *mtd, uint8_t *buf, | |||
401 | /* Scan a given block full */ | 401 | /* Scan a given block full */ |
402 | static int scan_block_full(struct mtd_info *mtd, struct nand_bbt_descr *bd, | 402 | static int scan_block_full(struct mtd_info *mtd, struct nand_bbt_descr *bd, |
403 | loff_t offs, uint8_t *buf, size_t readlen, | 403 | loff_t offs, uint8_t *buf, size_t readlen, |
404 | int scanlen, int len) | 404 | int scanlen, int numpages) |
405 | { | 405 | { |
406 | int ret, j; | 406 | int ret, j; |
407 | 407 | ||
@@ -410,7 +410,7 @@ static int scan_block_full(struct mtd_info *mtd, struct nand_bbt_descr *bd, | |||
410 | if (ret && !mtd_is_bitflip_or_eccerr(ret)) | 410 | if (ret && !mtd_is_bitflip_or_eccerr(ret)) |
411 | return ret; | 411 | return ret; |
412 | 412 | ||
413 | for (j = 0; j < len; j++, buf += scanlen) { | 413 | for (j = 0; j < numpages; j++, buf += scanlen) { |
414 | if (check_pattern(buf, scanlen, mtd->writesize, bd)) | 414 | if (check_pattern(buf, scanlen, mtd->writesize, bd)) |
415 | return 1; | 415 | return 1; |
416 | } | 416 | } |
@@ -419,7 +419,7 @@ static int scan_block_full(struct mtd_info *mtd, struct nand_bbt_descr *bd, | |||
419 | 419 | ||
420 | /* Scan a given block partially */ | 420 | /* Scan a given block partially */ |
421 | static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd, | 421 | static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd, |
422 | loff_t offs, uint8_t *buf, int len) | 422 | loff_t offs, uint8_t *buf, int numpages) |
423 | { | 423 | { |
424 | struct mtd_oob_ops ops; | 424 | struct mtd_oob_ops ops; |
425 | int j, ret; | 425 | int j, ret; |
@@ -430,7 +430,7 @@ static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd, | |||
430 | ops.datbuf = NULL; | 430 | ops.datbuf = NULL; |
431 | ops.mode = MTD_OPS_PLACE_OOB; | 431 | ops.mode = MTD_OPS_PLACE_OOB; |
432 | 432 | ||
433 | for (j = 0; j < len; j++) { | 433 | for (j = 0; j < numpages; j++) { |
434 | /* | 434 | /* |
435 | * Read the full oob until read_oob is fixed to handle single | 435 | * Read the full oob until read_oob is fixed to handle single |
436 | * byte reads for 16 bit buswidth. | 436 | * byte reads for 16 bit buswidth. |
@@ -463,7 +463,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
463 | struct nand_bbt_descr *bd, int chip) | 463 | struct nand_bbt_descr *bd, int chip) |
464 | { | 464 | { |
465 | struct nand_chip *this = mtd->priv; | 465 | struct nand_chip *this = mtd->priv; |
466 | int i, numblocks, len, scanlen; | 466 | int i, numblocks, numpages, scanlen; |
467 | int startblock; | 467 | int startblock; |
468 | loff_t from; | 468 | loff_t from; |
469 | size_t readlen; | 469 | size_t readlen; |
@@ -471,11 +471,11 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
471 | pr_info("Scanning device for bad blocks\n"); | 471 | pr_info("Scanning device for bad blocks\n"); |
472 | 472 | ||
473 | if (bd->options & NAND_BBT_SCANALLPAGES) | 473 | if (bd->options & NAND_BBT_SCANALLPAGES) |
474 | len = 1 << (this->bbt_erase_shift - this->page_shift); | 474 | numpages = 1 << (this->bbt_erase_shift - this->page_shift); |
475 | else if (bd->options & NAND_BBT_SCAN2NDPAGE) | 475 | else if (bd->options & NAND_BBT_SCAN2NDPAGE) |
476 | len = 2; | 476 | numpages = 2; |
477 | else | 477 | else |
478 | len = 1; | 478 | numpages = 1; |
479 | 479 | ||
480 | if (!(bd->options & NAND_BBT_SCANEMPTY)) { | 480 | if (!(bd->options & NAND_BBT_SCANEMPTY)) { |
481 | /* We need only read few bytes from the OOB area */ | 481 | /* We need only read few bytes from the OOB area */ |
@@ -484,7 +484,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
484 | } else { | 484 | } else { |
485 | /* Full page content should be read */ | 485 | /* Full page content should be read */ |
486 | scanlen = mtd->writesize + mtd->oobsize; | 486 | scanlen = mtd->writesize + mtd->oobsize; |
487 | readlen = len * mtd->writesize; | 487 | readlen = numpages * mtd->writesize; |
488 | } | 488 | } |
489 | 489 | ||
490 | if (chip == -1) { | 490 | if (chip == -1) { |
@@ -508,7 +508,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
508 | } | 508 | } |
509 | 509 | ||
510 | if (this->bbt_options & NAND_BBT_SCANLASTPAGE) | 510 | if (this->bbt_options & NAND_BBT_SCANLASTPAGE) |
511 | from += mtd->erasesize - (mtd->writesize * len); | 511 | from += mtd->erasesize - (mtd->writesize * numpages); |
512 | 512 | ||
513 | for (i = startblock; i < numblocks;) { | 513 | for (i = startblock; i < numblocks;) { |
514 | int ret; | 514 | int ret; |
@@ -517,9 +517,9 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
517 | 517 | ||
518 | if (bd->options & NAND_BBT_SCANALLPAGES) | 518 | if (bd->options & NAND_BBT_SCANALLPAGES) |
519 | ret = scan_block_full(mtd, bd, from, buf, readlen, | 519 | ret = scan_block_full(mtd, bd, from, buf, readlen, |
520 | scanlen, len); | 520 | scanlen, numpages); |
521 | else | 521 | else |
522 | ret = scan_block_fast(mtd, bd, from, buf, len); | 522 | ret = scan_block_fast(mtd, bd, from, buf, numpages); |
523 | 523 | ||
524 | if (ret < 0) | 524 | if (ret < 0) |
525 | return ret; | 525 | return ret; |