1077-mtd-add-get-set-of_node-flash_node-helpers.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From a2f87e7df641b482e217f5b0efbaf41f6b8a0cf6 Mon Sep 17 00:00:00 2001
  2. From: Brian Norris <computersforpeace@gmail.com>
  3. Date: Fri, 30 Oct 2015 20:33:20 -0700
  4. Subject: [PATCH 077/113] mtd: add get/set of_node/flash_node helpers
  5. We are going to begin using the mtd->dev.of_node field for MTD device
  6. nodes, so let's add helpers for it. Also, we'll be making some
  7. conversions on spi_nor (and nand_chip eventually) too, so get that ready
  8. with their own helpers.
  9. commit:28b8b26b308e656edfa9467867d5f79212da2ec3
  10. delete the include/linux/mtd/nand.h
  11. just upgrade the code about spi.
  12. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
  13. Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
  14. Signed-off-by: Yuan Yao <yao.yuan@nxp.com>
  15. ---
  16. include/linux/mtd/mtd.h | 11 +++++++++++
  17. include/linux/mtd/spi-nor.h | 11 +++++++++++
  18. 2 files changed, 22 insertions(+)
  19. --- a/include/linux/mtd/mtd.h
  20. +++ b/include/linux/mtd/mtd.h
  21. @@ -258,6 +258,17 @@ struct mtd_info {
  22. int usecount;
  23. };
  24. +static inline void mtd_set_of_node(struct mtd_info *mtd,
  25. + struct device_node *np)
  26. +{
  27. + mtd->dev.of_node = np;
  28. +}
  29. +
  30. +static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd)
  31. +{
  32. + return mtd->dev.of_node;
  33. +}
  34. +
  35. int mtd_erase(struct mtd_info *mtd, struct erase_info *instr);
  36. int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
  37. void **virt, resource_size_t *phys);
  38. --- a/include/linux/mtd/spi-nor.h
  39. +++ b/include/linux/mtd/spi-nor.h
  40. @@ -184,6 +184,17 @@ struct spi_nor {
  41. void *priv;
  42. };
  43. +static inline void spi_nor_set_flash_node(struct spi_nor *nor,
  44. + struct device_node *np)
  45. +{
  46. + nor->flash_node = np;
  47. +}
  48. +
  49. +static inline struct device_node *spi_nor_get_flash_node(struct spi_nor *nor)
  50. +{
  51. + return nor->flash_node;
  52. +}
  53. +
  54. /**
  55. * spi_nor_scan() - scan the SPI NOR
  56. * @nor: the spi_nor structure