[PATCH 4/8] misc: make all reg_write callbacks take const void *

From: Link Mauve

Date: Wed Jul 15 2026 - 14:11:58 EST


The previous commit switched from a pointer to mutable data to a pointer
to immutable data, so let’s fix all users of the nvmem_config API.

Signed-off-by: Link Mauve <linkmauve@xxxxxxxxxxxx>
---
drivers/misc/ds1682.c | 2 +-
drivers/misc/eeprom/at24.c | 4 ++--
drivers/misc/eeprom/at25.c | 2 +-
drivers/misc/eeprom/eeprom_93xx46.c | 4 ++--
drivers/misc/eeprom/m24lr.c | 2 +-
drivers/misc/keba/cp500.c | 2 +-
drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c | 8 ++++----
7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/misc/ds1682.c b/drivers/misc/ds1682.c
index cb09e056531a..4e42a45c17d4 100644
--- a/drivers/misc/ds1682.c
+++ b/drivers/misc/ds1682.c
@@ -209,7 +209,7 @@ static int ds1682_nvmem_read(void *priv, unsigned int offset, void *val,
return ret < 0 ? ret : 0;
}

-static int ds1682_nvmem_write(void *priv, unsigned int offset, void *val,
+static int ds1682_nvmem_write(void *priv, unsigned int offset, const void *val,
size_t bytes)
{
struct i2c_client *client = priv;
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 772c4d9fa651..cd38cf8aad45 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -477,11 +477,11 @@ static int at24_read(void *priv, unsigned int off, void *val, size_t count)
return 0;
}

-static int at24_write(void *priv, unsigned int off, void *val, size_t count)
+static int at24_write(void *priv, unsigned int off, const void *val, size_t count)
{
struct at24_data *at24;
struct device *dev;
- char *buf = val;
+ const char *buf = val;
int ret;

at24 = priv;
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index bc2cfb75d9bb..28f1dc1b9be7 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -235,7 +235,7 @@ static int at25_wait_ready(struct at25_data *at25)
return bounce[0];
}

-static int at25_ee_write(void *priv, unsigned int off, void *val, size_t count)
+static int at25_ee_write(void *priv, unsigned int off, const void *val, size_t count)
{
u8 *bounce __free(kfree) = kmalloc(min(count, io_limit), GFP_KERNEL);
struct at25_data *at25 = priv;
diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c
index f9c3ab52c2f9..813f295af096 100644
--- a/drivers/misc/eeprom/eeprom_93xx46.c
+++ b/drivers/misc/eeprom/eeprom_93xx46.c
@@ -268,10 +268,10 @@ eeprom_93xx46_write_word(struct eeprom_93xx46_dev *edev,
}

static int eeprom_93xx46_write(void *priv, unsigned int off,
- void *val, size_t count)
+ const void *val, size_t count)
{
struct eeprom_93xx46_dev *edev = priv;
- char *buf = val;
+ const char *buf = val;
int ret, step = 1;
unsigned int i;

diff --git a/drivers/misc/eeprom/m24lr.c b/drivers/misc/eeprom/m24lr.c
index 7a9fd45a8e46..22f3221e232b 100644
--- a/drivers/misc/eeprom/m24lr.c
+++ b/drivers/misc/eeprom/m24lr.c
@@ -374,7 +374,7 @@ static int m24lr_nvmem_read(void *priv, unsigned int offset, void *val,
return 0;
}

-static int m24lr_nvmem_write(void *priv, unsigned int offset, void *val,
+static int m24lr_nvmem_write(void *priv, unsigned int offset, const void *val,
size_t bytes)
{
ssize_t err;
diff --git a/drivers/misc/keba/cp500.c b/drivers/misc/keba/cp500.c
index 6c65fbf22e75..ee7889cb63a8 100644
--- a/drivers/misc/keba/cp500.c
+++ b/drivers/misc/keba/cp500.c
@@ -590,7 +590,7 @@ static int cp500_nvmem_read(void *priv, unsigned int offset, void *val,
return 0;
}

-static int cp500_nvmem_write(void *priv, unsigned int offset, void *val,
+static int cp500_nvmem_write(void *priv, unsigned int offset, const void *val,
size_t bytes)
{
struct cp500_nvmem *nvmem = priv;
diff --git a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c
index a2ed477e0370..f2759e9b4138 100644
--- a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c
+++ b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c
@@ -159,11 +159,11 @@ static int pci1xxxx_eeprom_read(void *priv_t, unsigned int off,
}

static int pci1xxxx_eeprom_write(void *priv_t, unsigned int off,
- void *value_t, size_t count)
+ const void *value_t, size_t count)
{
struct pci1xxxx_otp_eeprom_device *priv = priv_t;
void __iomem *rb = priv->reg_base;
- char *value = value_t;
+ const char *value = value_t;
u32 regval;
u32 byte;
int ret;
@@ -262,11 +262,11 @@ static int pci1xxxx_otp_read(void *priv_t, unsigned int off,
}

static int pci1xxxx_otp_write(void *priv_t, unsigned int off,
- void *value_t, size_t count)
+ const void *value_t, size_t count)
{
struct pci1xxxx_otp_eeprom_device *priv = priv_t;
void __iomem *rb = priv->reg_base;
- char *value = value_t;
+ const char *value = value_t;
u32 regval;
u32 byte;
int ret;
--
2.55.0