Skip to content

Commit

Permalink
mtd: nand: sunxi: make cur_off parameter optional in extra oob helpers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Boris Brezillon committed Apr 19, 2016
1 parent 828dec1 commit c4f3ef2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/mtd/nand/sunxi_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit c4f3ef2

Please sign in to comment.