aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/nvmem-provider.h
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2023-12-15 11:15:28 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-12-15 13:30:07 +0100
commit4a1a40233b4a9fc159a5c7a27dc34c5c7bc5be55 (patch)
tree1c8a1c018ba399e7f1b03a7576914dad71e11e1d /include/linux/nvmem-provider.h
parentof: device: Export of_device_make_bus_id() (diff)
downloadwireguard-linux-4a1a40233b4a9fc159a5c7a27dc34c5c7bc5be55.tar.xz
wireguard-linux-4a1a40233b4a9fc159a5c7a27dc34c5c7bc5be55.zip
nvmem: Move of_nvmem_layout_get_container() in another header
nvmem-consumer.h is included by consumer devices, extracting data from NVMEM devices whereas nvmem-provider.h is included by devices providing NVMEM content. The only users of of_nvmem_layout_get_container() outside of the core are layout drivers, so better move its prototype to nvmem-provider.h. While we do so, we also move the kdoc associated with the function to the header rather than the .c file. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20231215111536.316972-3-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/nvmem-provider.h')
-rw-r--r--include/linux/nvmem-provider.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index e3930835235b..e5de21516387 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -244,6 +244,27 @@ nvmem_layout_get_match_data(struct nvmem_device *nvmem,
#endif /* CONFIG_NVMEM */
+#if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF)
+
+/**
+ * of_nvmem_layout_get_container() - Get OF node of layout container
+ *
+ * @nvmem: nvmem device
+ *
+ * Return: a node pointer with refcount incremented or NULL if no
+ * container exists. Use of_node_put() on it when done.
+ */
+struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem);
+
+#else /* CONFIG_NVMEM && CONFIG_OF */
+
+static inline struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem)
+{
+ return NULL;
+}
+
+#endif /* CONFIG_NVMEM && CONFIG_OF */
+
#define module_nvmem_layout_driver(__layout_driver) \
module_driver(__layout_driver, nvmem_layout_register, \
nvmem_layout_unregister)