summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/raw/internals.h
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@bootlin.com>2018-11-11 10:55:15 +0300
committerMiquel Raynal <miquel.raynal@bootlin.com>2018-12-07 12:38:25 +0300
commitae2294b10b0f066ef500954b36c94ee11c4ef20f (patch)
treeac6dc91792dc40771cdeea7ccb4213c4704fd1fc /drivers/mtd/nand/raw/internals.h
parent1d0178593d148e88d2ac1e3f09c7f7eb1c20796b (diff)
downloadlinux-ae2294b10b0f066ef500954b36c94ee11c4ef20f.tar.xz
mtd: rawnand: Pass the CS line to be selected in struct nand_operation
In order to deprecate the ->select_chip hook we need to pass the CS line a NAND operations are targeting. This is done through the addition of a cs field to the nand_operation struct. We also need to keep track of the currently selected target to properly initialize op->cs, hence the ->cur_cs field addition to the nand_chip struct. Note that op->cs is not assigned in nand_exec_op() because we might rework the way we execute NAND operations in the future (adopt a queuing mechanism instead of the serialization we have right now). Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Tested-by: Janusz Krzysztofik <jmkrzyszt@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd/nand/raw/internals.h')
-rw-r--r--drivers/mtd/nand/raw/internals.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/nand/raw/internals.h b/drivers/mtd/nand/raw/internals.h
index 6e2f61fbc5f0..b62728d5884b 100644
--- a/drivers/mtd/nand/raw/internals.h
+++ b/drivers/mtd/nand/raw/internals.h
@@ -101,6 +101,9 @@ static inline int nand_exec_op(struct nand_chip *chip,
if (!chip->exec_op)
return -ENOTSUPP;
+ if (WARN_ON(op->cs >= chip->numchips))
+ return -EINVAL;
+
return chip->exec_op(chip, op, false);
}