diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2024-03-11 11:21:51 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-03-13 12:01:21 +0100 |
commit | 2c74e7bbcd7bccfe281971cbb5050534c70dba36 (patch) | |
tree | 0bf04fd666721c7a6b9cad887426a4b02424fb1d | |
parent | 3b0dbcfa4c84dfce9022537a062e2c0e100038c3 (diff) | |
download | barebox-2c74e7bbcd7bccfe281971cbb5050534c70dba36.tar.gz barebox-2c74e7bbcd7bccfe281971cbb5050534c70dba36.tar.xz |
nvmem: add nvmem_device_get_device()
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.
Link: https://lore.barebox.org/20240311102152.360762-4-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/nvmem/core.c | 6 | ||||
-rw-r--r-- | include/linux/nvmem-provider.h | 5 |
2 files changed, 11 insertions, 0 deletions
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..41c636b3a4 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 inline struct device *nvmem_device_get_device(struct nvmem_device *nvmem) +{ + return ERR_PTR(-ENOSYS); +} #endif /* CONFIG_NVMEM */ #endif /* ifndef _LINUX_NVMEM_PROVIDER_H */ |