120-02-v5.18-mtd-nand-Add-a-new-helper-to-retrieve-the-ECC-contex.patch 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. From 840b2f8dd2d0579e517140e1f9bbc482eaf4ed07 Mon Sep 17 00:00:00 2001
  2. From: Miquel Raynal <[email protected]>
  3. Date: Thu, 16 Dec 2021 12:16:39 +0100
  4. Subject: [PATCH 02/15] mtd: nand: Add a new helper to retrieve the ECC context
  5. Introduce nand_to_ecc_ctx() which will allow to easily jump to the
  6. private pointer of an ECC context given a NAND device. This is very
  7. handy, from the prepare or finish ECC hook, to get the internal context
  8. out of the NAND device object.
  9. Signed-off-by: Miquel Raynal <[email protected]>
  10. Link: https://lore.kernel.org/linux-mtd/[email protected]
  11. (cherry picked from commit cda32a618debd3fad8e42757b198719ae180f8f4)
  12. ---
  13. include/linux/mtd/nand.h | 5 +++++
  14. 1 file changed, 5 insertions(+)
  15. --- a/include/linux/mtd/nand.h
  16. +++ b/include/linux/mtd/nand.h
  17. @@ -990,6 +990,11 @@ int nanddev_markbad(struct nand_device *
  18. int nanddev_ecc_engine_init(struct nand_device *nand);
  19. void nanddev_ecc_engine_cleanup(struct nand_device *nand);
  20. +static inline void *nand_to_ecc_ctx(struct nand_device *nand)
  21. +{
  22. + return nand->ecc.ctx.priv;
  23. +}
  24. +
  25. /* BBT related functions */
  26. enum nand_bbt_block_status {
  27. NAND_BBT_BLOCK_STATUS_UNKNOWN,