On Mon, 4 May 2020 11:52:31 +0200 Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote: > 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 <miquel.raynal@xxxxxxxxxxx> > --- > drivers/mtd/nand/raw/internals.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/mtd/nand/raw/internals.h b/drivers/mtd/nand/raw/internals.h > index 9d0caadf940e..b722af7a0b7e 100644 > --- a/drivers/mtd/nand/raw/internals.h > +++ b/drivers/mtd/nand/raw/internals.h > @@ -106,6 +106,15 @@ static inline bool nand_has_exec_op(struct nand_chip *chip) > return true; > } > > +static inline int nand_check_supported_op(struct nand_chip *chip, > + const struct nand_operation *op) I would just call that one nand_check_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) > { ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/