devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 1/6] nvmem: core: add nvmem_dev_size() helper
@ 2023-01-11  7:30 Rafał Miłecki
  2023-01-11  7:30 ` [PATCH V2 2/6] nvmem: core: allow .read_post_process() callbacks to adjust buffer Rafał Miłecki
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Rafał Miłecki @ 2023-01-11  7:30 UTC (permalink / raw)
  To: Srinivas Kandagatla, Rob Herring, Krzysztof Kozlowski
  Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Miquel Raynal, Michael Walle, devicetree,
	linux-arm-kernel, linux-kernel, u-boot, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

This is required by layouts that need to read whole NVMEM space. It
applies to NVMEM devices without hardcoded layout (like U-Boot
environment data block).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
V2: Drop "const" from "const size_t"
---
 drivers/nvmem/core.c           | 13 +++++++++++++
 include/linux/nvmem-consumer.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index d3be50ed2d0b..32f7fb81375a 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -2062,6 +2062,19 @@ void nvmem_del_cell_lookups(struct nvmem_cell_lookup *entries, size_t nentries)
 }
 EXPORT_SYMBOL_GPL(nvmem_del_cell_lookups);
 
+/**
+ * nvmem_dev_size() - Get the size of a given nvmem device.
+ *
+ * @nvmem: nvmem device.
+ *
+ * Return: size of the nvmem device.
+ */
+size_t nvmem_dev_size(struct nvmem_device *nvmem)
+{
+	return nvmem->size;
+}
+EXPORT_SYMBOL_GPL(nvmem_dev_size);
+
 /**
  * nvmem_dev_name() - Get the name of a given nvmem device.
  *
diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
index fa030d93b768..c3005ab6cc4f 100644
--- a/include/linux/nvmem-consumer.h
+++ b/include/linux/nvmem-consumer.h
@@ -78,6 +78,7 @@ ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem,
 int nvmem_device_cell_write(struct nvmem_device *nvmem,
 			    struct nvmem_cell_info *info, void *buf);
 
+size_t nvmem_dev_size(struct nvmem_device *nvmem);
 const char *nvmem_dev_name(struct nvmem_device *nvmem);
 
 void nvmem_add_cell_lookups(struct nvmem_cell_lookup *entries,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-01-13 16:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-11  7:30 [PATCH V2 1/6] nvmem: core: add nvmem_dev_size() helper Rafał Miłecki
2023-01-11  7:30 ` [PATCH V2 2/6] nvmem: core: allow .read_post_process() callbacks to adjust buffer Rafał Miłecki
2023-01-11 11:07   ` kernel test robot
2023-01-11  7:30 ` [PATCH V2 3/6] dt-bindings: nvmem: convert U-Boot env vars to NVMEM layout Rafał Miłecki
2023-01-13 16:46   ` Rob Herring
2023-01-11  7:31 ` [PATCH V2 4/6] nvmem: u-boot-env: convert to layout driver Rafał Miłecki
2023-01-11  7:31 ` [PATCH V2 5/6] dt-bindings: nvmem: u-boot,env: add MAC's #nvmem-cell-cells Rafał Miłecki
2023-01-13 16:47   ` Rob Herring
2023-01-11  7:31 ` [PATCH V2 6/6] nvmem: u-boot-env: post process "ethaddr" env variable Rafał Miłecki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).