mtd: nand: Add a helper to retrieve the number of ECC steps
authorMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 27 Jan 2021 20:30:15 +0000 (21:30 +0100)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Thu, 11 Mar 2021 08:37:28 +0000 (09:37 +0100)
This operation is very common and deserves a helper. It of course only
works after the ECC engine initialization.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Tested-by: Adam Ford <aford173@gmail.com> #logicpd Torpedo
Link: https://lore.kernel.org/linux-mtd/20210127203020.9574-5-miquel.raynal@bootlin.com
include/linux/mtd/nand.h

index 632becb13b46020fff630920bc1c5200dd0c7eb0..8a011639668939b9abccadf142ca82df8b242df5 100644 (file)
@@ -587,6 +587,16 @@ nanddev_get_ecc_conf(struct nand_device *nand)
        return &nand->ecc.ctx.conf;
 }
 
+/**
+ * nanddev_get_ecc_nsteps() - Extract the number of ECC steps
+ * @nand: NAND device
+ */
+static inline unsigned int
+nanddev_get_ecc_nsteps(struct nand_device *nand)
+{
+       return nand->ecc.ctx.nsteps;
+}
+
 /**
  * nanddev_get_ecc_requirements() - Extract the ECC requirements from a NAND
  *                                  device