summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/raw/nand_base.c
diff options
context:
space:
mode:
authorBoris Brezillon <bbrezillon@kernel.org>2018-10-28 15:27:55 +0100
committerMiquel Raynal <miquel.raynal@bootlin.com>2019-04-08 10:21:13 +0200
commiteeab717483e5fb529c8001d36fbda14011905e5f (patch)
tree370fe60ea2de0ee3d6847dad53ba2abeea8c1b71 /drivers/mtd/nand/raw/nand_base.c
parenta7ab085d7c16a7367a0c93ee39d0750d23b537f9 (diff)
downloadlinux-eeab717483e5fb529c8001d36fbda14011905e5f.tar.bz2
mtd: rawnand: Provide a helper to get chip->data_buf
We plan to move cache related fields to a pagecache struct in nand_chip but some drivers access ->pagebuf directly to invalidate the cache before they start using ->data_buf. Let's provide an helper that returns a pointer to ->data_buf after invalidating the cache. Signed-off-by: Boris Brezillon <bbrezillon@kernel.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Diffstat (limited to 'drivers/mtd/nand/raw/nand_base.c')
-rw-r--r--drivers/mtd/nand/raw/nand_base.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 071a0c658bfe..fe8119c6cd61 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -4004,10 +4004,9 @@ static int nand_do_write_ops(struct nand_chip *chip, loff_t to,
__func__, buf);
if (part_pagewr)
bytes = min_t(int, bytes - column, writelen);
- chip->pagebuf = -1;
- memset(chip->data_buf, 0xff, mtd->writesize);
- memcpy(&chip->data_buf[column], buf, bytes);
- wbuf = chip->data_buf;
+ wbuf = nand_get_data_buf(chip);
+ memset(wbuf, 0xff, mtd->writesize);
+ memcpy(&wbuf[column], buf, bytes);
}
if (unlikely(oob)) {