diff options
author | Brian Norris <computersforpeace@gmail.com> | 2011-09-07 16:13:33 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-11 09:59:58 -0400 |
commit | 596d74527a804418d88e1178c9d72aff5649e89c (patch) | |
tree | 6838d3fcf3482ab51818ba6bffcf1a7dbf427c7c /drivers/mtd | |
parent | 1196ac5a9969f180c67e9a4454384250ab034452 (diff) |
mtd: nand: fix style
Remove some extra spaces
Consistently use '0x' prefix for bitfield-like constants
Spelling: "aplies" -> "applies"
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.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c index c1074ac9bdac..e962167c9b71 100644 --- a/drivers/mtd/nand/nand_bbt.c +++ b/drivers/mtd/nand/nand_bbt.c | |||
@@ -183,16 +183,16 @@ static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num, | |||
183 | size_t retlen, len, totlen; | 183 | size_t retlen, len, totlen; |
184 | loff_t from; | 184 | loff_t from; |
185 | int bits = td->options & NAND_BBT_NRBITS_MSK; | 185 | int bits = td->options & NAND_BBT_NRBITS_MSK; |
186 | uint8_t msk = (uint8_t) ((1 << bits) - 1); | 186 | uint8_t msk = (uint8_t)((1 << bits) - 1); |
187 | u32 marker_len; | 187 | u32 marker_len; |
188 | int reserved_block_code = td->reserved_block_code; | 188 | int reserved_block_code = td->reserved_block_code; |
189 | 189 | ||
190 | totlen = (num * bits) >> 3; | 190 | totlen = (num * bits) >> 3; |
191 | marker_len = add_marker_len(td); | 191 | marker_len = add_marker_len(td); |
192 | from = ((loff_t) page) << this->page_shift; | 192 | from = ((loff_t)page) << this->page_shift; |
193 | 193 | ||
194 | while (totlen) { | 194 | while (totlen) { |
195 | len = min(totlen, (size_t) (1 << this->bbt_erase_shift)); | 195 | len = min(totlen, (size_t)(1 << this->bbt_erase_shift)); |
196 | if (marker_len) { | 196 | if (marker_len) { |
197 | /* | 197 | /* |
198 | * In case the BBT marker is not in the OOB area it | 198 | * In case the BBT marker is not in the OOB area it |
@@ -250,7 +250,7 @@ static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num, | |||
250 | * @mtd: MTD device structure | 250 | * @mtd: MTD device structure |
251 | * @buf: temporary buffer | 251 | * @buf: temporary buffer |
252 | * @td: descriptor for the bad block table | 252 | * @td: descriptor for the bad block table |
253 | * @chip: read the table for a specific chip, -1 read all chips; aplies only if | 253 | * @chip: read the table for a specific chip, -1 read all chips; applies only if |
254 | * NAND_BBT_PERCHIP option is set | 254 | * NAND_BBT_PERCHIP option is set |
255 | * | 255 | * |
256 | * Read the bad block table for all chips starting at a given page. We assume | 256 | * Read the bad block table for all chips starting at a given page. We assume |
@@ -743,12 +743,12 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
743 | 743 | ||
744 | bbtoffs = chip * (numblocks >> 2); | 744 | bbtoffs = chip * (numblocks >> 2); |
745 | 745 | ||
746 | to = ((loff_t) page) << this->page_shift; | 746 | to = ((loff_t)page) << this->page_shift; |
747 | 747 | ||
748 | /* Must we save the block contents? */ | 748 | /* Must we save the block contents? */ |
749 | if (td->options & NAND_BBT_SAVECONTENT) { | 749 | if (td->options & NAND_BBT_SAVECONTENT) { |
750 | /* Make it block aligned */ | 750 | /* Make it block aligned */ |
751 | to &= ~((loff_t) ((1 << this->bbt_erase_shift) - 1)); | 751 | to &= ~((loff_t)((1 << this->bbt_erase_shift) - 1)); |
752 | len = 1 << this->bbt_erase_shift; | 752 | len = 1 << this->bbt_erase_shift; |
753 | res = mtd->read(mtd, to, len, &retlen, buf); | 753 | res = mtd->read(mtd, to, len, &retlen, buf); |
754 | if (res < 0) { | 754 | if (res < 0) { |
@@ -771,7 +771,7 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
771 | pageoffs = page - (int)(to >> this->page_shift); | 771 | pageoffs = page - (int)(to >> this->page_shift); |
772 | offs = pageoffs << this->page_shift; | 772 | offs = pageoffs << this->page_shift; |
773 | /* Preset the bbt area with 0xff */ | 773 | /* Preset the bbt area with 0xff */ |
774 | memset(&buf[offs], 0xff, (size_t) (numblocks >> sft)); | 774 | memset(&buf[offs], 0xff, (size_t)(numblocks >> sft)); |
775 | ooboffs = len + (pageoffs * mtd->oobsize); | 775 | ooboffs = len + (pageoffs * mtd->oobsize); |
776 | 776 | ||
777 | } else if (td->options & NAND_BBT_NO_OOB) { | 777 | } else if (td->options & NAND_BBT_NO_OOB) { |
@@ -781,7 +781,7 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
781 | if (td->options & NAND_BBT_VERSION) | 781 | if (td->options & NAND_BBT_VERSION) |
782 | offs++; | 782 | offs++; |
783 | /* Calc length */ | 783 | /* Calc length */ |
784 | len = (size_t) (numblocks >> sft); | 784 | len = (size_t)(numblocks >> sft); |
785 | len += offs; | 785 | len += offs; |
786 | /* Make it page aligned! */ | 786 | /* Make it page aligned! */ |
787 | len = ALIGN(len, mtd->writesize); | 787 | len = ALIGN(len, mtd->writesize); |
@@ -791,7 +791,7 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf, | |||
791 | memcpy(buf, td->pattern, td->len); | 791 | memcpy(buf, td->pattern, td->len); |
792 | } else { | 792 | } else { |
793 | /* Calc length */ | 793 | /* Calc length */ |
794 | len = (size_t) (numblocks >> sft); | 794 | len = (size_t)(numblocks >> sft); |
795 | /* Make it page aligned! */ | 795 | /* Make it page aligned! */ |
796 | len = ALIGN(len, mtd->writesize); | 796 | len = ALIGN(len, mtd->writesize); |
797 | /* Preset the buffer with 0xff */ | 797 | /* Preset the buffer with 0xff */ |
@@ -903,14 +903,14 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc | |||
903 | if (td->pages[i] == -1) { | 903 | if (td->pages[i] == -1) { |
904 | rd = md; | 904 | rd = md; |
905 | td->version[i] = md->version[i]; | 905 | td->version[i] = md->version[i]; |
906 | writeops = 1; | 906 | writeops = 0x01; |
907 | goto writecheck; | 907 | goto writecheck; |
908 | } | 908 | } |
909 | 909 | ||
910 | if (md->pages[i] == -1) { | 910 | if (md->pages[i] == -1) { |
911 | rd = td; | 911 | rd = td; |
912 | md->version[i] = td->version[i]; | 912 | md->version[i] = td->version[i]; |
913 | writeops = 2; | 913 | writeops = 0x02; |
914 | goto writecheck; | 914 | goto writecheck; |
915 | } | 915 | } |
916 | 916 | ||
@@ -921,14 +921,14 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc | |||
921 | goto writecheck; | 921 | goto writecheck; |
922 | } | 922 | } |
923 | 923 | ||
924 | if (((int8_t) (td->version[i] - md->version[i])) > 0) { | 924 | if (((int8_t)(td->version[i] - md->version[i])) > 0) { |
925 | rd = td; | 925 | rd = td; |
926 | md->version[i] = td->version[i]; | 926 | md->version[i] = td->version[i]; |
927 | writeops = 2; | 927 | writeops = 0x02; |
928 | } else { | 928 | } else { |
929 | rd = md; | 929 | rd = md; |
930 | td->version[i] = md->version[i]; | 930 | td->version[i] = md->version[i]; |
931 | writeops = 1; | 931 | writeops = 0x01; |
932 | } | 932 | } |
933 | 933 | ||
934 | goto writecheck; | 934 | goto writecheck; |