mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/5] nvmem: regmap: allow to register with post processing
Date: Thu,  2 Feb 2023 18:33:10 +0100	[thread overview]
Message-ID: <20230202173312.504493-3-l.stach@pengutronix.de> (raw)
In-Reply-To: <20230202173312.504493-1-l.stach@pengutronix.de>

Add a new registration function that allows to fill the cell_post_process
function pointer.

Signed-off-by: Lucas Stach <l.stach@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




  parent reply	other threads:[~2023-02-02 17:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 17:33 [PATCH 1/5] nvmem: add support for " Lucas Stach
2023-02-02 17:33 ` [PATCH 2/5] nvmem: ocotp: switch to nvmem_regmap_register Lucas Stach
2023-02-02 17:33 ` Lucas Stach [this message]
2023-02-02 17:33 ` [PATCH 4/5] nvmem: ocotp: add post processing for MAC cells Lucas Stach
2023-02-02 17:33 ` [PATCH 5/5] ARM: dts: i.MX8MP: drop OCOTP MAC address provider Lucas Stach
2023-02-06  7:43 ` [PATCH 1/5] nvmem: add support for post processing Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230202173312.504493-3-l.stach@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox