diff options
-rw-r--r-- | drivers/mtd/nand/nand_bbt.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c index e7976c7a7bb0..783093d1a2e5 100644 --- a/drivers/mtd/nand/nand_bbt.c +++ b/drivers/mtd/nand/nand_bbt.c | |||
@@ -1294,26 +1294,27 @@ static struct nand_bbt_descr bbt_mirror_no_bbt_descr = { | |||
1294 | .pattern = mirror_pattern | 1294 | .pattern = mirror_pattern |
1295 | }; | 1295 | }; |
1296 | 1296 | ||
1297 | #define BADBLOCK_SCAN_MASK (~NAND_BBT_NO_OOB) | ||
1297 | /** | 1298 | /** |
1298 | * nand_create_default_bbt_descr - [INTERN] Creates a BBT descriptor structure | 1299 | * nand_create_badblock_pattern - [INTERN] Creates a BBT descriptor structure |
1299 | * @this: NAND chip to create descriptor for | 1300 | * @this: NAND chip to create descriptor for |
1300 | * | 1301 | * |
1301 | * This function allocates and initializes a nand_bbt_descr for BBM detection | 1302 | * This function allocates and initializes a nand_bbt_descr for BBM detection |
1302 | * based on the properties of "this". The new descriptor is stored in | 1303 | * based on the properties of @this. The new descriptor is stored in |
1303 | * this->badblock_pattern. Thus, this->badblock_pattern should be NULL when | 1304 | * this->badblock_pattern. Thus, this->badblock_pattern should be NULL when |
1304 | * passed to this function. | 1305 | * passed to this function. |
1305 | */ | 1306 | */ |
1306 | static int nand_create_default_bbt_descr(struct nand_chip *this) | 1307 | static int nand_create_badblock_pattern(struct nand_chip *this) |
1307 | { | 1308 | { |
1308 | struct nand_bbt_descr *bd; | 1309 | struct nand_bbt_descr *bd; |
1309 | if (this->badblock_pattern) { | 1310 | if (this->badblock_pattern) { |
1310 | pr_warn("BBT descr already allocated; not replacing\n"); | 1311 | pr_warn("Bad block pattern already allocated; not replacing\n"); |
1311 | return -EINVAL; | 1312 | return -EINVAL; |
1312 | } | 1313 | } |
1313 | bd = kzalloc(sizeof(*bd), GFP_KERNEL); | 1314 | bd = kzalloc(sizeof(*bd), GFP_KERNEL); |
1314 | if (!bd) | 1315 | if (!bd) |
1315 | return -ENOMEM; | 1316 | return -ENOMEM; |
1316 | bd->options = this->bbt_options; | 1317 | bd->options = this->bbt_options & BADBLOCK_SCAN_MASK; |
1317 | bd->offs = this->badblockpos; | 1318 | bd->offs = this->badblockpos; |
1318 | bd->len = (this->options & NAND_BUSWIDTH_16) ? 2 : 1; | 1319 | bd->len = (this->options & NAND_BUSWIDTH_16) ? 2 : 1; |
1319 | bd->pattern = scan_ff_pattern; | 1320 | bd->pattern = scan_ff_pattern; |
@@ -1367,7 +1368,7 @@ int nand_default_bbt(struct mtd_info *mtd) | |||
1367 | } | 1368 | } |
1368 | 1369 | ||
1369 | if (!this->badblock_pattern) | 1370 | if (!this->badblock_pattern) |
1370 | nand_create_default_bbt_descr(this); | 1371 | nand_create_badblock_pattern(this); |
1371 | 1372 | ||
1372 | return nand_scan_bbt(mtd, this->badblock_pattern); | 1373 | return nand_scan_bbt(mtd, this->badblock_pattern); |
1373 | } | 1374 | } |