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>
This commit is contained in:
parent
1196ac5a99
commit
596d74527a
@ -183,16 +183,16 @@ static int read_bbt(struct mtd_info *mtd, uint8_t *buf, int page, int num,
|
|||||||
size_t retlen, len, totlen;
|
size_t retlen, len, totlen;
|
||||||
loff_t from;
|
loff_t from;
|
||||||
int bits = td->options & NAND_BBT_NRBITS_MSK;
|
int bits = td->options & NAND_BBT_NRBITS_MSK;
|
||||||
uint8_t msk = (uint8_t) ((1 << bits) - 1);
|
uint8_t msk = (uint8_t)((1 << bits) - 1);
|
||||||
u32 marker_len;
|
u32 marker_len;
|
||||||
int reserved_block_code = td->reserved_block_code;
|
int reserved_block_code = td->reserved_block_code;
|
||||||
|
|
||||||
totlen = (num * bits) >> 3;
|
totlen = (num * bits) >> 3;
|
||||||
marker_len = add_marker_len(td);
|
marker_len = add_marker_len(td);
|
||||||
from = ((loff_t) page) << this->page_shift;
|
from = ((loff_t)page) << this->page_shift;
|
||||||
|
|
||||||
while (totlen) {
|
while (totlen) {
|
||||||
len = min(totlen, (size_t) (1 << this->bbt_erase_shift));
|
len = min(totlen, (size_t)(1 << this->bbt_erase_shift));
|
||||||
if (marker_len) {
|
if (marker_len) {
|
||||||
/*
|
/*
|
||||||
* In case the BBT marker is not in the OOB area it
|
* 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,
|
|||||||
* @mtd: MTD device structure
|
* @mtd: MTD device structure
|
||||||
* @buf: temporary buffer
|
* @buf: temporary buffer
|
||||||
* @td: descriptor for the bad block table
|
* @td: descriptor for the bad block table
|
||||||
* @chip: read the table for a specific chip, -1 read all chips; aplies only if
|
* @chip: read the table for a specific chip, -1 read all chips; applies only if
|
||||||
* NAND_BBT_PERCHIP option is set
|
* NAND_BBT_PERCHIP option is set
|
||||||
*
|
*
|
||||||
* Read the bad block table for all chips starting at a given page. We assume
|
* 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,
|
|||||||
|
|
||||||
bbtoffs = chip * (numblocks >> 2);
|
bbtoffs = chip * (numblocks >> 2);
|
||||||
|
|
||||||
to = ((loff_t) page) << this->page_shift;
|
to = ((loff_t)page) << this->page_shift;
|
||||||
|
|
||||||
/* Must we save the block contents? */
|
/* Must we save the block contents? */
|
||||||
if (td->options & NAND_BBT_SAVECONTENT) {
|
if (td->options & NAND_BBT_SAVECONTENT) {
|
||||||
/* Make it block aligned */
|
/* Make it block aligned */
|
||||||
to &= ~((loff_t) ((1 << this->bbt_erase_shift) - 1));
|
to &= ~((loff_t)((1 << this->bbt_erase_shift) - 1));
|
||||||
len = 1 << this->bbt_erase_shift;
|
len = 1 << this->bbt_erase_shift;
|
||||||
res = mtd->read(mtd, to, len, &retlen, buf);
|
res = mtd->read(mtd, to, len, &retlen, buf);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
@ -771,7 +771,7 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf,
|
|||||||
pageoffs = page - (int)(to >> this->page_shift);
|
pageoffs = page - (int)(to >> this->page_shift);
|
||||||
offs = pageoffs << this->page_shift;
|
offs = pageoffs << this->page_shift;
|
||||||
/* Preset the bbt area with 0xff */
|
/* Preset the bbt area with 0xff */
|
||||||
memset(&buf[offs], 0xff, (size_t) (numblocks >> sft));
|
memset(&buf[offs], 0xff, (size_t)(numblocks >> sft));
|
||||||
ooboffs = len + (pageoffs * mtd->oobsize);
|
ooboffs = len + (pageoffs * mtd->oobsize);
|
||||||
|
|
||||||
} else if (td->options & NAND_BBT_NO_OOB) {
|
} else if (td->options & NAND_BBT_NO_OOB) {
|
||||||
@ -781,7 +781,7 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf,
|
|||||||
if (td->options & NAND_BBT_VERSION)
|
if (td->options & NAND_BBT_VERSION)
|
||||||
offs++;
|
offs++;
|
||||||
/* Calc length */
|
/* Calc length */
|
||||||
len = (size_t) (numblocks >> sft);
|
len = (size_t)(numblocks >> sft);
|
||||||
len += offs;
|
len += offs;
|
||||||
/* Make it page aligned! */
|
/* Make it page aligned! */
|
||||||
len = ALIGN(len, mtd->writesize);
|
len = ALIGN(len, mtd->writesize);
|
||||||
@ -791,7 +791,7 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf,
|
|||||||
memcpy(buf, td->pattern, td->len);
|
memcpy(buf, td->pattern, td->len);
|
||||||
} else {
|
} else {
|
||||||
/* Calc length */
|
/* Calc length */
|
||||||
len = (size_t) (numblocks >> sft);
|
len = (size_t)(numblocks >> sft);
|
||||||
/* Make it page aligned! */
|
/* Make it page aligned! */
|
||||||
len = ALIGN(len, mtd->writesize);
|
len = ALIGN(len, mtd->writesize);
|
||||||
/* Preset the buffer with 0xff */
|
/* Preset the buffer with 0xff */
|
||||||
@ -903,14 +903,14 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
|
|||||||
if (td->pages[i] == -1) {
|
if (td->pages[i] == -1) {
|
||||||
rd = md;
|
rd = md;
|
||||||
td->version[i] = md->version[i];
|
td->version[i] = md->version[i];
|
||||||
writeops = 1;
|
writeops = 0x01;
|
||||||
goto writecheck;
|
goto writecheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (md->pages[i] == -1) {
|
if (md->pages[i] == -1) {
|
||||||
rd = td;
|
rd = td;
|
||||||
md->version[i] = td->version[i];
|
md->version[i] = td->version[i];
|
||||||
writeops = 2;
|
writeops = 0x02;
|
||||||
goto writecheck;
|
goto writecheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -921,14 +921,14 @@ static int check_create(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_desc
|
|||||||
goto writecheck;
|
goto writecheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((int8_t) (td->version[i] - md->version[i])) > 0) {
|
if (((int8_t)(td->version[i] - md->version[i])) > 0) {
|
||||||
rd = td;
|
rd = td;
|
||||||
md->version[i] = td->version[i];
|
md->version[i] = td->version[i];
|
||||||
writeops = 2;
|
writeops = 0x02;
|
||||||
} else {
|
} else {
|
||||||
rd = md;
|
rd = md;
|
||||||
td->version[i] = md->version[i];
|
td->version[i] = md->version[i];
|
||||||
writeops = 1;
|
writeops = 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto writecheck;
|
goto writecheck;
|
||||||
|
Loading…
Reference in New Issue
Block a user