]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mtd: nand: sunxi: make cur_off parameter optional in extra oob helpers
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Fri, 4 Mar 2016 17:13:10 +0000 (18:13 +0100)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 19 Apr 2016 20:05:47 +0000 (22:05 +0200)
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>
drivers/mtd/nand/sunxi_nand.c

index b71053252a0228e9abc4fcf33e3815371935dd43..b12ed83ebd564d0d5835f6849822f4a08537372b 100644 (file)
@@ -956,7 +956,7 @@ static void sunxi_nfc_hw_ecc_read_extra_oob(struct mtd_info *mtd,
        if (len <= 0)
                return;
 
-       if (*cur_off != offset)
+       if (!cur_off || *cur_off != offset)
                nand->cmdfunc(mtd, NAND_CMD_RNDOUT,
                              offset + mtd->writesize, -1);
 
@@ -966,7 +966,8 @@ static void sunxi_nfc_hw_ecc_read_extra_oob(struct mtd_info *mtd,
                sunxi_nfc_randomizer_read_buf(mtd, oob + offset, len,
                                              false, page);
 
-       *cur_off = mtd->oobsize + mtd->writesize;
+       if (cur_off)
+               *cur_off = mtd->oobsize + mtd->writesize;
 }
 
 static 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,
        if (len <= 0)
                return;
 
-       if (*cur_off != offset)
+       if (!cur_off || *cur_off != offset)
                nand->cmdfunc(mtd, NAND_CMD_RNDIN,
                              offset + mtd->writesize, -1);
 
        sunxi_nfc_randomizer_write_buf(mtd, oob + offset, len, false, page);
 
-       *cur_off = mtd->oobsize + mtd->writesize;
+       if (cur_off)
+               *cur_off = mtd->oobsize + mtd->writesize;
 }
 
 static int sunxi_nfc_hw_ecc_read_page(struct mtd_info *mtd,