Skip to content

Commit

Permalink
mtd: nand: Create a helper to extract the ECC configuration
Browse files Browse the repository at this point in the history
Despite its current name, the eccreq field actually encodes both the
NAND requirements and the final ECC configuration. That works fine when
using on-die ECC since those 2 concepts match perfectly, but it starts
being a problem as soon as we use on-host ECC engines, where we're not
guaranteed to have a perfect match.

Let's hide the ECC configuration access behind a helper so we can later
split those 2 concepts.

Signed-off-by: Miquel Raynal <[email protected]>
Link: https://lore.kernel.org/linux-mtd/[email protected]
  • Loading branch information
miquelraynal committed Sep 28, 2020
1 parent bace41f commit d193792
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/linux/mtd/nand.h
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,16 @@ nanddev_get_memorg(struct nand_device *nand)
return &nand->memorg;
}

/**
* nanddev_get_ecc_conf() - Extract the ECC configuration from a NAND device
* @nand: NAND device
*/
static inline const struct nand_ecc_props *
nanddev_get_ecc_conf(struct nand_device *nand)
{
return &nand->eccreq;
}

int nanddev_init(struct nand_device *nand, const struct nand_ops *ops,
struct module *owner);
void nanddev_cleanup(struct nand_device *nand);
Expand Down

0 comments on commit d193792

Please sign in to comment.