aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd/rawnand.h
diff options
context:
space:
mode:
authorSean Nyekjaer <sean@geanix.com>2022-02-08 09:52:13 +0100
committerMiquel Raynal <miquel.raynal@bootlin.com>2022-02-09 09:30:21 +0100
commit8cba323437a49a45756d661f500b324fc2d486fe (patch)
treea152aef06ae0d4c676ff34a33ebd3abde6a32ede /include/linux/mtd/rawnand.h
parentmtd: rawnand: brcmnand: Fix sparse warnings in bcma_nand (diff)
downloadlinux-dev-8cba323437a49a45756d661f500b324fc2d486fe.tar.xz
linux-dev-8cba323437a49a45756d661f500b324fc2d486fe.zip
mtd: rawnand: protect access to rawnand devices while in suspend
Prevent rawnand access while in a suspended state. Commit 013e6292aaf5 ("mtd: rawnand: Simplify the locking") allows the rawnand layer to return errors rather than waiting in a blocking wait. Tested on a iMX6ULL. Fixes: 013e6292aaf5 ("mtd: rawnand: Simplify the locking") Signed-off-by: Sean Nyekjaer <sean@geanix.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Cc: stable@vger.kernel.org Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220208085213.1838273-1-sean@geanix.com
Diffstat (limited to 'include/linux/mtd/rawnand.h')
-rw-r--r--include/linux/mtd/rawnand.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index 5b88cd51fadb..dcf90144d70b 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -1240,6 +1240,7 @@ struct nand_secure_region {
* @lock: Lock protecting the suspended field. Also used to serialize accesses
* to the NAND device
* @suspended: Set to 1 when the device is suspended, 0 when it's not
+ * @resume_wq: wait queue to sleep if rawnand is in suspended state.
* @cur_cs: Currently selected target. -1 means no target selected, otherwise we
* should always have cur_cs >= 0 && cur_cs < nanddev_ntargets().
* NAND Controller drivers should not modify this value, but they're
@@ -1294,6 +1295,7 @@ struct nand_chip {
/* Internals */
struct mutex lock;
unsigned int suspended : 1;
+ wait_queue_head_t resume_wq;
int cur_cs;
int read_retries;
struct nand_secure_region *secure_regions;