From 95adb1582479b0b309a61b8795ab2a956ef3480e Mon Sep 17 00:00:00 2001 From: Alin Jerpelea Date: Wed, 27 Jan 2021 12:57:13 +0100 Subject: [PATCH] drivers: mtd: nxstyle errors fix Fixed to pass the nxstyle CI erros Signed-off-by: Alin Jerpelea --- drivers/mtd/mtd_nandscheme.c | 112 +++++++++-------------------------- 1 file changed, 29 insertions(+), 83 deletions(-) diff --git a/drivers/mtd/mtd_nandscheme.c b/drivers/mtd/mtd_nandscheme.c index 69a2ec4271..1f3b42cc53 100644 --- a/drivers/mtd/mtd_nandscheme.c +++ b/drivers/mtd/mtd_nandscheme.c @@ -60,110 +60,56 @@ const struct nand_scheme_s g_nand_sparescheme256 = { - /* Bad block marker is at position #5 */ - - 5, - - /* 3 ecc bytes */ - - 3, - - /* 4 extra bytes */ - - 4, - - /* Ecc bytes positions */ - - {0, 1, 2}, - - /* Extra bytes positions */ - - {3, 4, 6, 7} + 5, /* Bad block marker is at position #5 */ + 3, /* 3 ecc bytes */ + 4, /* 4 extra bytes */ + {0, 1, 2}, /* Ecc bytes positions */ + {3, 4, 6, 7}, /* Extra bytes positions */ }; /* Spare area placement scheme for 512 byte pages */ const struct nand_scheme_s g_nand_sparescheme512 = { - /* Bad block marker is at position #5 */ - - 5, - - /* 6 ecc bytes */ - - 6, - - /* 8 extra bytes */ - - 8, - - /* Ecc bytes positions */ - - {0, 1, 2, 3, 6, 7}, - - /* Extra bytes positions */ - - {8, 9, 10, 11, 12, 13, 14, 15} + 5, /* Bad block marker is at position #5 */ + 6, /* 6 ecc bytes */ + 8, /* 8 extra bytes */ + {0, 1, 2, 3, 6, 7}, /* Ecc bytes positions */ + {8, 9, 10, 11, 12, 13, 14, 15}, /* Extra bytes positions */ }; /* Spare area placement scheme for 2048 byte pages */ const struct nand_scheme_s g_nand_sparescheme2048 = { - /* Bad block marker is at position #0 */ - - 0, - - /* 24 ecc bytes */ - - 24, - - /* 38 extra bytes */ - - 38, - - /* Ecc bytes positions */ - + 0, /* Bad block marker is at position #0 */ + 24, /* 24 ecc bytes */ + 38, /* 38 extra bytes */ {40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63}, - - /* Extra bytes positions */ + 58, 59, 60, 61, 62, 63}, /* Ecc bytes positions */ { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39} + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39}, /* Extra bytes positions */ }; /* Spare area placement scheme for 4096 byte pages. */ const struct nand_scheme_s g_nand_sparescheme4096 = { - /* Bad block marker is at position #0 */ - - 0, - - /* 48 ecc bytes */ - - 48, - - /* 78 extra bytes */ - - 78, - - /* Ecc bytes positions */ - - { 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127}, - - /* Extra bytes positions */ + 0, /* Bad block marker is at position #0 */ + 48, /* 48 ecc bytes */ + 78, /* 78 extra bytes */ + {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, + 122, 123, 124, 125, 126, 127}, /* Ecc bytes positions */ { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79} + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 78, 79}, /* Extra bytes positions */ }; /**************************************************************************** @@ -300,7 +246,7 @@ void nandscheme_readextra(FAR const struct nand_scheme_s *scheme, for (i = 0; i < size; i++) { - ((uint8_t *)extra)[i] = spare[scheme->xbytepos[i+offset]]; + ((uint8_t *)extra)[i] = spare[scheme->xbytepos[i + offset]]; } } @@ -332,7 +278,7 @@ void nandscheme_writeextra(FAR const struct nand_scheme_s *scheme, uint32_t i; for (i = 0; i < size; i++) { - spare[scheme->xbytepos[i+offset]] = ((uint8_t *) extra)[i]; + spare[scheme->xbytepos[i + offset]] = ((uint8_t *) extra)[i]; } }