28d8bba1949adf0a6e546e2df310edddf8c9c91c
[openwrt/staging/ldir.git] /
1 From b8257f61b4ddac6d7d0e19a5a4e8b07afb3b4ed3 Mon Sep 17 00:00:00 2001
2 From: Miquel Raynal <miquel.raynal@bootlin.com>
3 Date: Tue, 8 Aug 2023 08:29:28 +0200
4 Subject: [PATCH] nvmem: core: Do not open-code existing functions
5
6 Use of_nvmem_layout_get_container() instead of hardcoding it.
7
8 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
9 Reviewed-by: Michael Walle <michael@walle.cc>
10 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
11 ---
12 drivers/nvmem/core.c | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15 --- a/drivers/nvmem/core.c
16 +++ b/drivers/nvmem/core.c
17 @@ -786,10 +786,10 @@ EXPORT_SYMBOL_GPL(nvmem_layout_unregiste
18
19 static struct nvmem_layout *nvmem_layout_get(struct nvmem_device *nvmem)
20 {
21 - struct device_node *layout_np, *np = nvmem->dev.of_node;
22 + struct device_node *layout_np;
23 struct nvmem_layout *l, *layout = ERR_PTR(-EPROBE_DEFER);
24
25 - layout_np = of_get_child_by_name(np, "nvmem-layout");
26 + layout_np = of_nvmem_layout_get_container(nvmem);
27 if (!layout_np)
28 return NULL;
29