Skip to content

Commit ba4a40a

Browse files
committed
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
1 parent e3554b1 commit ba4a40a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎include/linux/mtd/nand.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,16 @@ nanddev_get_ecc_nsteps(struct nand_device *nand)
597597
return nand->ecc.ctx.nsteps;
598598
}
599599

600+
/**
601+
* nanddev_get_ecc_bytes_per_step() - Extract the number of ECC bytes per step
602+
* @nand: NAND device
603+
*/
604+
static inline unsigned int
605+
nanddev_get_ecc_bytes_per_step(struct nand_device *nand)
606+
{
607+
return nand->ecc.ctx.total / nand->ecc.ctx.nsteps;
608+
}
609+
600610
/**
601611
* nanddev_get_ecc_requirements() - Extract the ECC requirements from a NAND
602612
* device

0 commit comments

Comments
 (0)