[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220901221857.2600340-21-michael@walle.cc>
Date: Fri, 2 Sep 2022 00:18:57 +0200
From: Michael Walle <michael@...le.cc>
To: Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Shawn Guo <shawnguo@...nel.org>, Li Yang <leoyang.li@....com>,
Rafał Miłecki <rafal@...ecki.pl>,
Frank Rowand <frowand.list@...il.com>
Cc: linux-mtd@...ts.infradead.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Ahmad Fatoum <a.fatoum@...gutronix.de>,
Philipp Zabel <p.zabel@...gutronix.de>,
Michael Walle <michael@...le.cc>
Subject: [RFC PATCH v2 20/20] nvmem: layouts: u-boot-env: add device node
Register the device node so we can actually make use of the cells from
within the device tree.
This obviously only works if the environment variable name can be mapped
to the device node, which isn't always the case. Think of "_" vs "-".
But for simple things like ethaddr, this will work.
Signed-off-by: Michael Walle <michael@...le.cc>
---
changes since v1:
- none
drivers/nvmem/layouts/u-boot-env.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/nvmem/layouts/u-boot-env.c b/drivers/nvmem/layouts/u-boot-env.c
index f184d1424b1e..d2adc246c93a 100644
--- a/drivers/nvmem/layouts/u-boot-env.c
+++ b/drivers/nvmem/layouts/u-boot-env.c
@@ -8,6 +8,7 @@
#include <linux/device.h>
#include <linux/nvmem-consumer.h>
#include <linux/nvmem-provider.h>
+#include <linux/of.h>
#include <linux/slab.h>
enum u_boot_env_format {
@@ -47,6 +48,7 @@ static int u_boot_env_add_cells(struct device *dev,
info.name = var;
info.offset = data_offset + value - data;
info.bytes = strlen(value);
+ info.np = of_get_child_by_name(dev->of_node, var);
err = nvmem_add_one_cell(nvmem, &info);
if (err)
--
2.30.2
Powered by blists - more mailing lists