aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2016-03-04 12:13:10 -0500
committerBoris Brezillon <boris.brezillon@free-electrons.com>2016-04-19 16:05:47 -0400
commitc4f3ef2c6c219c3e58e0f5a9589a67685a75d787 (patch)
treeb45a6778b7bc5f9389b53893a8f5c56357a2c65b /drivers/mtd
parent828dec153044805506cc2b8e39cb3f62d5f76a12 (diff)
mtd: nand: sunxi: make cur_off parameter optional in extra oob helpers
Allow for NULL cur_offs values when the caller does not know where the NAND page register pointer points to. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/sunxi_nand.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index b71053252a02..b12ed83ebd56 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -956,7 +956,7 @@ static void sunxi_nfc_hw_ecc_read_extra_oob(struct mtd_info *mtd,
956 if (len <= 0) 956 if (len <= 0)
957 return; 957 return;
958 958
959 if (*cur_off != offset) 959 if (!cur_off || *cur_off != offset)
960 nand->cmdfunc(mtd, NAND_CMD_RNDOUT, 960 nand->cmdfunc(mtd, NAND_CMD_RNDOUT,
961 offset + mtd->writesize, -1); 961 offset + mtd->writesize, -1);
962 962
@@ -966,7 +966,8 @@ static void sunxi_nfc_hw_ecc_read_extra_oob(struct mtd_info *mtd,
966 sunxi_nfc_randomizer_read_buf(mtd, oob + offset, len, 966 sunxi_nfc_randomizer_read_buf(mtd, oob + offset, len,
967 false, page); 967 false, page);
968 968
969 *cur_off = mtd->oobsize + mtd->writesize; 969 if (cur_off)
970 *cur_off = mtd->oobsize + mtd->writesize;
970} 971}
971 972
972static int sunxi_nfc_hw_ecc_write_chunk(struct mtd_info *mtd, 973static int sunxi_nfc_hw_ecc_write_chunk(struct mtd_info *mtd,
@@ -1021,13 +1022,14 @@ static void sunxi_nfc_hw_ecc_write_extra_oob(struct mtd_info *mtd,
1021 if (len <= 0) 1022 if (len <= 0)
1022 return; 1023 return;
1023 1024
1024 if (*cur_off != offset) 1025 if (!cur_off || *cur_off != offset)
1025 nand->cmdfunc(mtd, NAND_CMD_RNDIN, 1026 nand->cmdfunc(mtd, NAND_CMD_RNDIN,
1026 offset + mtd->writesize, -1); 1027 offset + mtd->writesize, -1);
1027 1028
1028 sunxi_nfc_randomizer_write_buf(mtd, oob + offset, len, false, page); 1029 sunxi_nfc_randomizer_write_buf(mtd, oob + offset, len, false, page);
1029 1030
1030 *cur_off = mtd->oobsize + mtd->writesize; 1031 if (cur_off)
1032 *cur_off = mtd->oobsize + mtd->writesize;
1031} 1033}
1032 1034
1033static int sunxi_nfc_hw_ecc_read_page(struct mtd_info *mtd, 1035static int sunxi_nfc_hw_ecc_read_page(struct mtd_info *mtd,