From: "Brian Norris" <computersforpeace@gmail.com>
To: linux-mtd@lists.infradead.org
Cc: Brian Norris <computersforpeace@gmail.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Kevin Cernekee <cernekee@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Artem Bityutskiy <dedekind1@gmail.com>
Subject: [PATCH 2/2] mtd: nand: dynamic allocation of flash-based BBT structs
Date: Fri, 18 Mar 2011 21:53:42 -0700 [thread overview]
Message-ID: <1300510422-4841-2-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1300510422-4841-1-git-send-email-computersforpeace@gmail.com>
It is nicer to dynamically create our badblock patterns than to
statically define them. The nand_create_default_bbt_descr() function
does a sufficient job of handling various bad block scanning options
for either flash-based or non-flash-based BBTs, so we might as well
use the function for both cases.
This patch simplifies and shortens our code (and removes a TODO that
I left a few months ago).
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
drivers/mtd/nand/nand_bbt.c | 27 ++++-----------------------
1 files changed, 4 insertions(+), 23 deletions(-)
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index a1e8b30..2753bb1 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -1276,20 +1276,6 @@ int nand_update_bbt(struct mtd_info *mtd, loff_t offs)
* while scanning a device for factory marked good / bad blocks. */
static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
-static struct nand_bbt_descr smallpage_flashbased = {
- .options = NAND_BBT_SCAN2NDPAGE,
- .offs = NAND_SMALL_BADBLOCK_POS,
- .len = 1,
- .pattern = scan_ff_pattern
-};
-
-static struct nand_bbt_descr largepage_flashbased = {
- .options = NAND_BBT_SCAN2NDPAGE,
- .offs = NAND_LARGE_BADBLOCK_POS,
- .len = 2,
- .pattern = scan_ff_pattern
-};
-
static uint8_t scan_agand_pattern[] = { 0x1C, 0x71, 0xC7, 0x1C, 0x71, 0xC7 };
static struct nand_bbt_descr agand_flashbased = {
@@ -1355,10 +1341,6 @@ static struct nand_bbt_descr bbt_mirror_no_bbt_descr = {
* this->badblock_pattern. Thus, this->badblock_pattern should be NULL when
* passed to this function.
*
- * TODO: Handle other flags, replace other static structs
- * (e.g. handle NAND_BBT_FLASH for flash-based BBT,
- * replace smallpage_flashbased)
- *
*/
static int nand_create_default_bbt_descr(struct nand_chip *this)
{
@@ -1422,15 +1404,14 @@ int nand_default_bbt(struct mtd_info *mtd)
this->bbt_md = &bbt_mirror_descr;
}
}
- if (!this->badblock_pattern) {
- this->badblock_pattern = (mtd->writesize > 512) ? &largepage_flashbased : &smallpage_flashbased;
- }
} else {
this->bbt_td = NULL;
this->bbt_md = NULL;
- if (!this->badblock_pattern)
- nand_create_default_bbt_descr(this);
}
+
+ if (!this->badblock_pattern)
+ nand_create_default_bbt_descr(this);
+
return nand_scan_bbt(mtd, this->badblock_pattern);
}
--
1.7.0.4
next prev parent reply other threads:[~2011-03-19 4:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-19 4:53 [PATCH 1/2] mtd: nand: renumber conflicting BBT flags Brian Norris
2011-03-19 4:53 ` Brian Norris [this message]
2011-03-31 12:58 ` Artem Bityutskiy
2011-04-02 8:04 ` Brian Norris
2011-04-04 7:52 ` Artem Bityutskiy
2011-04-20 7:13 ` [RFC] mtd: nand: separate chip options / bbt_options Brian Norris
2011-04-22 8:02 ` Artem Bityutskiy
2011-05-25 18:15 ` Brian Norris
2011-05-26 8:04 ` Sebastian Andrzej Siewior
2011-05-31 17:25 ` Brian Norris
2011-04-04 7:58 ` [PATCH 1/2] mtd: nand: renumber conflicting BBT flags Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1300510422-4841-2-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=cernekee@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).