diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2021-01-27 23:30:16 +0300 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2021-03-11 11:37:28 +0300 |
commit | ba4a40a483da86d76bd69957c21fcb975b8405ae (patch) | |
tree | ca66eb9e0027f3315adc33927832b53eca62c4ab /include/linux/mtd | |
parent | e3554b10babd8ee1cf43bfc840ef4657eb1d12aa (diff) | |
download | linux-ba4a40a483da86d76bd69957c21fcb975b8405ae.tar.xz |
mtd: nand: Add a helper to retrieve the number of ECC bytes per step
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-6-miquel.raynal@bootlin.com
Diffstat (limited to 'include/linux/mtd')
-rw-r--r-- | include/linux/mtd/nand.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 8a0116396689..32fc7edf65b3 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -598,6 +598,16 @@ nanddev_get_ecc_nsteps(struct nand_device *nand) } /** + * nanddev_get_ecc_bytes_per_step() - Extract the number of ECC bytes per step + * @nand: NAND device + */ +static inline unsigned int +nanddev_get_ecc_bytes_per_step(struct nand_device *nand) +{ + return nand->ecc.ctx.total / nand->ecc.ctx.nsteps; +} + +/** * nanddev_get_ecc_requirements() - Extract the ECC requirements from a NAND * device * @nand: NAND device |