[PATCH 4/5] nvmem: add nvmem_device_get_device()
Sascha Hauer
s.hauer at pengutronix.de
Mon Mar 11 03:21:51 PDT 2024
We'll want to add a device parameter to the imx_ocotp0 device in the
next step, but the device is private to the nvmem core. Add a getter
function for it.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/nvmem/core.c | 6 ++++++
include/linux/nvmem-provider.h | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 67bb1d7993..ad145a4242 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -858,3 +858,9 @@ int nvmem_cell_read_variable_le_u32(struct device *dev, const char *cell_id,
return 0;
}
EXPORT_SYMBOL_GPL(nvmem_cell_read_variable_le_u32);
+
+struct device *nvmem_device_get_device(struct nvmem_device *nvmem)
+{
+ return &nvmem->dev;
+}
+EXPORT_SYMBOL_GPL(nvmem_device_get_device);
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index 3c30e18409..b3b4372d30 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -48,6 +48,7 @@ struct nvmem_device *nvmem_regmap_register(struct regmap *regmap, const char *na
struct nvmem_device *nvmem_regmap_register_with_pp(struct regmap *regmap,
const char *name, nvmem_cell_post_process_t cell_post_process);
struct nvmem_device *nvmem_partition_register(struct cdev *cdev);
+struct device *nvmem_device_get_device(struct nvmem_device *nvmem);
#else
@@ -73,5 +74,9 @@ static inline struct nvmem_device *nvmem_partition_register(struct cdev *cdev)
return ERR_PTR(-ENOSYS);
}
+static struct device *nvmem_device_get_device(struct nvmem_device *nvmem)
+{
+ return ERR_PTR(-ENOSYS);
+}
#endif /* CONFIG_NVMEM */
#endif /* ifndef _LINUX_NVMEM_PROVIDER_H */
--
2.39.2
More information about the barebox
mailing list