Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: nand: remove NAND_BBT_SCANEMPTY

NAND_BBT_SCANEMPTY is a strange, badly-supported option with omap as its
single remaining user.

NAND_BBT_SCANEMPTY was likely used by accident in omap2[1]. And anyway,
omap2 doesn't scan the chip for bad blocks (courtesy of
NAND_SKIP_BBTSCAN), and so its use of this option is irrelevant.

This patch drops the NAND_BBT_SCANEMPTY option.

[1] http://lists.infradead.org/pipermail/linux-mtd/2012-July/042902.html

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Ivan Djelic <ivan.djelic@parrot.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Brian Norris and committed by
David Woodhouse
dad22562 b32843b7

+6 -34
-2
Documentation/DocBook/mtdnand.tmpl
··· 1224 1224 #define NAND_BBT_CREATE 0x00000200 1225 1225 /* Search good / bad pattern through all pages of a block */ 1226 1226 #define NAND_BBT_SCANALLPAGES 0x00000400 1227 - /* Scan block empty during good / bad block scan */ 1228 - #define NAND_BBT_SCANEMPTY 0x00000800 1229 1227 /* Write bbt if neccecary */ 1230 1228 #define NAND_BBT_WRITE 0x00001000 1231 1229 /* Read and write back block contents when writing bbt */
+5 -28
drivers/mtd/nand/nand_bbt.c
··· 110 110 * @td: search pattern descriptor 111 111 * 112 112 * Check for a pattern at the given place. Used to search bad block tables and 113 - * good / bad block identifiers. If the SCAN_EMPTY option is set then check, if 114 - * all bytes except the pattern area contain 0xff. 113 + * good / bad block identifiers. 115 114 */ 116 115 static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td) 117 116 { 118 - int end = 0; 119 - uint8_t *p = buf; 120 - 121 117 if (td->options & NAND_BBT_NO_OOB) 122 118 return check_pattern_no_oob(buf, td); 123 119 124 - end = paglen + td->offs; 125 - if (td->options & NAND_BBT_SCANEMPTY) 126 - if (memchr_inv(p, 0xff, end)) 127 - return -1; 128 - p += end; 129 - 130 120 /* Compare the pattern */ 131 - if (memcmp(p, td->pattern, td->len)) 121 + if (memcmp(buf + paglen + td->offs, td->pattern, td->len)) 132 122 return -1; 133 123 134 - if (td->options & NAND_BBT_SCANEMPTY) { 135 - p += td->len; 136 - end += td->len; 137 - if (memchr_inv(p, 0xff, len - end)) 138 - return -1; 139 - } 140 124 return 0; 141 125 } 142 126 ··· 491 507 else 492 508 numpages = 1; 493 509 494 - if (!(bd->options & NAND_BBT_SCANEMPTY)) { 495 - /* We need only read few bytes from the OOB area */ 496 - scanlen = 0; 497 - readlen = bd->len; 498 - } else { 499 - /* Full page content should be read */ 500 - scanlen = mtd->writesize + mtd->oobsize; 501 - readlen = numpages * mtd->writesize; 502 - } 510 + /* We need only read few bytes from the OOB area */ 511 + scanlen = 0; 512 + readlen = bd->len; 503 513 504 514 if (chip == -1) { 505 515 numblocks = mtd->size >> this->bbt_erase_shift; ··· 860 882 { 861 883 struct nand_chip *this = mtd->priv; 862 884 863 - bd->options &= ~NAND_BBT_SCANEMPTY; 864 885 return create_bbt(mtd, this->buffers->databuf, bd, -1); 865 886 } 866 887
+1 -1
drivers/mtd/nand/omap2.c
··· 154 154 */ 155 155 static uint8_t scan_ff_pattern[] = { 0xff }; 156 156 static struct nand_bbt_descr bb_descrip_flashbased = { 157 - .options = NAND_BBT_SCANEMPTY | NAND_BBT_SCANALLPAGES, 157 + .options = NAND_BBT_SCANALLPAGES, 158 158 .offs = 0, 159 159 .len = 1, 160 160 .pattern = scan_ff_pattern,
-1
drivers/mtd/onenand/onenand_bbt.c
··· 133 133 { 134 134 struct onenand_chip *this = mtd->priv; 135 135 136 - bd->options &= ~NAND_BBT_SCANEMPTY; 137 136 return create_bbt(mtd, this->page_buf, bd, -1); 138 137 } 139 138
-2
include/linux/mtd/bbm.h
··· 93 93 #define NAND_BBT_CREATE_EMPTY 0x00000400 94 94 /* Search good / bad pattern through all pages of a block */ 95 95 #define NAND_BBT_SCANALLPAGES 0x00000800 96 - /* Scan block empty during good / bad block scan */ 97 - #define NAND_BBT_SCANEMPTY 0x00001000 98 96 /* Write bbt if neccecary */ 99 97 #define NAND_BBT_WRITE 0x00002000 100 98 /* Read and write back block contents when writing bbt */