aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_bbt.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2011-05-31 19:31:21 -0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 08:01:56 -0400
commit5fb1549dfc40f3b589dae560ea21535cdc5f64e0 (patch)
tree8449037cb13d3453201950ffaadd65de60cf9399 /drivers/mtd/nand/nand_bbt.c
parenta0dc552951dcbb2b28a8a2ffb5fa966613e8c025 (diff)
mtd: nand: separate chip options / bbt_options
This patch handles the problems we've been having with using conflicting flags from nand.h and bbm.h in the same nand_chip.options field. We should try to separate these two spaces a little more clearly, and so I have added a bbt_options field to nand_chip. Important notes about nand_chip fields: * bbt_options field should contain ONLY flags from bbm.h. They should be able to pass safely to a nand_bbt_descr data structure. - BBT option flags start with the "NAND_BBT_" prefix. * options field should contian ONLY flags from nand.h. Ideally, they should not be involved in any BBT related options. - NAND chip option flags start with the "NAND_" prefix. * Every flag should have a nice comment explaining what the flag is. While this is not yet the case on all existing flags, please be sure to write one for new flags. Even better, you can help document the code better yourself! Please try to follow these conventions to make everyone's lives easier. Among the flags that are being moved to the new bbt_options field throughout various drivers, etc. are: * NAND_BBT_SCANLASTPAGE * NAND_BBT_SCAN2NDPAGE and there will be more to come. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/nand/nand_bbt.c')
-rw-r--r--drivers/mtd/nand/nand_bbt.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 5ffb9a4632ca..5df01d8efd92 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -517,7 +517,7 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
517 from = (loff_t)startblock << (this->bbt_erase_shift - 1); 517 from = (loff_t)startblock << (this->bbt_erase_shift - 1);
518 } 518 }
519 519
520 if (this->options & NAND_BBT_SCANLASTPAGE) 520 if (this->bbt_options & NAND_BBT_SCANLASTPAGE)
521 from += mtd->erasesize - (mtd->writesize * len); 521 from += mtd->erasesize - (mtd->writesize * len);
522 522
523 for (i = startblock; i < numblocks;) { 523 for (i = startblock; i < numblocks;) {
@@ -1301,7 +1301,6 @@ static struct nand_bbt_descr bbt_mirror_no_bbt_descr = {
1301 .pattern = mirror_pattern 1301 .pattern = mirror_pattern
1302}; 1302};
1303 1303
1304#define BBT_SCAN_OPTIONS (NAND_BBT_SCANLASTPAGE | NAND_BBT_SCAN2NDPAGE)
1305/** 1304/**
1306 * nand_create_default_bbt_descr - [Internal] Creates a BBT descriptor structure 1305 * nand_create_default_bbt_descr - [Internal] Creates a BBT descriptor structure
1307 * @this: NAND chip to create descriptor for 1306 * @this: NAND chip to create descriptor for
@@ -1324,7 +1323,7 @@ static int nand_create_default_bbt_descr(struct nand_chip *this)
1324 printk(KERN_ERR "nand_create_default_bbt_descr: Out of memory\n"); 1323 printk(KERN_ERR "nand_create_default_bbt_descr: Out of memory\n");
1325 return -ENOMEM; 1324 return -ENOMEM;
1326 } 1325 }
1327 bd->options = this->options & BBT_SCAN_OPTIONS; 1326 bd->options = this->bbt_options;
1328 bd->offs = this->badblockpos; 1327 bd->offs = this->badblockpos;
1329 bd->len = (this->options & NAND_BUSWIDTH_16) ? 2 : 1; 1328 bd->len = (this->options & NAND_BUSWIDTH_16) ? 2 : 1;
1330 bd->pattern = scan_ff_pattern; 1329 bd->pattern = scan_ff_pattern;