Skip to content

Commit dad2256

Browse files
computersforpeaceDavid Woodhouse
authored andcommitted
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>
1 parent b32843b commit dad2256

5 files changed

Lines changed: 6 additions & 34 deletions

File tree

‎Documentation/DocBook/mtdnand.tmpl‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,8 +1224,6 @@ in this page</entry>
12241224
#define NAND_BBT_CREATE 0x00000200
12251225
/* Search good / bad pattern through all pages of a block */
12261226
#define NAND_BBT_SCANALLPAGES 0x00000400
1227-
/* Scan block empty during good / bad block scan */
1228-
#define NAND_BBT_SCANEMPTY 0x00000800
12291227
/* Write bbt if neccecary */
12301228
#define NAND_BBT_WRITE 0x00001000
12311229
/* Read and write back block contents when writing bbt */

‎drivers/mtd/nand/nand_bbt.c‎

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -110,33 +110,17 @@ static int check_pattern_no_oob(uint8_t *buf, struct nand_bbt_descr *td)
110110
* @td: search pattern descriptor
111111
*
112112
* 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.
115114
*/
116115
static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td)
117116
{
118-
int end = 0;
119-
uint8_t *p = buf;
120-
121117
if (td->options & NAND_BBT_NO_OOB)
122118
return check_pattern_no_oob(buf, td);
123119

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-
130120
/* Compare the pattern */
131-
if (memcmp(p, td->pattern, td->len))
121+
if (memcmp(buf + paglen + td->offs, td->pattern, td->len))
132122
return -1;
133123

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-
}
140124
return 0;
141125
}
142126

@@ -507,15 +491,9 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
507491
else
508492
numpages = 1;
509493

510-
if (!(bd->options & NAND_BBT_SCANEMPTY)) {
511-
/* We need only read few bytes from the OOB area */
512-
scanlen = 0;
513-
readlen = bd->len;
514-
} else {
515-
/* Full page content should be read */
516-
scanlen = mtd->writesize + mtd->oobsize;
517-
readlen = numpages * mtd->writesize;
518-
}
494+
/* We need only read few bytes from the OOB area */
495+
scanlen = 0;
496+
readlen = bd->len;
519497

520498
if (chip == -1) {
521499
numblocks = mtd->size >> this->bbt_erase_shift;
@@ -882,7 +860,6 @@ static inline int nand_memory_bbt(struct mtd_info *mtd, struct nand_bbt_descr *b
882860
{
883861
struct nand_chip *this = mtd->priv;
884862

885-
bd->options &= ~NAND_BBT_SCANEMPTY;
886863
return create_bbt(mtd, this->buffers->databuf, bd, -1);
887864
}
888865

‎drivers/mtd/nand/omap2.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static struct nand_ecclayout omap_oobinfo;
154154
*/
155155
static uint8_t scan_ff_pattern[] = { 0xff };
156156
static struct nand_bbt_descr bb_descrip_flashbased = {
157-
.options = NAND_BBT_SCANEMPTY | NAND_BBT_SCANALLPAGES,
157+
.options = NAND_BBT_SCANALLPAGES,
158158
.offs = 0,
159159
.len = 1,
160160
.pattern = scan_ff_pattern,

‎drivers/mtd/onenand/onenand_bbt.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ static inline int onenand_memory_bbt (struct mtd_info *mtd, struct nand_bbt_desc
133133
{
134134
struct onenand_chip *this = mtd->priv;
135135

136-
bd->options &= ~NAND_BBT_SCANEMPTY;
137136
return create_bbt(mtd, this->page_buf, bd, -1);
138137
}
139138

‎include/linux/mtd/bbm.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ struct nand_bbt_descr {
9393
#define NAND_BBT_CREATE_EMPTY 0x00000400
9494
/* Search good / bad pattern through all pages of a block */
9595
#define NAND_BBT_SCANALLPAGES 0x00000800
96-
/* Scan block empty during good / bad block scan */
97-
#define NAND_BBT_SCANEMPTY 0x00001000
9896
/* Write bbt if neccecary */
9997
#define NAND_BBT_WRITE 0x00002000
10098
/* Read and write back block contents when writing bbt */

0 commit comments

Comments
 (0)