diff mbox

[RFC] write bad block marker even with BBT

Message ID 4CC1A5EE.9080605@parrot.com
State RFC
Headers show

Commit Message

Matthieu CASTET Oct. 22, 2010, 2:55 p.m. UTC
Hi,

do you think a patch like that make sense ?

This allow to solve problem where bootloader don't support reading BBT.

We could also add a new flag and do this only if this flag is set.


Matthieu

Comments

Artem Bityutskiy Oct. 25, 2010, 8:05 a.m. UTC | #1
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index ddffe76..71052d0 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -409,7 +409,10 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
>  	/* Do we have a flash based bad block table ? */
>  	if (chip->options & NAND_USE_FLASH_BBT)
>  		ret = nand_update_bbt(mtd, ofs);
> -	else {
> +	/* put also the bad block marker in case we loose BBT or
> +	   the bootloader doesn't support reading it
> +	 */

Nitpick: please, use kernel commenting style:
/*
 * Multi-line
 * comment
 */

> +	{
>  		nand_get_device(chip, mtd, FL_WRITING);

I think this makes sense, but this may break some setups, so this should
be yet another chip->option.
diff mbox

Patch

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ddffe76..71052d0 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -409,7 +409,10 @@  static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
 	/* Do we have a flash based bad block table ? */
 	if (chip->options & NAND_USE_FLASH_BBT)
 		ret = nand_update_bbt(mtd, ofs);
-	else {
+	/* put also the bad block marker in case we loose BBT or
+	   the bootloader doesn't support reading it
+	 */
+	{
 		nand_get_device(chip, mtd, FL_WRITING);
 
 		/* Write to first two pages and to byte 1 and 6 if necessary.