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:23 +0300
committerMiquel Raynal <miquel.raynal@bootlin.com>2018-12-07 12:38:27 +0300
commitf2abfeb2078b9682bfeb77f91816fcf2177b3051 (patch)
tree10c934f3a3bf2387feaba1faaa4366266bd7dd8a /drivers/mtd/nand/raw/internals.h
parent7d6c37e90cf9013bd18240cd861b9ae7b006f91f (diff)
downloadlinux-f2abfeb2078b9682bfeb77f91816fcf2177b3051.tar.xz
mtd: rawnand: Move the ->exec_op() method to nand_controller_ops
->exec_op() is a controller method and has nothing to do in the nand_chip struct. Let's move it to the nand_controller_ops struct and adjust the core and drivers accordingly. 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.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/mtd/nand/raw/internals.h b/drivers/mtd/nand/raw/internals.h
index b62728d5884b..ac66b458566f 100644
--- a/drivers/mtd/nand/raw/internals.h
+++ b/drivers/mtd/nand/raw/internals.h
@@ -95,16 +95,25 @@ void nand_decode_ext_id(struct nand_chip *chip);
void panic_nand_wait(struct nand_chip *chip, unsigned long timeo);
void sanitize_string(uint8_t *s, size_t len);
+static inline bool nand_has_exec_op(struct nand_chip *chip)
+{
+ if (!chip->controller || !chip->controller->ops ||
+ !chip->controller->ops->exec_op)
+ return false;
+
+ return true;
+}
+
static inline int nand_exec_op(struct nand_chip *chip,
const struct nand_operation *op)
{
- if (!chip->exec_op)
+ if (!nand_has_exec_op(chip))
return -ENOTSUPP;
if (WARN_ON(op->cs >= chip->numchips))
return -EINVAL;
- return chip->exec_op(chip, op, false);
+ return chip->controller->ops->exec_op(chip, op, false);
}
/* BBT functions */