aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2011-09-07 16:13:34 -0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 10:15:56 -0400
commitc5e8ef9c21a492f1e0436b350bbc3e916f93e506 (patch)
treec9d6f8da9c532d0c6edb9cdff5ee0ad9002c4e58 /drivers/mtd
parent596d74527a804418d88e1178c9d72aff5649e89c (diff)
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@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/nand_bbt.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index e962167c9b71..42b523a84fc6 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
898 if (td->pages[i] == -1 && md->pages[i] == -1) { 898 if (td->pages[i] == -1 && md->pages[i] == -1) {
899 writeops = 0x03; 899 writeops = 0x03;
900 goto create; 900 goto create;
901 } 901 } else if (td->pages[i] == -1) {
902
903 if (td->pages[i] == -1) {
904 rd = md; 902 rd = md;
905 td->version[i] = md->version[i]; 903 td->version[i] = md->version[i];
906 writeops = 0x01; 904 writeops = 0x01;
907 goto writecheck; 905 } else if (md->pages[i] == -1) {
908 }
909
910 if (md->pages[i] == -1) {
911 rd = td; 906 rd = td;
912 md->version[i] = td->version[i]; 907 md->version[i] = td->version[i];
913 writeops = 0x02; 908 writeops = 0x02;
914 goto writecheck; 909 } else if (td->version[i] == md->version[i]) {
915 }
916
917 if (td->version[i] == md->version[i]) {
918 rd = td; 910 rd = td;
919 if (!(td->options & NAND_BBT_VERSION)) 911 if (!(td->options & NAND_BBT_VERSION))
920 rd2 = md; 912 rd2 = md;
921 goto writecheck; 913 } else if (((int8_t)(td->version[i] - md->version[i])) > 0) {
922 }
923
924 if (((int8_t)(td->version[i] - md->version[i])) > 0) {
925 rd = td; 914 rd = td;
926 md->version[i] = td->version[i]; 915 md->version[i] = td->version[i];
927 writeops = 0x02; 916 writeops = 0x02;
@@ -930,17 +919,14 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
930 td->version[i] = md->version[i]; 919 td->version[i] = md->version[i];
931 writeops = 0x01; 920 writeops = 0x01;
932 } 921 }
933
934 goto writecheck;
935
936 } else { 922 } else {
937 if (td->pages[i] == -1) { 923 if (td->pages[i] == -1) {
938 writeops = 0x01; 924 writeops = 0x01;
939 goto create; 925 goto create;
940 } 926 }
941 rd = td; 927 rd = td;
942 goto writecheck;
943 } 928 }
929 goto writecheck;
944 create: 930 create:
945 /* Create the bad block table by scanning the device? */ 931 /* Create the bad block table by scanning the device? */
946 if (!(td->options & NAND_BBT_CREATE)) 932 if (!(td->options & NAND_BBT_CREATE))