[PATCH 1/8] nvmem: core: make reg_write() take a const void *

Link Mauve linkmauve at linkmauve.fr
Wed Jul 15 10:52:17 PDT 2026


This callback used to take a mutable void * for no reason, this was
found while drafting the Rust abstraction.

Signed-off-by: Link Mauve <linkmauve at linkmauve.fr>
---
 drivers/nvmem/core.c           | 2 +-
 include/linux/nvmem-provider.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index e871181751f3..202607013054 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -62,7 +62,7 @@ static int __nvmem_reg_read(struct nvmem_device *nvmem, unsigned int offset,
 }
 
 static int __nvmem_reg_write(struct nvmem_device *nvmem, unsigned int offset,
-			     void *val, size_t bytes)
+			     const void *val, size_t bytes)
 {
 	int ret;
 
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index f3b13da78aac..e62285836cbb 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -19,7 +19,7 @@ struct nvmem_device;
 typedef int (*nvmem_reg_read_t)(void *priv, unsigned int offset,
 				void *val, size_t bytes);
 typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset,
-				 void *val, size_t bytes);
+				 const void *val, size_t bytes);
 /* used for vendor specific post processing of cell data */
 typedef int (*nvmem_cell_post_process_t)(void *priv, const char *id, int index,
 					 unsigned int offset, void *buf,
-- 
2.55.0




More information about the linux-amlogic mailing list