mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
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
This commit is contained in:
parent
e3554b10ba
commit
ba4a40a483
1 changed files with 10 additions and 0 deletions
|
@ -597,6 +597,16 @@ nanddev_get_ecc_nsteps(struct nand_device *nand)
|
|||
return nand->ecc.ctx.nsteps;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
Loading…
Reference in a new issue