mtd: nand: begin restructuring check_create
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Mon Nov 7 11:59:34 EST 2011
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=c5e8ef9c21a492f1e0436b350bbc3e916f93e506
Commit: c5e8ef9c21a492f1e0436b350bbc3e916f93e506
Parent: 596d74527a804418d88e1178c9d72aff5649e89c
Author: Brian Norris <computersforpeace at gmail.com>
AuthorDate: Wed Sep 7 13:13:34 2011 -0700
Committer: Artem Bityutskiy <artem.bityutskiy at intel.com>
CommitDate: Sun Sep 11 17:15:56 2011 +0300
mtd: nand: begin restructuring check_create
We will begin restructuring the code for check_create so that we can
make some important changes. For now, we should just begin to get rid of
some goto statements to make things cleaner. This is the first step of a
few, which are separated to make them easier to follow.
This step should just be a code refactor.
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy at intel.com>
---
drivers/mtd/nand/nand_bbt.c | 24 +++++-------------------
1 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index e962167..42b523a 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -898,30 +898,19 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
if (td->pages[i] == -1 && md->pages[i] == -1) {
writeops = 0x03;
goto create;
- }
-
- if (td->pages[i] == -1) {
+ } else if (td->pages[i] == -1) {
rd = md;
td->version[i] = md->version[i];
writeops = 0x01;
- goto writecheck;
- }
-
- if (md->pages[i] == -1) {
+ } else if (md->pages[i] == -1) {
rd = td;
md->version[i] = td->version[i];
writeops = 0x02;
- goto writecheck;
- }
-
- if (td->version[i] == md->version[i]) {
+ } else if (td->version[i] == md->version[i]) {
rd = td;
if (!(td->options & NAND_BBT_VERSION))
rd2 = md;
- goto writecheck;
- }
-
- if (((int8_t)(td->version[i] - md->version[i])) > 0) {
+ } else if (((int8_t)(td->version[i] - md->version[i])) > 0) {
rd = td;
md->version[i] = td->version[i];
writeops = 0x02;
@@ -930,17 +919,14 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
td->version[i] = md->version[i];
writeops = 0x01;
}
-
- goto writecheck;
-
} else {
if (td->pages[i] == -1) {
writeops = 0x01;
goto create;
}
rd = td;
- goto writecheck;
}
+ goto writecheck;
create:
/* Create the bad block table by scanning the device? */
if (!(td->options & NAND_BBT_CREATE))
More information about the linux-mtd-cvs
mailing list