aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_bbt.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2013-07-30 20:53:00 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2013-08-30 11:48:37 -0400
commitdad2256269cb2ee3a72baefc5eb6e02ae1de2cfe (patch)
tree03c8fcf44feffb85f3d37af3a21b71caa48dcce9 /drivers/mtd/nand/nand_bbt.c
parentb32843b772db6024336e36c39359d8edc3b416ab (diff)
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>
Diffstat (limited to 'drivers/mtd/nand/nand_bbt.c')
-rw-r--r--drivers/mtd/nand/nand_bbt.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index ae3fb58591cf..bc06196d5739 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -110,33 +110,17 @@ static int check_pattern_no_oob(uint8_t *buf, struct nand_bbt_descr *td)
110 * @td: search pattern descriptor 110 * @td: search pattern descriptor
111 * 111 *
112 * Check for a pattern at the given place. Used to search bad block tables and 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 113 * good / bad block identifiers.
114 * all bytes except the pattern area contain 0xff.
115 */ 114 */
116static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td) 115static 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 if (td->options & NAND_BBT_NO_OOB) 117 if (td->options & NAND_BBT_NO_OOB)
122 return check_pattern_no_oob(buf, td); 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 /* Compare the pattern */ 120 /* Compare the pattern */
131 if (memcmp(p, td->pattern, td->len)) 121 if (memcmp(buf + paglen + td->offs, td->pattern, td->len))
132 return -1; 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 return 0; 124 return 0;
141} 125}
142 126
@@ -507,15 +491,9 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
507 else 491 else
508 numpages = 1; 492 numpages = 1;
509 493
510 if (!(bd->options & NAND_BBT_SCANEMPTY)) { 494 /* We need only read few bytes from the OOB area */
511 /* We need only read few bytes from the OOB area */ 495 scanlen = 0;
512 scanlen = 0; 496 readlen = bd->len;
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 }
519 497
520 if (chip == -1) { 498 if (chip == -1) {
521 numblocks = mtd->size >> this->bbt_erase_shift; 499 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
882{ 860{
883 struct nand_chip *this = mtd->priv; 861 struct nand_chip *this = mtd->priv;
884 862
885 bd->options &= ~NAND_BBT_SCANEMPTY;
886 return create_bbt(mtd, this->buffers->databuf, bd, -1); 863 return create_bbt(mtd, this->buffers->databuf, bd, -1);
887} 864}
888 865