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