816-v6.7-0004-Revert-nvmem-add-new-config-option.patch 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. From f4cf4e5db331a5ce69e3f0b21d322cac0f4e4b5d Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <[email protected]>
  3. Date: Mon, 23 Oct 2023 12:27:59 +0200
  4. Subject: [PATCH] Revert "nvmem: add new config option"
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. This reverts commit 517f14d9cf3533d5ab4fded195ab6f80a92e378f.
  9. Config option "no_of_node" is no longer needed since adding a more
  10. explicit and targeted option "add_legacy_fixed_of_cells".
  11. That "no_of_node" config option was needed *earlier* to help mtd's case.
  12. DT nodes of MTD partitions (that are also NVMEM devices) may contain
  13. subnodes. Those SHOULD NOT be treated as NVMEM fixed cells.
  14. To prevent NVMEM core code from parsing subnodes a "no_of_node" option
  15. was added (and set to true in mtd) to make for_each_child_of_node() in
  16. NVMEM a no-op. That was a bit hacky because it was messing with
  17. "of_node" pointer to achieve some side-effect.
  18. With the introduction of "add_legacy_fixed_of_cells" config option
  19. things got more explicit. MTD subsystem simply tells NVMEM when to look
  20. for fixed cells and there is no need to hack "of_node" pointer anymore.
  21. Signed-off-by: Rafał Miłecki <[email protected]>
  22. Reviewed-by: Miquel Raynal <[email protected]>
  23. Signed-off-by: Srinivas Kandagatla <[email protected]>
  24. Link: https://lore.kernel.org/r/[email protected]
  25. Signed-off-by: Greg Kroah-Hartman <[email protected]>
  26. ---
  27. drivers/mtd/mtdcore.c | 1 -
  28. drivers/nvmem/core.c | 2 +-
  29. include/linux/nvmem-provider.h | 2 --
  30. 3 files changed, 1 insertion(+), 4 deletions(-)
  31. --- a/drivers/mtd/mtdcore.c
  32. +++ b/drivers/mtd/mtdcore.c
  33. @@ -560,7 +560,6 @@ static int mtd_nvmem_add(struct mtd_info
  34. config.read_only = true;
  35. config.root_only = true;
  36. config.ignore_wp = true;
  37. - config.no_of_node = !of_device_is_compatible(node, "nvmem-cells");
  38. config.priv = mtd;
  39. mtd->nvmem = nvmem_register(&config);
  40. --- a/drivers/nvmem/core.c
  41. +++ b/drivers/nvmem/core.c
  42. @@ -941,7 +941,7 @@ struct nvmem_device *nvmem_register(cons
  43. nvmem->nkeepout = config->nkeepout;
  44. if (config->of_node)
  45. nvmem->dev.of_node = config->of_node;
  46. - else if (!config->no_of_node)
  47. + else
  48. nvmem->dev.of_node = config->dev->of_node;
  49. switch (config->id) {
  50. --- a/include/linux/nvmem-provider.h
  51. +++ b/include/linux/nvmem-provider.h
  52. @@ -89,7 +89,6 @@ struct nvmem_cell_info {
  53. * @read_only: Device is read-only.
  54. * @root_only: Device is accessibly to root only.
  55. * @of_node: If given, this will be used instead of the parent's of_node.
  56. - * @no_of_node: Device should not use the parent's of_node even if it's !NULL.
  57. * @reg_read: Callback to read data.
  58. * @reg_write: Callback to write data.
  59. * @size: Device size.
  60. @@ -122,7 +121,6 @@ struct nvmem_config {
  61. bool ignore_wp;
  62. struct nvmem_layout *layout;
  63. struct device_node *of_node;
  64. - bool no_of_node;
  65. nvmem_reg_read_t reg_read;
  66. nvmem_reg_write_t reg_write;
  67. int size;