aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2010-09-07 07:23:43 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-24 18:50:52 -0400
commitf8ac04140e2215e1680440d5a8642553b0d2fa2d (patch)
tree00585872efe4db499fd861e8e39a3a8666f31888 /drivers/mtd/nand
parent2bdb053a8119355eada46dfab88782449a26b39d (diff)
mtd: fix all checkpatch errors in nand_base.c
Artem: it is much easier to verify patches against nand_base.c with checkpatch.pl when nand_base.c itself does not have so many checkpatch.pl warnings. Signed-off-by: Florian Fainelli <ffainelli@freebox.fr> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/nand_base.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 5b96f621f7c9..50c0d5f1c80a 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -59,7 +59,7 @@ static struct nand_ecclayout nand_oob_8 = {
59 {.offset = 3, 59 {.offset = 3,
60 .length = 2}, 60 .length = 2},
61 {.offset = 6, 61 {.offset = 6,
62 .length = 2}} 62 .length = 2} }
63}; 63};
64 64
65static struct nand_ecclayout nand_oob_16 = { 65static struct nand_ecclayout nand_oob_16 = {
@@ -67,7 +67,7 @@ static struct nand_ecclayout nand_oob_16 = {
67 .eccpos = {0, 1, 2, 3, 6, 7}, 67 .eccpos = {0, 1, 2, 3, 6, 7},
68 .oobfree = { 68 .oobfree = {
69 {.offset = 8, 69 {.offset = 8,
70 . length = 8}} 70 . length = 8} }
71}; 71};
72 72
73static struct nand_ecclayout nand_oob_64 = { 73static struct nand_ecclayout nand_oob_64 = {
@@ -78,7 +78,7 @@ static struct nand_ecclayout nand_oob_64 = {
78 56, 57, 58, 59, 60, 61, 62, 63}, 78 56, 57, 58, 59, 60, 61, 62, 63},
79 .oobfree = { 79 .oobfree = {
80 {.offset = 2, 80 {.offset = 2,
81 .length = 38}} 81 .length = 38} }
82}; 82};
83 83
84static struct nand_ecclayout nand_oob_128 = { 84static struct nand_ecclayout nand_oob_128 = {
@@ -92,7 +92,7 @@ static struct nand_ecclayout nand_oob_128 = {
92 120, 121, 122, 123, 124, 125, 126, 127}, 92 120, 121, 122, 123, 124, 125, 126, 127},
93 .oobfree = { 93 .oobfree = {
94 {.offset = 2, 94 {.offset = 2,
95 .length = 78}} 95 .length = 78} }
96}; 96};
97 97
98static int nand_get_device(struct nand_chip *chip, struct mtd_info *mtd, 98static int nand_get_device(struct nand_chip *chip, struct mtd_info *mtd,
@@ -612,7 +612,8 @@ static void nand_command(struct mtd_info *mtd, unsigned int command,
612 NAND_CTRL_CLE | NAND_CTRL_CHANGE); 612 NAND_CTRL_CLE | NAND_CTRL_CHANGE);
613 chip->cmd_ctrl(mtd, 613 chip->cmd_ctrl(mtd,
614 NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); 614 NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE);
615 while (!(chip->read_byte(mtd) & NAND_STATUS_READY)) ; 615 while (!(chip->read_byte(mtd) & NAND_STATUS_READY))
616 ;
616 return; 617 return;
617 618
618 /* This applies to read commands */ 619 /* This applies to read commands */
@@ -718,7 +719,8 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command,
718 NAND_NCE | NAND_CLE | NAND_CTRL_CHANGE); 719 NAND_NCE | NAND_CLE | NAND_CTRL_CHANGE);
719 chip->cmd_ctrl(mtd, NAND_CMD_NONE, 720 chip->cmd_ctrl(mtd, NAND_CMD_NONE,
720 NAND_NCE | NAND_CTRL_CHANGE); 721 NAND_NCE | NAND_CTRL_CHANGE);
721 while (!(chip->read_byte(mtd) & NAND_STATUS_READY)) ; 722 while (!(chip->read_byte(mtd) & NAND_STATUS_READY))
723 ;
722 return; 724 return;
723 725
724 case NAND_CMD_RNDOUT: 726 case NAND_CMD_RNDOUT:
@@ -834,7 +836,7 @@ static void panic_nand_wait(struct mtd_info *mtd, struct nand_chip *chip,
834 break; 836 break;
835 } 837 }
836 mdelay(1); 838 mdelay(1);
837 } 839 }
838} 840}
839 841
840/** 842/**
@@ -1390,7 +1392,7 @@ static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
1390static uint8_t *nand_transfer_oob(struct nand_chip *chip, uint8_t *oob, 1392static uint8_t *nand_transfer_oob(struct nand_chip *chip, uint8_t *oob,
1391 struct mtd_oob_ops *ops, size_t len) 1393 struct mtd_oob_ops *ops, size_t len)
1392{ 1394{
1393 switch(ops->mode) { 1395 switch (ops->mode) {
1394 1396
1395 case MTD_OOB_PLACE: 1397 case MTD_OOB_PLACE:
1396 case MTD_OOB_RAW: 1398 case MTD_OOB_RAW:
@@ -1402,7 +1404,7 @@ static uint8_t *nand_transfer_oob(struct nand_chip *chip, uint8_t *oob,
1402 uint32_t boffs = 0, roffs = ops->ooboffs; 1404 uint32_t boffs = 0, roffs = ops->ooboffs;
1403 size_t bytes = 0; 1405 size_t bytes = 0;
1404 1406
1405 for(; free->length && len; free++, len -= bytes) { 1407 for (; free->length && len; free++, len -= bytes) {
1406 /* Read request not from offset 0 ? */ 1408 /* Read request not from offset 0 ? */
1407 if (unlikely(roffs)) { 1409 if (unlikely(roffs)) {
1408 if (roffs >= free->length) { 1410 if (roffs >= free->length) {
@@ -1466,7 +1468,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
1466 buf = ops->datbuf; 1468 buf = ops->datbuf;
1467 oob = ops->oobbuf; 1469 oob = ops->oobbuf;
1468 1470
1469 while(1) { 1471 while (1) {
1470 bytes = min(mtd->writesize - col, readlen); 1472 bytes = min(mtd->writesize - col, readlen);
1471 aligned = (bytes == mtd->writesize); 1473 aligned = (bytes == mtd->writesize);
1472 1474
@@ -1791,7 +1793,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
1791 realpage = (int)(from >> chip->page_shift); 1793 realpage = (int)(from >> chip->page_shift);
1792 page = realpage & chip->pagemask; 1794 page = realpage & chip->pagemask;
1793 1795
1794 while(1) { 1796 while (1) {
1795 sndcmd = chip->ecc.read_oob(mtd, chip, page, sndcmd); 1797 sndcmd = chip->ecc.read_oob(mtd, chip, page, sndcmd);
1796 1798
1797 len = min(len, readlen); 1799 len = min(len, readlen);
@@ -1861,7 +1863,7 @@ static int nand_read_oob(struct mtd_info *mtd, loff_t from,
1861 1863
1862 nand_get_device(chip, mtd, FL_READING); 1864 nand_get_device(chip, mtd, FL_READING);
1863 1865
1864 switch(ops->mode) { 1866 switch (ops->mode) {
1865 case MTD_OOB_PLACE: 1867 case MTD_OOB_PLACE:
1866 case MTD_OOB_AUTO: 1868 case MTD_OOB_AUTO:
1867 case MTD_OOB_RAW: 1869 case MTD_OOB_RAW:
@@ -2099,7 +2101,7 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
2099static uint8_t *nand_fill_oob(struct nand_chip *chip, uint8_t *oob, size_t len, 2101static uint8_t *nand_fill_oob(struct nand_chip *chip, uint8_t *oob, size_t len,
2100 struct mtd_oob_ops *ops) 2102 struct mtd_oob_ops *ops)
2101{ 2103{
2102 switch(ops->mode) { 2104 switch (ops->mode) {
2103 2105
2104 case MTD_OOB_PLACE: 2106 case MTD_OOB_PLACE:
2105 case MTD_OOB_RAW: 2107 case MTD_OOB_RAW:
@@ -2111,7 +2113,7 @@ static uint8_t *nand_fill_oob(struct nand_chip *chip, uint8_t *oob, size_t len,
2111 uint32_t boffs = 0, woffs = ops->ooboffs; 2113 uint32_t boffs = 0, woffs = ops->ooboffs;
2112 size_t bytes = 0; 2114 size_t bytes = 0;
2113 2115
2114 for(; free->length && len; free++, len -= bytes) { 2116 for (; free->length && len; free++, len -= bytes) {
2115 /* Write request not from offset 0 ? */ 2117 /* Write request not from offset 0 ? */
2116 if (unlikely(woffs)) { 2118 if (unlikely(woffs)) {
2117 if (woffs >= free->length) { 2119 if (woffs >= free->length) {
@@ -2137,7 +2139,7 @@ static uint8_t *nand_fill_oob(struct nand_chip *chip, uint8_t *oob, size_t len,
2137 return NULL; 2139 return NULL;
2138} 2140}
2139 2141
2140#define NOTALIGNED(x) (x & (chip->subpagesize - 1)) != 0 2142#define NOTALIGNED(x) ((x & (chip->subpagesize - 1)) != 0)
2141 2143
2142/** 2144/**
2143 * nand_do_write_ops - [Internal] NAND write with ECC 2145 * nand_do_write_ops - [Internal] NAND write with ECC
@@ -2203,7 +2205,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
2203 if (ops->ooboffs && (ops->ooboffs + ops->ooblen > oobmaxlen)) 2205 if (ops->ooboffs && (ops->ooboffs + ops->ooblen > oobmaxlen))
2204 return -EINVAL; 2206 return -EINVAL;
2205 2207
2206 while(1) { 2208 while (1) {
2207 int bytes = mtd->writesize; 2209 int bytes = mtd->writesize;
2208 int cached = writelen > bytes && page != blockmask; 2210 int cached = writelen > bytes && page != blockmask;
2209 uint8_t *wbuf = buf; 2211 uint8_t *wbuf = buf;
@@ -2431,7 +2433,7 @@ static int nand_write_oob(struct mtd_info *mtd, loff_t to,
2431 2433
2432 nand_get_device(chip, mtd, FL_WRITING); 2434 nand_get_device(chip, mtd, FL_WRITING);
2433 2435
2434 switch(ops->mode) { 2436 switch (ops->mode) {
2435 case MTD_OOB_PLACE: 2437 case MTD_OOB_PLACE:
2436 case MTD_OOB_AUTO: 2438 case MTD_OOB_AUTO:
2437 case MTD_OOB_RAW: 2439 case MTD_OOB_RAW:
@@ -2511,7 +2513,7 @@ int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
2511{ 2513{
2512 int page, status, pages_per_block, ret, chipnr; 2514 int page, status, pages_per_block, ret, chipnr;
2513 struct nand_chip *chip = mtd->priv; 2515 struct nand_chip *chip = mtd->priv;
2514 loff_t rewrite_bbt[NAND_MAX_CHIPS]={0}; 2516 loff_t rewrite_bbt[NAND_MAX_CHIPS] = {0};
2515 unsigned int bbt_masked_page = 0xffffffff; 2517 unsigned int bbt_masked_page = 0xffffffff;
2516 loff_t len; 2518 loff_t len;
2517 2519
@@ -2706,7 +2708,8 @@ static int nand_block_markbad(struct mtd_info *mtd, loff_t ofs)
2706 struct nand_chip *chip = mtd->priv; 2708 struct nand_chip *chip = mtd->priv;
2707 int ret; 2709 int ret;
2708 2710
2709 if ((ret = nand_block_isbad(mtd, ofs))) { 2711 ret = nand_block_isbad(mtd, ofs);
2712 if (ret) {
2710 /* If it was bad already, return success and do nothing. */ 2713 /* If it was bad already, return success and do nothing. */
2711 if (ret > 0) 2714 if (ret > 0)
2712 return 0; 2715 return 0;
@@ -2935,7 +2938,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
2935 2938
2936 for (; type->name != NULL; type++) 2939 for (; type->name != NULL; type++)
2937 if (*dev_id == type->id) 2940 if (*dev_id == type->id)
2938 break; 2941 break;
2939 2942
2940 chip->onfi_version = 0; 2943 chip->onfi_version = 0;
2941 if (!type->name || !type->pagesize) { 2944 if (!type->name || !type->pagesize) {
@@ -3137,7 +3140,7 @@ ident_done:
3137 printk(KERN_INFO "NAND device: Manufacturer ID:" 3140 printk(KERN_INFO "NAND device: Manufacturer ID:"
3138 " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id, 3141 " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, *dev_id,
3139 nand_manuf_ids[maf_idx].name, 3142 nand_manuf_ids[maf_idx].name,
3140 chip->onfi_version ? type->name:chip->onfi_params.model); 3143 chip->onfi_version ? type->name : chip->onfi_params.model);
3141 3144
3142 return type; 3145 return type;
3143} 3146}
@@ -3360,7 +3363,7 @@ int nand_scan_tail(struct mtd_info *mtd)
3360 * mode 3363 * mode
3361 */ 3364 */
3362 chip->ecc.steps = mtd->writesize / chip->ecc.size; 3365 chip->ecc.steps = mtd->writesize / chip->ecc.size;
3363 if(chip->ecc.steps * chip->ecc.size != mtd->writesize) { 3366 if (chip->ecc.steps * chip->ecc.size != mtd->writesize) {
3364 printk(KERN_WARNING "Invalid ecc parameters\n"); 3367 printk(KERN_WARNING "Invalid ecc parameters\n");
3365 BUG(); 3368 BUG();
3366 } 3369 }
@@ -3372,7 +3375,7 @@ int nand_scan_tail(struct mtd_info *mtd)
3372 */ 3375 */
3373 if (!(chip->options & NAND_NO_SUBPAGE_WRITE) && 3376 if (!(chip->options & NAND_NO_SUBPAGE_WRITE) &&
3374 !(chip->cellinfo & NAND_CI_CELLTYPE_MSK)) { 3377 !(chip->cellinfo & NAND_CI_CELLTYPE_MSK)) {
3375 switch(chip->ecc.steps) { 3378 switch (chip->ecc.steps) {
3376 case 2: 3379 case 2:
3377 mtd->subpage_sft = 1; 3380 mtd->subpage_sft = 1;
3378 break; 3381 break;