summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBoris Brezillon <bbrezillon@kernel.org>2018-10-28 16:12:45 +0100
committerMiquel Raynal <miquel.raynal@bootlin.com>2019-04-08 10:21:13 +0200
commitd974541e23791e189c5faa0462223d29352cecc6 (patch)
tree3f21bd55ecf2e3513c7fff8f061d4bd36bde80f9 /include
parentmtd: rawnand: Provide a helper to get chip->data_buf (diff)
downloadlinux-d974541e23791e189c5faa0462223d29352cecc6.tar.xz
linux-d974541e23791e189c5faa0462223d29352cecc6.zip
mtd: rawnand: Move all page cache related fields to a sub-struct
Looking at the field names it's hard to tell what ->data_buf, ->pagebuf and ->pagebuf_bitflips are for. Clarify that by moving those fields in a sub-struct named pagecache. 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 'include')
-rw-r--r--include/linux/mtd/rawnand.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index 253f9942a919..99250dc848e8 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -1007,10 +1007,10 @@ struct nand_legacy {
* @chipsize: [INTERN] the size of one chip for multichip arrays
* @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
* @data_buf: [INTERN] buffer for data, size is (page size + oobsize).
- * @pagebuf: [INTERN] holds the pagenumber which is currently in
- * data_buf.
- * @pagebuf_bitflips: [INTERN] holds the bitflip count for the page which is
- * currently in data_buf.
+ * @pagecache: Structure containing page cache related fields
+ * @pagecache.bitflips: Number of bitflips of the cached page
+ * @pagecache.page: Page number currently in the cache. -1 means no page is
+ * currently cached
* @subpagesize: [INTERN] holds the subpagesize
* @id: [INTERN] holds NAND ID
* @parameters: [INTERN] holds generic parameters under an easily
@@ -1060,8 +1060,12 @@ struct nand_chip {
uint64_t chipsize;
int pagemask;
u8 *data_buf;
- int pagebuf;
- unsigned int pagebuf_bitflips;
+
+ struct {
+ unsigned int bitflips;
+ int page;
+ } pagecache;
+
int subpagesize;
uint8_t bits_per_cell;
uint16_t ecc_strength_ds;
@@ -1366,7 +1370,7 @@ void nand_deselect_target(struct nand_chip *chip);
*/
static inline void *nand_get_data_buf(struct nand_chip *chip)
{
- chip->pagebuf = -1;
+ chip->pagecache.page = -1;
return chip->data_buf;
}