From: Miquel Raynal Date: Thu, 7 May 2020 10:52:35 +0000 (+0200) Subject: mtd: rawnand: Add a helper to check supported operations X-Git-Tag: rel_imx_5.10.35_2.0.0-somdevices.0~1957^2~5^2~134 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=930370253ec51fccebb743409428ac2f364b3559;p=linux.git mtd: rawnand: Add a helper to check supported operations Let's use a helper to clearly check if an operation is supported or not. Return -ENOTSUPP when ->exec_op() is not implemented as we cannot know. Signed-off-by: Miquel Raynal Reviewed-by: Boris Brezillon Link: https://lore.kernel.org/linux-mtd/20200507105241.14299-8-miquel.raynal@bootlin.com --- diff --git a/drivers/mtd/nand/raw/internals.h b/drivers/mtd/nand/raw/internals.h index bca9b3424646..03866b0aadea 100644 --- a/drivers/mtd/nand/raw/internals.h +++ b/drivers/mtd/nand/raw/internals.h @@ -109,6 +109,15 @@ static inline bool nand_has_exec_op(struct nand_chip *chip) return true; } +static inline int nand_check_op(struct nand_chip *chip, + const struct nand_operation *op) +{ + if (!nand_has_exec_op(chip)) + return 0; + + return chip->controller->ops->exec_op(chip, op, true); +} + static inline int nand_exec_op(struct nand_chip *chip, const struct nand_operation *op) {