0056-mtd-add-get-set-of_node-flash_node-helpers.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. From 6b4858de63badb90d820a1d343528d8575f3f28c Mon Sep 17 00:00:00 2001
  2. From: John Crispin <[email protected]>
  3. Date: Tue, 22 Mar 2016 03:52:07 +0100
  4. Subject: [PATCH 56/90] 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. Signed-off-by: Brian Norris <[email protected]>
  10. Reviewed-by: Boris Brezillon <[email protected]>
  11. ---
  12. include/linux/mtd/mtd.h | 11 +++++++++++
  13. include/linux/mtd/nand.h | 11 +++++++++++
  14. include/linux/mtd/spi-nor.h | 11 +++++++++++
  15. 3 files changed, 33 insertions(+)
  16. diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
  17. index f17fa75..cc84923 100644
  18. --- a/include/linux/mtd/mtd.h
  19. +++ b/include/linux/mtd/mtd.h
  20. @@ -254,6 +254,17 @@ struct mtd_info {
  21. int usecount;
  22. };
  23. +static inline void mtd_set_of_node(struct mtd_info *mtd,
  24. + struct device_node *np)
  25. +{
  26. + mtd->dev.of_node = np;
  27. +}
  28. +
  29. +static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd)
  30. +{
  31. + return mtd->dev.of_node;
  32. +}
  33. +
  34. int mtd_erase(struct mtd_info *mtd, struct erase_info *instr);
  35. int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
  36. void **virt, resource_size_t *phys);
  37. diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
  38. index 1ded588..3c34ca4 100644
  39. --- a/include/linux/mtd/nand.h
  40. +++ b/include/linux/mtd/nand.h
  41. @@ -741,6 +741,17 @@ static inline void nand_set_controller_data(struct nand_chip *chip, void *priv)
  42. chip->priv = priv;
  43. }
  44. +static inline void nand_set_flash_node(struct nand_chip *chip,
  45. + struct device_node *np)
  46. +{
  47. + chip->flash_node = np;
  48. +}
  49. +
  50. +static inline struct device_node *nand_get_flash_node(struct nand_chip *chip)
  51. +{
  52. + return chip->flash_node;
  53. +}
  54. +
  55. /*
  56. * NAND Flash Manufacturer ID Codes
  57. */
  58. diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
  59. index c8723b6..6d991df 100644
  60. --- a/include/linux/mtd/spi-nor.h
  61. +++ b/include/linux/mtd/spi-nor.h
  62. @@ -185,6 +185,17 @@ struct spi_nor {
  63. void *priv;
  64. };
  65. +static inline void spi_nor_set_flash_node(struct spi_nor *nor,
  66. + struct device_node *np)
  67. +{
  68. + nor->flash_node = np;
  69. +}
  70. +
  71. +static inline struct device_node *spi_nor_get_flash_node(struct spi_nor *nor)
  72. +{
  73. + return nor->flash_node;
  74. +}
  75. +
  76. /**
  77. * spi_nor_scan() - scan the SPI NOR
  78. * @nor: the spi_nor structure
  79. --
  80. 1.7.10.4