Skip to content

Commit 5961ad2

Browse files
mtd: nand_bbt: kill NAND_BBT_SCANALLPAGES
Now that the last user of NAND_BBT_SCANALLPAGES has been removed, let's kill this peculiar BBT feature flag. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
1 parent 9650b9b commit 5961ad2

3 files changed

Lines changed: 3 additions & 38 deletions

File tree

‎Documentation/DocBook/mtdnand.tmpl‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,8 +1222,6 @@ in this page</entry>
12221222
#define NAND_BBT_VERSION 0x00000100
12231223
/* Create a bbt if none axists */
12241224
#define NAND_BBT_CREATE 0x00000200
1225-
/* Search good / bad pattern through all pages of a block */
1226-
#define NAND_BBT_SCANALLPAGES 0x00000400
12271225
/* Write bbt if neccecary */
12281226
#define NAND_BBT_WRITE 0x00001000
12291227
/* Read and write back block contents when writing bbt */

‎drivers/mtd/nand/nand_bbt.c‎

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -412,25 +412,6 @@ static void read_abs_bbts(struct mtd_info *mtd, uint8_t *buf,
412412
}
413413
}
414414

415-
/* Scan a given block full */
416-
static int scan_block_full(struct mtd_info *mtd, struct nand_bbt_descr *bd,
417-
loff_t offs, uint8_t *buf, size_t readlen,
418-
int scanlen, int numpages)
419-
{
420-
int ret, j;
421-
422-
ret = scan_read_oob(mtd, buf, offs, readlen);
423-
/* Ignore ECC errors when checking for BBM */
424-
if (ret && !mtd_is_bitflip_or_eccerr(ret))
425-
return ret;
426-
427-
for (j = 0; j < numpages; j++, buf += scanlen) {
428-
if (check_pattern(buf, scanlen, mtd->writesize, bd))
429-
return 1;
430-
}
431-
return 0;
432-
}
433-
434415
/* Scan a given block partially */
435416
static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd,
436417
loff_t offs, uint8_t *buf, int numpages)
@@ -477,24 +458,17 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
477458
struct nand_bbt_descr *bd, int chip)
478459
{
479460
struct nand_chip *this = mtd->priv;
480-
int i, numblocks, numpages, scanlen;
461+
int i, numblocks, numpages;
481462
int startblock;
482463
loff_t from;
483-
size_t readlen;
484464

485465
pr_info("Scanning device for bad blocks\n");
486466

487-
if (bd->options & NAND_BBT_SCANALLPAGES)
488-
numpages = 1 << (this->bbt_erase_shift - this->page_shift);
489-
else if (bd->options & NAND_BBT_SCAN2NDPAGE)
467+
if (bd->options & NAND_BBT_SCAN2NDPAGE)
490468
numpages = 2;
491469
else
492470
numpages = 1;
493471

494-
/* We need only read few bytes from the OOB area */
495-
scanlen = 0;
496-
readlen = bd->len;
497-
498472
if (chip == -1) {
499473
numblocks = mtd->size >> this->bbt_erase_shift;
500474
startblock = 0;
@@ -519,12 +493,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
519493

520494
BUG_ON(bd->options & NAND_BBT_NO_OOB);
521495

522-
if (bd->options & NAND_BBT_SCANALLPAGES)
523-
ret = scan_block_full(mtd, bd, from, buf, readlen,
524-
scanlen, numpages);
525-
else
526-
ret = scan_block_fast(mtd, bd, from, buf, numpages);
527-
496+
ret = scan_block_fast(mtd, bd, from, buf, numpages);
528497
if (ret < 0)
529498
return ret;
530499

‎include/linux/mtd/bbm.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ struct nand_bbt_descr {
9191
* with NAND_BBT_CREATE.
9292
*/
9393
#define NAND_BBT_CREATE_EMPTY 0x00000400
94-
/* Search good / bad pattern through all pages of a block */
95-
#define NAND_BBT_SCANALLPAGES 0x00000800
9694
/* Write bbt if neccecary */
9795
#define NAND_BBT_WRITE 0x00002000
9896
/* Read and write back block contents when writing bbt */

0 commit comments

Comments
 (0)