Message ID | 20200507105241.14299-8-miquel.raynal@bootlin.com |
---|---|
State | Accepted |
Headers | show |
Series | Supporting restricted NAND controllers | expand |
On Thu, 7 May 2020 12:52:35 +0200 Miquel Raynal <miquel.raynal@bootlin.com> 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@bootlin.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> > --- > 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..f571a226574d 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_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) > {
On Thu, 2020-05-07 at 10:52:35 UTC, Miquel Raynal 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@bootlin.com> > Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next. Miquel
diff --git a/drivers/mtd/nand/raw/internals.h b/drivers/mtd/nand/raw/internals.h index 9d0caadf940e..f571a226574d 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_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) {
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@bootlin.com> --- drivers/mtd/nand/raw/internals.h | 9 +++++++++ 1 file changed, 9 insertions(+)