[PATCH 3/5] nvmem: regmap: allow to register with post processing
Lucas Stach
l.stach at pengutronix.de
Thu Feb 2 09:33:10 PST 2023
Add a new registration function that allows to fill the cell_post_process
function pointer.
Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
---
drivers/nvmem/regmap.c | 10 +++++++++-
include/linux/nvmem-provider.h | 9 +++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/nvmem/regmap.c b/drivers/nvmem/regmap.c
index 56611819a2b4..58b3fe647b28 100644
--- a/drivers/nvmem/regmap.c
+++ b/drivers/nvmem/regmap.c
@@ -58,7 +58,9 @@ static struct nvmem_bus nvmem_regmap_bus = {
.write = nvmem_regmap_write,
};
-struct nvmem_device *nvmem_regmap_register(struct regmap *map, const char *name)
+struct nvmem_device *
+nvmem_regmap_register_with_pp(struct regmap *map, const char *name,
+ nvmem_cell_post_process_t cell_post_process)
{
struct nvmem_config config = {};
@@ -73,6 +75,12 @@ struct nvmem_device *nvmem_regmap_register(struct regmap *map, const char *name)
config.word_size = 1;
config.size = regmap_get_max_register(map) * regmap_get_reg_stride(map);
config.bus = &nvmem_regmap_bus;
+ config.cell_post_process = cell_post_process;
return nvmem_register(&config);
}
+
+struct nvmem_device *nvmem_regmap_register(struct regmap *map, const char *name)
+{
+ return nvmem_regmap_register_with_pp(map, name, NULL);
+}
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index 2f130e51791c..43fe49648e66 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -47,6 +47,8 @@ struct cdev;
struct nvmem_device *nvmem_register(const struct nvmem_config *cfg);
struct nvmem_device *nvmem_regmap_register(struct regmap *regmap, const char *name);
+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);
#else
@@ -61,6 +63,13 @@ static inline struct nvmem_device *nvmem_regmap_register(struct regmap *regmap,
return ERR_PTR(-ENOSYS);
}
+static inline struct nvmem_device *
+nvmem_regmap_register_with_pp(struct regmap *regmap, const char *name,
+ nvmem_cell_post_process_t cell_post_process)
+{
+ return ERR_PTR(-ENOSYS);
+}
+
static inline struct nvmem_device *nvmem_partition_register(struct cdev *cdev)
{
return ERR_PTR(-ENOSYS);
--
2.39.1
More information about the barebox
mailing list