Commit 191a8294 authored by Boris Brezillon's avatar Boris Brezillon

mtd: nand: gpmi: use mtd_ooblayout_xxx() helpers where appropriate

The mtd_ooblayout_xxx() helper functions have been added to avoid direct
accesses to the ecclayout field, and thus ease for future reworks.
Use these helpers in all places where the oobfree[] and eccpos[] arrays
where directly accessed.
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent 9ed92dd2
...@@ -1328,18 +1328,19 @@ static int gpmi_ecc_read_oob(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -1328,18 +1328,19 @@ static int gpmi_ecc_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
static int static int
gpmi_ecc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, int page) gpmi_ecc_write_oob(struct mtd_info *mtd, struct nand_chip *chip, int page)
{ {
struct nand_oobfree *of = mtd->ecclayout->oobfree; struct mtd_oob_region of = { };
int status = 0; int status = 0;
/* Do we have available oob area? */ /* Do we have available oob area? */
if (!of->length) mtd_ooblayout_free(mtd, 0, &of);
if (!of.length)
return -EPERM; return -EPERM;
if (!nand_is_slc(chip)) if (!nand_is_slc(chip))
return -EPERM; return -EPERM;
chip->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize + of->offset, page); chip->cmdfunc(mtd, NAND_CMD_SEQIN, mtd->writesize + of.offset, page);
chip->write_buf(mtd, chip->oob_poi + of->offset, of->length); chip->write_buf(mtd, chip->oob_poi + of.offset, of.length);
chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1); chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
status = chip->waitfunc(mtd, chip); status = chip->waitfunc(mtd, chip);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment