Linux RTC
 help / color / mirror / Atom feed
* [PATCH 0/8] nvmem: make reg_write() take a const void *
@ 2026-07-15 17:52 Link Mauve
  2026-07-15 17:52 ` [PATCH 1/8] nvmem: core: " Link Mauve
                   ` (8 more replies)
  0 siblings, 9 replies; 20+ messages in thread
From: Link Mauve @ 2026-07-15 17:52 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Link Mauve, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Jonathan Cameron, David Lechner,
	Nuno Sá, Andy Shevchenko, Sakari Ailus, Tianshu Qiu,
	Bingbu Cao, Mauro Carvalho Chehab, Aaro Koskinen, Andreas Kemnade,
	Roger Quadros, Tony Lindgren, Lee Jones, Arnd Bergmann,
	Greg Kroah-Hartman, Bartosz Golaszewski, Vaibhaav Ram T.L,
	Kumaravel Thiagarajan, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Vladimir Zapolskiy,
	André Draszik, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Praveen Teja Kundanala,
	Kalyani Akula, Michal Simek, Alexandre Belloni, Joshua Kinard,
	Antoniu Miclaus, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan, Daniel Lezcano, Johan Hovold,
	Ronald Claveau, Salah Triki, Yury Norov, David Carlier,
	Achim Gratz, Alexander Sverdlin, Patrick Wicki, Markus Heidelberg,
	Markus Perkins, Uwe Kleine-König (The Capable Hub),
	Bjorn Helgaas, Abd-Alrhman Masalkhi, Chen Ni, Kees Cook,
	linux-arm-kernel, linux-amlogic, linux-kernel, linux-iio,
	linux-media, linux-omap, mfd, linux-i2c, linux-gpio, imx,
	linux-arm-msm, linux-stm32, linux-rtc, linux-sunxi,
	rust-for-linux

This callback used to take a mutable void * for no reason, which causes
the compiler to be unaware that the val buffer should never be modified
by the callback.

This was found while drafting the nvmem-provider Rust abstraction.

I’ve split this series based on the subsystem each patch affects, but I
think it should go through the nvmem tree in one go after gathering the
acks from the other subsystem maintainers.

I’ve been told previously to not include too many maintainers in Cc, but
I don’t know which ones to remove from the get_maintainers.pl output, so
I’ve still included everyone, sorry about that.

Thanks,

Link Mauve (8):
  nvmem: core: make reg_write() take a const void *
  nvmem: make all reg_write callbacks take const void *
  rtc: make all reg_write callbacks take const void *
  misc: make all reg_write callbacks take const void *
  iio: pressure: bmp280: make reg_write callback take const void *
  firmware: meson_sm: make reg_write callback take const void *
  mfd: twl-core: make reg_write callback take const void *
  media: ov2740: remove NULL reg_write callback

 drivers/firmware/meson/meson_sm.c                 | 2 +-
 drivers/iio/pressure/bmp280-core.c                | 6 +++---
 drivers/media/i2c/ov2740.c                        | 1 -
 drivers/mfd/twl-core.c                            | 2 +-
 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 ++++----
 drivers/nvmem/bcm-ocotp.c                         | 4 ++--
 drivers/nvmem/core.c                              | 2 +-
 drivers/nvmem/imx-ocotp-scu.c                     | 4 ++--
 drivers/nvmem/imx-ocotp.c                         | 4 ++--
 drivers/nvmem/lan9662-otpc.c                      | 4 ++--
 drivers/nvmem/lpc18xx_eeprom.c                    | 4 ++--
 drivers/nvmem/max77759-nvmem.c                    | 2 +-
 drivers/nvmem/meson-efuse.c                       | 4 ++--
 drivers/nvmem/qcom-spmi-sdam.c                    | 2 +-
 drivers/nvmem/qfprom.c                            | 4 ++--
 drivers/nvmem/rave-sp-eeprom.c                    | 4 ++--
 drivers/nvmem/snvs_lpgpr.c                        | 2 +-
 drivers/nvmem/sprd-efuse.c                        | 4 ++--
 drivers/nvmem/stm32-bsec-optee-ta.c               | 2 +-
 drivers/nvmem/stm32-bsec-optee-ta.h               | 4 ++--
 drivers/nvmem/stm32-romem.c                       | 6 +++---
 drivers/nvmem/zynqmp_nvmem.c                      | 4 ++--
 drivers/rtc/rtc-abx80x.c                          | 4 ++--
 drivers/rtc/rtc-cmos.c                            | 2 +-
 drivers/rtc/rtc-ds1305.c                          | 4 ++--
 drivers/rtc/rtc-ds1307.c                          | 2 +-
 drivers/rtc/rtc-ds1343.c                          | 2 +-
 drivers/rtc/rtc-ds1511.c                          | 2 +-
 drivers/rtc/rtc-ds1553.c                          | 4 ++--
 drivers/rtc/rtc-ds1685.c                          | 4 ++--
 drivers/rtc/rtc-ds1742.c                          | 4 ++--
 drivers/rtc/rtc-ds3232.c                          | 2 +-
 drivers/rtc/rtc-isl12026.c                        | 4 ++--
 drivers/rtc/rtc-isl1208.c                         | 2 +-
 drivers/rtc/rtc-m48t59.c                          | 4 ++--
 drivers/rtc/rtc-m48t86.c                          | 2 +-
 drivers/rtc/rtc-max31335.c                        | 2 +-
 drivers/rtc/rtc-meson.c                           | 2 +-
 drivers/rtc/rtc-omap.c                            | 4 ++--
 drivers/rtc/rtc-pcf2127.c                         | 2 +-
 drivers/rtc/rtc-pcf85063.c                        | 2 +-
 drivers/rtc/rtc-pcf85363.c                        | 4 ++--
 drivers/rtc/rtc-rp5c01.c                          | 4 ++--
 drivers/rtc/rtc-rv3028.c                          | 6 +++---
 drivers/rtc/rtc-rv3029c2.c                        | 2 +-
 drivers/rtc/rtc-rv3032.c                          | 4 ++--
 drivers/rtc/rtc-rv8803.c                          | 4 ++--
 drivers/rtc/rtc-rx8581.c                          | 4 ++--
 drivers/rtc/rtc-s35390a.c                         | 4 ++--
 drivers/rtc/rtc-stk17ta8.c                        | 4 ++--
 drivers/rtc/rtc-sun6i.c                           | 4 ++--
 drivers/rtc/rtc-ti-k3.c                           | 2 +-
 drivers/rtc/rtc-twl.c                             | 2 +-
 include/linux/firmware/meson/meson_sm.h           | 2 +-
 include/linux/mfd/twl.h                           | 4 ++--
 include/linux/nvmem-provider.h                    | 2 +-
 62 files changed, 100 insertions(+), 101 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/8] nvmem: core: make reg_write() take a const void *
  2026-07-15 17:52 [PATCH 0/8] nvmem: make reg_write() take a const void * Link Mauve
@ 2026-07-15 17:52 ` Link Mauve
  2026-07-15 18:00   ` sashiko-bot
  2026-07-15 18:58   ` Andy Shevchenko
  2026-07-15 17:52 ` [PATCH 2/8] nvmem: make all reg_write callbacks take " Link Mauve
                   ` (7 subsequent siblings)
  8 siblings, 2 replies; 20+ messages in thread
From: Link Mauve @ 2026-07-15 17:52 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Link Mauve, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Jonathan Cameron, David Lechner,
	Nuno Sá, Andy Shevchenko, Sakari Ailus, Tianshu Qiu,
	Bingbu Cao, Mauro Carvalho Chehab, Aaro Koskinen, Andreas Kemnade,
	Roger Quadros, Tony Lindgren, Lee Jones, Arnd Bergmann,
	Greg Kroah-Hartman, Bartosz Golaszewski, Vaibhaav Ram T.L,
	Kumaravel Thiagarajan, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Vladimir Zapolskiy,
	André Draszik, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Praveen Teja Kundanala,
	Kalyani Akula, Michal Simek, Alexandre Belloni, Joshua Kinard,
	Antoniu Miclaus, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan, Daniel Lezcano, Johan Hovold,
	Ronald Claveau, Salah Triki, Yury Norov, David Carlier,
	Achim Gratz, Alexander Sverdlin, Patrick Wicki, Markus Heidelberg,
	Markus Perkins, Uwe Kleine-König (The Capable Hub),
	Bjorn Helgaas, Abd-Alrhman Masalkhi, Chen Ni, Kees Cook,
	linux-arm-kernel, linux-amlogic, linux-kernel, linux-iio,
	linux-media, linux-omap, mfd, linux-i2c, linux-gpio, imx,
	linux-arm-msm, linux-stm32, linux-rtc, linux-sunxi,
	rust-for-linux

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@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


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/8] nvmem: make all reg_write callbacks take const void *
  2026-07-15 17:52 [PATCH 0/8] nvmem: make reg_write() take a const void * Link Mauve
  2026-07-15 17:52 ` [PATCH 1/8] nvmem: core: " Link Mauve
@ 2026-07-15 17:52 ` Link Mauve
  2026-07-15 18:08   ` sashiko-bot
  2026-07-15 17:52 ` [PATCH 3/8] rtc: " Link Mauve
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Link Mauve @ 2026-07-15 17:52 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Link Mauve, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Jonathan Cameron, David Lechner,
	Nuno Sá, Andy Shevchenko, Sakari Ailus, Tianshu Qiu,
	Bingbu Cao, Mauro Carvalho Chehab, Aaro Koskinen, Andreas Kemnade,
	Roger Quadros, Tony Lindgren, Lee Jones, Arnd Bergmann,
	Greg Kroah-Hartman, Bartosz Golaszewski, Vaibhaav Ram T.L,
	Kumaravel Thiagarajan, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Vladimir Zapolskiy,
	André Draszik, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Praveen Teja Kundanala,
	Kalyani Akula, Michal Simek, Alexandre Belloni, Joshua Kinard,
	Antoniu Miclaus, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan, Daniel Lezcano, Johan Hovold,
	Ronald Claveau, Salah Triki, Yury Norov, David Carlier,
	Achim Gratz, Alexander Sverdlin, Patrick Wicki, Markus Heidelberg,
	Markus Perkins, Uwe Kleine-König (The Capable Hub),
	Bjorn Helgaas, Abd-Alrhman Masalkhi, Chen Ni, Kees Cook,
	linux-arm-kernel, linux-amlogic, linux-kernel, linux-iio,
	linux-media, linux-omap, mfd, linux-i2c, linux-gpio, imx,
	linux-arm-msm, linux-stm32, linux-rtc, linux-sunxi,
	rust-for-linux

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

Signed-off-by: Link Mauve <linkmauve@linkmauve.fr>
---
 drivers/nvmem/bcm-ocotp.c           | 4 ++--
 drivers/nvmem/imx-ocotp-scu.c       | 4 ++--
 drivers/nvmem/imx-ocotp.c           | 4 ++--
 drivers/nvmem/lan9662-otpc.c        | 4 ++--
 drivers/nvmem/lpc18xx_eeprom.c      | 4 ++--
 drivers/nvmem/max77759-nvmem.c      | 2 +-
 drivers/nvmem/meson-efuse.c         | 4 ++--
 drivers/nvmem/qcom-spmi-sdam.c      | 2 +-
 drivers/nvmem/qfprom.c              | 4 ++--
 drivers/nvmem/rave-sp-eeprom.c      | 4 ++--
 drivers/nvmem/snvs_lpgpr.c          | 2 +-
 drivers/nvmem/sprd-efuse.c          | 4 ++--
 drivers/nvmem/stm32-bsec-optee-ta.c | 2 +-
 drivers/nvmem/stm32-bsec-optee-ta.h | 4 ++--
 drivers/nvmem/stm32-romem.c         | 6 +++---
 drivers/nvmem/zynqmp_nvmem.c        | 4 ++--
 16 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/nvmem/bcm-ocotp.c b/drivers/nvmem/bcm-ocotp.c
index 2490f44caa40..2c9c734187f7 100644
--- a/drivers/nvmem/bcm-ocotp.c
+++ b/drivers/nvmem/bcm-ocotp.c
@@ -179,11 +179,11 @@ static int bcm_otpc_read(void *context, unsigned int offset, void *val,
 	return 0;
 }
 
-static int bcm_otpc_write(void *context, unsigned int offset, void *val,
+static int bcm_otpc_write(void *context, unsigned int offset, const void *val,
 	size_t bytes)
 {
 	struct otpc_priv *priv = context;
-	u32 *buf = val;
+	const u32 *buf = val;
 	u32 bytes_written;
 	u32 address = offset / priv->config->word_size;
 	int i, ret;
diff --git a/drivers/nvmem/imx-ocotp-scu.c b/drivers/nvmem/imx-ocotp-scu.c
index 517d83e11af2..ee04e7d33cb5 100644
--- a/drivers/nvmem/imx-ocotp-scu.c
+++ b/drivers/nvmem/imx-ocotp-scu.c
@@ -178,11 +178,11 @@ static int imx_scu_ocotp_read(void *context, unsigned int offset,
 }
 
 static int imx_scu_ocotp_write(void *context, unsigned int offset,
-			       void *val, size_t bytes)
+			       const void *val, size_t bytes)
 {
 	struct ocotp_priv *priv = context;
 	struct arm_smccc_res res;
-	u32 *buf = val;
+	const u32 *buf = val;
 	u32 tmp;
 	u32 index;
 	int ret;
diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
index 108d78d7f6cb..3ede755ab429 100644
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -310,11 +310,11 @@ static void imx_ocotp_set_imx7_timing(struct ocotp_priv *priv)
 	writel(timing, priv->base + IMX_OCOTP_ADDR_TIMING);
 }
 
-static int imx_ocotp_write(void *context, unsigned int offset, void *val,
+static int imx_ocotp_write(void *context, unsigned int offset, const void *val,
 			   size_t bytes)
 {
 	struct ocotp_priv *priv = context;
-	u32 *buf = val;
+	const u32 *buf = val;
 	int ret;
 
 	u32 ctrl;
diff --git a/drivers/nvmem/lan9662-otpc.c b/drivers/nvmem/lan9662-otpc.c
index 56fc19f092a7..79142b1eb1f5 100644
--- a/drivers/nvmem/lan9662-otpc.c
+++ b/drivers/nvmem/lan9662-otpc.c
@@ -140,10 +140,10 @@ static int lan9662_otp_read(void *context, unsigned int offset,
 }
 
 static int lan9662_otp_write(void *context, unsigned int offset,
-			     void *_val, size_t bytes)
+			     const void *_val, size_t bytes)
 {
 	struct lan9662_otp *otp = context;
-	u8 *val = _val;
+	const u8 *val = _val;
 	u8 data, newdata;
 	int i, rc = 0;
 
diff --git a/drivers/nvmem/lpc18xx_eeprom.c b/drivers/nvmem/lpc18xx_eeprom.c
index 504155e30bab..c752026c9b36 100644
--- a/drivers/nvmem/lpc18xx_eeprom.c
+++ b/drivers/nvmem/lpc18xx_eeprom.c
@@ -87,7 +87,7 @@ static int lpc18xx_eeprom_busywait_until_prog(struct lpc18xx_eeprom_dev *eeprom)
 }
 
 static int lpc18xx_eeprom_gather_write(void *context, unsigned int reg,
-				       void *val, size_t bytes)
+				       const void *val, size_t bytes)
 {
 	struct lpc18xx_eeprom_dev *eeprom = context;
 	unsigned int offset = reg;
@@ -109,7 +109,7 @@ static int lpc18xx_eeprom_gather_write(void *context, unsigned int reg,
 	usleep_range(100, 200);
 
 	while (bytes) {
-		writel(*(u32 *)val, eeprom->mem_base + offset);
+		writel(*(const u32 *)val, eeprom->mem_base + offset);
 		ret = lpc18xx_eeprom_busywait_until_prog(eeprom);
 		if (ret < 0)
 			return ret;
diff --git a/drivers/nvmem/max77759-nvmem.c b/drivers/nvmem/max77759-nvmem.c
index 283000ec3a2c..e47d7a3e578a 100644
--- a/drivers/nvmem/max77759-nvmem.c
+++ b/drivers/nvmem/max77759-nvmem.c
@@ -59,7 +59,7 @@ static int max77759_nvmem_reg_read(void *priv, unsigned int offset,
 }
 
 static int max77759_nvmem_reg_write(void *priv, unsigned int offset,
-				    void *val, size_t bytes)
+				    const void *val, size_t bytes)
 {
 	struct max77759_nvmem *nvmem = priv;
 	DEFINE_FLEX(struct max77759_maxq_command, cmd, cmd, length,
diff --git a/drivers/nvmem/meson-efuse.c b/drivers/nvmem/meson-efuse.c
index d7f9ac99a212..3aa9ec97ef7d 100644
--- a/drivers/nvmem/meson-efuse.c
+++ b/drivers/nvmem/meson-efuse.c
@@ -27,12 +27,12 @@ static int meson_efuse_read(void *context, unsigned int offset,
 }
 
 static int meson_efuse_write(void *context, unsigned int offset,
-			     void *val, size_t bytes)
+			     const void *val, size_t bytes)
 {
 	struct meson_sm_firmware *fw = context;
 	int ret;
 
-	ret = meson_sm_call_write(fw, (u8 *)val, bytes, SM_EFUSE_WRITE, offset,
+	ret = meson_sm_call_write(fw, val, bytes, SM_EFUSE_WRITE, offset,
 				  bytes, 0, 0, 0);
 
 	return ret < 0 ? ret : 0;
diff --git a/drivers/nvmem/qcom-spmi-sdam.c b/drivers/nvmem/qcom-spmi-sdam.c
index 4f1cca6eab71..2939c8d7be10 100644
--- a/drivers/nvmem/qcom-spmi-sdam.c
+++ b/drivers/nvmem/qcom-spmi-sdam.c
@@ -81,7 +81,7 @@ static int sdam_read(void *priv, unsigned int offset, void *val,
 	return rc;
 }
 
-static int sdam_write(void *priv, unsigned int offset, void *val,
+static int sdam_write(void *priv, unsigned int offset, const void *val,
 				size_t bytes)
 {
 	struct sdam_chip *sdam = priv;
diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c
index 1de3435df116..e02726dd4413 100644
--- a/drivers/nvmem/qfprom.c
+++ b/drivers/nvmem/qfprom.c
@@ -252,13 +252,13 @@ static int qfprom_enable_fuse_blowing(const struct qfprom_priv *priv,
  *
  * Return: 0 or -err.
  */
-static int qfprom_reg_write(void *context, unsigned int reg, void *_val,
+static int qfprom_reg_write(void *context, unsigned int reg, void void *_val,
 			    size_t bytes)
 {
 	struct qfprom_priv *priv = context;
 	struct qfprom_touched_values old;
 	int words = bytes / 4;
-	u32 *value = _val;
+	const u32 *value = _val;
 	u32 blow_status;
 	int ret;
 	int i;
diff --git a/drivers/nvmem/rave-sp-eeprom.c b/drivers/nvmem/rave-sp-eeprom.c
index 9ecf3873cbb7..d9a610ba8a3d 100644
--- a/drivers/nvmem/rave-sp-eeprom.c
+++ b/drivers/nvmem/rave-sp-eeprom.c
@@ -278,10 +278,10 @@ static int rave_sp_eeprom_reg_read(void *eeprom, unsigned int offset,
 }
 
 static int rave_sp_eeprom_reg_write(void *eeprom, unsigned int offset,
-				    void *val, size_t bytes)
+				    const void *val, size_t bytes)
 {
 	return rave_sp_eeprom_access(eeprom, RAVE_SP_EEPROM_WRITE,
-				     offset, val, bytes);
+				     offset, (void *)val, bytes);
 }
 
 static int rave_sp_eeprom_probe(struct platform_device *pdev)
diff --git a/drivers/nvmem/snvs_lpgpr.c b/drivers/nvmem/snvs_lpgpr.c
index 89c27112320f..2a1f82aa703a 100644
--- a/drivers/nvmem/snvs_lpgpr.c
+++ b/drivers/nvmem/snvs_lpgpr.c
@@ -50,7 +50,7 @@ static const struct snvs_lpgpr_cfg snvs_lpgpr_cfg_imx7d = {
 	.size		= 16,
 };
 
-static int snvs_lpgpr_write(void *context, unsigned int offset, void *val,
+static int snvs_lpgpr_write(void *context, unsigned int offset, const void *val,
 			    size_t bytes)
 {
 	struct snvs_lpgpr_priv *priv = context;
diff --git a/drivers/nvmem/sprd-efuse.c b/drivers/nvmem/sprd-efuse.c
index 1a7e4e5d8b86..b42ebef14c68 100644
--- a/drivers/nvmem/sprd-efuse.c
+++ b/drivers/nvmem/sprd-efuse.c
@@ -192,7 +192,7 @@ static void sprd_efuse_set_prog_en(struct sprd_efuse *efuse, bool en)
 }
 
 static int sprd_efuse_raw_prog(struct sprd_efuse *efuse, u32 blk, bool doub,
-			       bool lock, u32 *data)
+			       bool lock, const u32 *data)
 {
 	u32 status;
 	int ret = 0;
@@ -321,7 +321,7 @@ static int sprd_efuse_read(void *context, u32 offset, void *val, size_t bytes)
 	return ret;
 }
 
-static int sprd_efuse_write(void *context, u32 offset, void *val, size_t bytes)
+static int sprd_efuse_write(void *context, u32 offset, const void *val, size_t bytes)
 {
 	struct sprd_efuse *efuse = context;
 	bool blk_double = efuse->data->blk_double;
diff --git a/drivers/nvmem/stm32-bsec-optee-ta.c b/drivers/nvmem/stm32-bsec-optee-ta.c
index f89ce791dd12..3184b976b1f9 100644
--- a/drivers/nvmem/stm32-bsec-optee-ta.c
+++ b/drivers/nvmem/stm32-bsec-optee-ta.c
@@ -203,7 +203,7 @@ int stm32_bsec_optee_ta_read(struct tee_context *ctx, unsigned int offset,
 
 /* stm32_bsec_optee_ta_write() - nvmem write access using PTA client driver */
 int stm32_bsec_optee_ta_write(struct tee_context *ctx, unsigned int lower,
-			      unsigned int offset, void *buf, size_t bytes)
+			      unsigned int offset, const void *buf, size_t bytes)
 {	struct tee_shm *shm;
 	struct tee_ioctl_invoke_arg arg;
 	struct tee_param param[2];
diff --git a/drivers/nvmem/stm32-bsec-optee-ta.h b/drivers/nvmem/stm32-bsec-optee-ta.h
index 3966a0535179..74658a54fe57 100644
--- a/drivers/nvmem/stm32-bsec-optee-ta.h
+++ b/drivers/nvmem/stm32-bsec-optee-ta.h
@@ -50,7 +50,7 @@ int stm32_bsec_optee_ta_read(struct tee_context *ctx, unsigned int offset,
  *	On success, 0. On failure, -errno.
  */
 int stm32_bsec_optee_ta_write(struct tee_context *ctx, unsigned int lower,
-			      unsigned int offset, void *buf, size_t bytes);
+			      unsigned int offset, const void *buf, size_t bytes);
 
 #else
 
@@ -72,7 +72,7 @@ static inline int stm32_bsec_optee_ta_read(struct tee_context *ctx,
 
 static inline int stm32_bsec_optee_ta_write(struct tee_context *ctx,
 					    unsigned int lower,
-					    unsigned int offset, void *buf,
+					    unsigned int offset, const void *buf,
 					    size_t bytes)
 {
 	return -EOPNOTSUPP;
diff --git a/drivers/nvmem/stm32-romem.c b/drivers/nvmem/stm32-romem.c
index 82879b1c9eb9..30e14c80a4a9 100644
--- a/drivers/nvmem/stm32-romem.c
+++ b/drivers/nvmem/stm32-romem.c
@@ -118,12 +118,12 @@ static int stm32_bsec_read(void *context, unsigned int offset, void *buf,
 	return 0;
 }
 
-static int stm32_bsec_write(void *context, unsigned int offset, void *buf,
+static int stm32_bsec_write(void *context, unsigned int offset, const void *buf,
 			    size_t bytes)
 {
 	struct stm32_romem_priv *priv = context;
 	struct device *dev = priv->cfg.dev;
-	u32 *buf32 = buf;
+	const u32 *buf32 = buf;
 	int ret, i;
 
 	/* Allow only writing complete 32-bits aligned words */
@@ -153,7 +153,7 @@ static int stm32_bsec_pta_read(void *context, unsigned int offset, void *buf,
 	return stm32_bsec_optee_ta_read(priv->ctx, offset, buf, bytes);
 }
 
-static int stm32_bsec_pta_write(void *context, unsigned int offset, void *buf,
+static int stm32_bsec_pta_write(void *context, unsigned int offset, const void *buf,
 				size_t bytes)
 {
 	struct stm32_romem_priv *priv = context;
diff --git a/drivers/nvmem/zynqmp_nvmem.c b/drivers/nvmem/zynqmp_nvmem.c
index d297ff150dc0..66bbb873d1d1 100644
--- a/drivers/nvmem/zynqmp_nvmem.c
+++ b/drivers/nvmem/zynqmp_nvmem.c
@@ -183,7 +183,7 @@ static int zynqmp_nvmem_read(void *context, unsigned int offset, void *val, size
 }
 
 static int zynqmp_nvmem_write(void *context,
-			      unsigned int offset, void *val, size_t bytes)
+			      unsigned int offset, const void *val, size_t bytes)
 {
 	int pufflag = 0;
 
@@ -194,7 +194,7 @@ static int zynqmp_nvmem_write(void *context,
 		pufflag = 1;
 
 	return zynqmp_efuse_access(context, offset,
-				   val, bytes, EFUSE_WRITE, pufflag);
+				   (void *)val, bytes, EFUSE_WRITE, pufflag);
 }
 
 static const struct of_device_id zynqmp_nvmem_match[] = {
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/8] rtc: make all reg_write callbacks take const void *
  2026-07-15 17:52 [PATCH 0/8] nvmem: make reg_write() take a const void * Link Mauve
  2026-07-15 17:52 ` [PATCH 1/8] nvmem: core: " Link Mauve
  2026-07-15 17:52 ` [PATCH 2/8] nvmem: make all reg_write callbacks take " Link Mauve
@ 2026-07-15 17:52 ` Link Mauve
  2026-07-15 18:01   ` sashiko-bot
  2026-07-15 17:52 ` [PATCH 4/8] misc: " Link Mauve
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Link Mauve @ 2026-07-15 17:52 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Link Mauve, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Jonathan Cameron, David Lechner,
	Nuno Sá, Andy Shevchenko, Sakari Ailus, Tianshu Qiu,
	Bingbu Cao, Mauro Carvalho Chehab, Aaro Koskinen, Andreas Kemnade,
	Roger Quadros, Tony Lindgren, Lee Jones, Arnd Bergmann,
	Greg Kroah-Hartman, Bartosz Golaszewski, Vaibhaav Ram T.L,
	Kumaravel Thiagarajan, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Vladimir Zapolskiy,
	André Draszik, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Praveen Teja Kundanala,
	Kalyani Akula, Michal Simek, Alexandre Belloni, Joshua Kinard,
	Antoniu Miclaus, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan, Daniel Lezcano, Johan Hovold,
	Ronald Claveau, Salah Triki, Yury Norov, David Carlier,
	Achim Gratz, Alexander Sverdlin, Patrick Wicki, Markus Heidelberg,
	Markus Perkins, Uwe Kleine-König (The Capable Hub),
	Bjorn Helgaas, Abd-Alrhman Masalkhi, Chen Ni, Kees Cook,
	linux-arm-kernel, linux-amlogic, linux-kernel, linux-iio,
	linux-media, linux-omap, mfd, linux-i2c, linux-gpio, imx,
	linux-arm-msm, linux-stm32, linux-rtc, linux-sunxi,
	rust-for-linux

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@linkmauve.fr>
---
 drivers/rtc/rtc-abx80x.c   | 4 ++--
 drivers/rtc/rtc-cmos.c     | 2 +-
 drivers/rtc/rtc-ds1305.c   | 4 ++--
 drivers/rtc/rtc-ds1307.c   | 2 +-
 drivers/rtc/rtc-ds1343.c   | 2 +-
 drivers/rtc/rtc-ds1511.c   | 2 +-
 drivers/rtc/rtc-ds1553.c   | 4 ++--
 drivers/rtc/rtc-ds1685.c   | 4 ++--
 drivers/rtc/rtc-ds1742.c   | 4 ++--
 drivers/rtc/rtc-ds3232.c   | 2 +-
 drivers/rtc/rtc-isl12026.c | 4 ++--
 drivers/rtc/rtc-isl1208.c  | 2 +-
 drivers/rtc/rtc-m48t59.c   | 4 ++--
 drivers/rtc/rtc-m48t86.c   | 2 +-
 drivers/rtc/rtc-max31335.c | 2 +-
 drivers/rtc/rtc-meson.c    | 2 +-
 drivers/rtc/rtc-omap.c     | 4 ++--
 drivers/rtc/rtc-pcf2127.c  | 2 +-
 drivers/rtc/rtc-pcf85063.c | 2 +-
 drivers/rtc/rtc-pcf85363.c | 4 ++--
 drivers/rtc/rtc-rp5c01.c   | 4 ++--
 drivers/rtc/rtc-rv3028.c   | 6 +++---
 drivers/rtc/rtc-rv3029c2.c | 2 +-
 drivers/rtc/rtc-rv3032.c   | 4 ++--
 drivers/rtc/rtc-rv8803.c   | 4 ++--
 drivers/rtc/rtc-rx8581.c   | 4 ++--
 drivers/rtc/rtc-s35390a.c  | 4 ++--
 drivers/rtc/rtc-stk17ta8.c | 4 ++--
 drivers/rtc/rtc-sun6i.c    | 4 ++--
 drivers/rtc/rtc-ti-k3.c    | 2 +-
 drivers/rtc/rtc-twl.c      | 2 +-
 31 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index 5486d9d0b1e5..c401c70cbace 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -733,10 +733,10 @@ static int abx80x_nvmem_read(void *priv, unsigned int offset, void *val,
 	return abx80x_nvmem_xfer(priv, offset, val, bytes, false);
 }
 
-static int abx80x_nvmem_write(void *priv, unsigned int offset, void *val,
+static int abx80x_nvmem_write(void *priv, unsigned int offset, const void *val,
 			      size_t bytes)
 {
-	return abx80x_nvmem_xfer(priv, offset, val, bytes, true);
+	return abx80x_nvmem_xfer(priv, offset, (void *)val, bytes, true);
 }
 
 static int abx80x_setup_nvmem(struct abx80x_priv *priv)
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index fa04ece151b8..09da71a0009e 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -659,7 +659,7 @@ static int cmos_nvram_read(void *priv, unsigned int off, void *val,
 	return 0;
 }
 
-static int cmos_nvram_write(void *priv, unsigned int off, void *val,
+static int cmos_nvram_write(void *priv, unsigned int off, const void *val,
 			    size_t count)
 {
 	struct cmos_rtc	*cmos = priv;
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index d4de401548b4..eab61ec97ece 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -487,7 +487,7 @@ static irqreturn_t ds1305_irq(int irq, void *p)
  */
 
 static void msg_init(struct spi_message *m, struct spi_transfer *x,
-		u8 *addr, size_t count, char *tx, char *rx)
+		u8 *addr, size_t count, const char *tx, char *rx)
 {
 	spi_message_init(m);
 	memset(x, 0, 2 * sizeof(*x));
@@ -519,7 +519,7 @@ static int ds1305_nvram_read(void *priv, unsigned int off, void *buf,
 	return spi_sync(spi, &m);
 }
 
-static int ds1305_nvram_write(void *priv, unsigned int off, void *buf,
+static int ds1305_nvram_write(void *priv, unsigned int off, const void *buf,
 			      size_t count)
 {
 	struct ds1305		*ds1305 = priv;
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index fd3858b6569e..7cb6c96d2ec7 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -1285,7 +1285,7 @@ static int ds1307_nvram_read(void *priv, unsigned int offset, void *val,
 				val, bytes);
 }
 
-static int ds1307_nvram_write(void *priv, unsigned int offset, void *val,
+static int ds1307_nvram_write(void *priv, unsigned int offset, const void *val,
 			      size_t bytes)
 {
 	struct ds1307 *ds1307 = priv;
diff --git a/drivers/rtc/rtc-ds1343.c b/drivers/rtc/rtc-ds1343.c
index aa9500791b7e..b4daa5136078 100644
--- a/drivers/rtc/rtc-ds1343.c
+++ b/drivers/rtc/rtc-ds1343.c
@@ -123,7 +123,7 @@ static ssize_t ds1343_store_glitchfilter(struct device *dev,
 static DEVICE_ATTR(glitch_filter, S_IRUGO | S_IWUSR, ds1343_show_glitchfilter,
 			ds1343_store_glitchfilter);
 
-static int ds1343_nvram_write(void *priv, unsigned int off, void *val,
+static int ds1343_nvram_write(void *priv, unsigned int off, const void *val,
 			      size_t bytes)
 {
 	struct ds1343_priv *ds1343 = priv;
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c
index 8b087d9556be..23ee75f8035b 100644
--- a/drivers/rtc/rtc-ds1511.c
+++ b/drivers/rtc/rtc-ds1511.c
@@ -257,7 +257,7 @@ static int ds1511_nvram_read(void *priv, unsigned int pos, void *buf,
 	return 0;
 }
 
-static int ds1511_nvram_write(void *priv, unsigned int pos, void *buf,
+static int ds1511_nvram_write(void *priv, unsigned int pos, const void *buf,
 			      size_t size)
 {
 	int i;
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c
index dbff5b621ef5..d561bd5997bc 100644
--- a/drivers/rtc/rtc-ds1553.c
+++ b/drivers/rtc/rtc-ds1553.c
@@ -234,13 +234,13 @@ static int ds1553_nvram_read(void *priv, unsigned int pos, void *val,
 	return 0;
 }
 
-static int ds1553_nvram_write(void *priv, unsigned int pos, void *val,
+static int ds1553_nvram_write(void *priv, unsigned int pos, const void *val,
 			      size_t bytes)
 {
 	struct platform_device *pdev = priv;
 	struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
 	void __iomem *ioaddr = pdata->ioaddr;
-	u8 *buf = val;
+	const u8 *buf = val;
 
 	for (; bytes; bytes--)
 		writeb(*buf++, ioaddr + pos++);
diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c
index 5fc8e36b1abf..996d13cd3ce3 100644
--- a/drivers/rtc/rtc-ds1685.c
+++ b/drivers/rtc/rtc-ds1685.c
@@ -904,13 +904,13 @@ static int ds1685_nvram_read(void *priv, unsigned int pos, void *val,
 	return 0;
 }
 
-static int ds1685_nvram_write(void *priv, unsigned int pos, void *val,
+static int ds1685_nvram_write(void *priv, unsigned int pos, const void *val,
 			      size_t size)
 {
 	struct ds1685_priv *rtc = priv;
 	struct mutex *rtc_mutex = &rtc->dev->ops_lock;
 	ssize_t count;
-	u8 *buf = val;
+	const u8 *buf = val;
 	int err;
 
 	err = mutex_lock_interruptible(rtc_mutex);
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c
index 6ae8b9a294fe..257d91400290 100644
--- a/drivers/rtc/rtc-ds1742.c
+++ b/drivers/rtc/rtc-ds1742.c
@@ -126,12 +126,12 @@ static int ds1742_nvram_read(void *priv, unsigned int pos, void *val,
 	return 0;
 }
 
-static int ds1742_nvram_write(void *priv, unsigned int pos, void *val,
+static int ds1742_nvram_write(void *priv, unsigned int pos, const void *val,
 			      size_t bytes)
 {
 	struct rtc_plat_data *pdata = priv;
 	void __iomem *ioaddr = pdata->ioaddr_nvram;
-	u8 *buf = val;
+	const u8 *buf = val;
 
 	for (; bytes; bytes--)
 		writeb(*buf++, ioaddr + pos++);
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
index d1ef9e0dad34..2a978c9f21b1 100644
--- a/drivers/rtc/rtc-ds3232.c
+++ b/drivers/rtc/rtc-ds3232.c
@@ -449,7 +449,7 @@ static int ds3232_nvmem_read(void *priv, unsigned int offset, void *val,
 				val, bytes);
 }
 
-static int ds3232_nvmem_write(void *priv, unsigned int offset, void *val,
+static int ds3232_nvmem_write(void *priv, unsigned int offset, const void *val,
 			      size_t bytes)
 {
 	struct regmap *ds3232_regmap = (struct regmap *)priv;
diff --git a/drivers/rtc/rtc-isl12026.c b/drivers/rtc/rtc-isl12026.c
index b86a325d8a23..0b8b1b50c7b6 100644
--- a/drivers/rtc/rtc-isl12026.c
+++ b/drivers/rtc/rtc-isl12026.c
@@ -319,11 +319,11 @@ static int isl12026_nvm_read(void *p, unsigned int offset,
 }
 
 static int isl12026_nvm_write(void *p, unsigned int offset,
-			      void *val, size_t bytes)
+			      const void *val, size_t bytes)
 {
 	struct isl12026 *priv = p;
 	int ret;
-	u8 *v = val;
+	const u8 *v = val;
 	size_t chunk_size, num_written;
 	u8 payload[ISL12026_PAGESIZE + 2]; /* page + 2 address bytes */
 	struct i2c_msg msgs[] = {
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index 9bdd5d121571..07ce522e69c5 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -799,7 +799,7 @@ static int isl1208_nvmem_read(void *priv, unsigned int off, void *buf,
 				    count);
 }
 
-static int isl1208_nvmem_write(void *priv, unsigned int off, void *buf,
+static int isl1208_nvmem_write(void *priv, unsigned int off, const void *buf,
 			       size_t count)
 {
 	struct isl1208_state *isl1208 = priv;
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index 4e608bc8bbd3..ad407faecf1f 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -316,7 +316,7 @@ static int m48t59_nvram_read(void *priv, unsigned int offset, void *val,
 	return 0;
 }
 
-static int m48t59_nvram_write(void *priv, unsigned int offset, void *val,
+static int m48t59_nvram_write(void *priv, unsigned int offset, const void *val,
 			      size_t size)
 {
 	struct platform_device *pdev = priv;
@@ -325,7 +325,7 @@ static int m48t59_nvram_write(void *priv, unsigned int offset, void *val,
 	struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
 	ssize_t cnt = 0;
 	unsigned long flags;
-	u8 *buf = val;
+	const u8 *buf = val;
 
 	spin_lock_irqsave(&m48t59->lock, flags);
 
diff --git a/drivers/rtc/rtc-m48t86.c b/drivers/rtc/rtc-m48t86.c
index db3bdb171ff0..da3835d85fbc 100644
--- a/drivers/rtc/rtc-m48t86.c
+++ b/drivers/rtc/rtc-m48t86.c
@@ -171,7 +171,7 @@ static int m48t86_nvram_read(void *priv, unsigned int off, void *buf,
 	return 0;
 }
 
-static int m48t86_nvram_write(void *priv, unsigned int off, void *buf,
+static int m48t86_nvram_write(void *priv, unsigned int off, const void *buf,
 			      size_t count)
 {
 	struct device *dev = priv;
diff --git a/drivers/rtc/rtc-max31335.c b/drivers/rtc/rtc-max31335.c
index 595816973851..3b3d4b0d3af3 100644
--- a/drivers/rtc/rtc-max31335.c
+++ b/drivers/rtc/rtc-max31335.c
@@ -576,7 +576,7 @@ static int max31335_nvmem_reg_read(void *priv, unsigned int offset,
 }
 
 static int max31335_nvmem_reg_write(void *priv, unsigned int offset,
-				    void *val, size_t bytes)
+				    const void *val, size_t bytes)
 {
 	struct max31335_data *max31335 = priv;
 	unsigned int reg = max31335->chip->ram_reg + offset;
diff --git a/drivers/rtc/rtc-meson.c b/drivers/rtc/rtc-meson.c
index 21eceb9e2e13..d9dbab95e5da 100644
--- a/drivers/rtc/rtc-meson.c
+++ b/drivers/rtc/rtc-meson.c
@@ -266,7 +266,7 @@ static int meson_rtc_regmem_read(void *context, unsigned int offset,
 }
 
 static int meson_rtc_regmem_write(void *context, unsigned int offset,
-				  void *buf, size_t bytes)
+				  const void *buf, size_t bytes)
 {
 	struct meson_rtc *rtc = context;
 	unsigned int write_offset, write_size;
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 0f90065e352c..63a555697ddf 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -699,11 +699,11 @@ static int omap_rtc_scratch_read(void *priv, unsigned int offset, void *_val,
 	return 0;
 }
 
-static int omap_rtc_scratch_write(void *priv, unsigned int offset, void *_val,
+static int omap_rtc_scratch_write(void *priv, unsigned int offset, const void *_val,
 				  size_t bytes)
 {
 	struct omap_rtc	*rtc = priv;
-	u32 *val = _val;
+	const u32 *val = _val;
 	int i;
 
 	rtc->type->unlock(rtc);
diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index 1995e9f2756d..77b1a4a6a8b5 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -460,7 +460,7 @@ static int pcf2127_nvmem_read(void *priv, unsigned int offset,
 }
 
 static int pcf2127_nvmem_write(void *priv, unsigned int offset,
-			       void *val, size_t bytes)
+			       const void *val, size_t bytes)
 {
 	struct pcf2127 *pcf2127 = priv;
 	int ret;
diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c
index 01e209d88f5f..7cb59a105b5d 100644
--- a/drivers/rtc/rtc-pcf85063.c
+++ b/drivers/rtc/rtc-pcf85063.c
@@ -340,7 +340,7 @@ static int pcf85063_nvmem_read(void *priv, unsigned int offset,
 }
 
 static int pcf85063_nvmem_write(void *priv, unsigned int offset,
-				void *val, size_t bytes)
+				const void *val, size_t bytes)
 {
 	return regmap_write(priv, PCF85063_REG_RAM, *(u8 *)val);
 }
diff --git a/drivers/rtc/rtc-pcf85363.c b/drivers/rtc/rtc-pcf85363.c
index 540042b9eec8..d652a9353fd6 100644
--- a/drivers/rtc/rtc-pcf85363.c
+++ b/drivers/rtc/rtc-pcf85363.c
@@ -328,7 +328,7 @@ static int pcf85363_nvram_read(void *priv, unsigned int offset, void *val,
 				val, bytes);
 }
 
-static int pcf85363_nvram_write(void *priv, unsigned int offset, void *val,
+static int pcf85363_nvram_write(void *priv, unsigned int offset, const void *val,
 				size_t bytes)
 {
 	struct pcf85363 *pcf85363 = priv;
@@ -350,7 +350,7 @@ static int pcf85x63_nvram_read(void *priv, unsigned int offset, void *val,
 	return ret;
 }
 
-static int pcf85x63_nvram_write(void *priv, unsigned int offset, void *val,
+static int pcf85x63_nvram_write(void *priv, unsigned int offset, const void *val,
 				size_t bytes)
 {
 	struct pcf85363 *pcf85363 = priv;
diff --git a/drivers/rtc/rtc-rp5c01.c b/drivers/rtc/rtc-rp5c01.c
index 44afa6d996e7..b38799525043 100644
--- a/drivers/rtc/rtc-rp5c01.c
+++ b/drivers/rtc/rtc-rp5c01.c
@@ -188,11 +188,11 @@ static int rp5c01_nvram_read(void *_priv, unsigned int pos, void *val,
 	return 0;
 }
 
-static int rp5c01_nvram_write(void *_priv, unsigned int pos, void *val,
+static int rp5c01_nvram_write(void *_priv, unsigned int pos, const void *val,
 			      size_t bytes)
 {
 	struct rp5c01_priv *priv = _priv;
-	u8 *buf = val;
+	const u8 *buf = val;
 
 	spin_lock_irq(&priv->lock);
 
diff --git a/drivers/rtc/rtc-rv3028.c b/drivers/rtc/rtc-rv3028.c
index d96f6bb68850..e95600493f7f 100644
--- a/drivers/rtc/rtc-rv3028.c
+++ b/drivers/rtc/rtc-rv3028.c
@@ -602,7 +602,7 @@ static int rv3028_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
 	}
 }
 
-static int rv3028_nvram_write(void *priv, unsigned int offset, void *val,
+static int rv3028_nvram_write(void *priv, unsigned int offset, const void *val,
 			      size_t bytes)
 {
 	return regmap_bulk_write(priv, RV3028_RAM1 + offset, val, bytes);
@@ -614,13 +614,13 @@ static int rv3028_nvram_read(void *priv, unsigned int offset, void *val,
 	return regmap_bulk_read(priv, RV3028_RAM1 + offset, val, bytes);
 }
 
-static int rv3028_eeprom_write(void *priv, unsigned int offset, void *val,
+static int rv3028_eeprom_write(void *priv, unsigned int offset, const void *val,
 			       size_t bytes)
 {
 	struct rv3028_data *rv3028 = priv;
 	u32 status, eerd;
 	int i, ret;
-	u8 *buf = val;
+	const u8 *buf = val;
 
 	ret = rv3028_enter_eerd(rv3028, &eerd);
 	if (ret)
diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
index 98953af2a24a..a6a01e0c5d9d 100644
--- a/drivers/rtc/rtc-rv3029c2.c
+++ b/drivers/rtc/rtc-rv3029c2.c
@@ -472,7 +472,7 @@ static int rv3029_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
 	}
 }
 
-static int rv3029_nvram_write(void *priv, unsigned int offset, void *val,
+static int rv3029_nvram_write(void *priv, unsigned int offset, const void *val,
 			      size_t bytes)
 {
 	return regmap_bulk_write(priv, RV3029_RAM_PAGE + offset, val, bytes);
diff --git a/drivers/rtc/rtc-rv3032.c b/drivers/rtc/rtc-rv3032.c
index 6bafdec637ae..b6b401be09bb 100644
--- a/drivers/rtc/rtc-rv3032.c
+++ b/drivers/rtc/rtc-rv3032.c
@@ -483,7 +483,7 @@ static int rv3032_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
 	}
 }
 
-static int rv3032_nvram_write(void *priv, unsigned int offset, void *val, size_t bytes)
+static int rv3032_nvram_write(void *priv, unsigned int offset, const void *val, size_t bytes)
 {
 	return regmap_bulk_write(priv, RV3032_RAM1 + offset, val, bytes);
 }
@@ -493,7 +493,7 @@ static int rv3032_nvram_read(void *priv, unsigned int offset, void *val, size_t
 	return regmap_bulk_read(priv, RV3032_RAM1 + offset, val, bytes);
 }
 
-static int rv3032_eeprom_write(void *priv, unsigned int offset, void *val, size_t bytes)
+static int rv3032_eeprom_write(void *priv, unsigned int offset, const void *val, size_t bytes)
 {
 	struct rv3032_data *rv3032 = priv;
 	u32 status, eerd;
diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
index b9b5fee16ee4..f2adccf611dd 100644
--- a/drivers/rtc/rtc-rv8803.c
+++ b/drivers/rtc/rtc-rv8803.c
@@ -536,10 +536,10 @@ static int rv8803_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
 	}
 }
 
-static int rv8803_nvram_write(void *priv, unsigned int offset, void *val,
+static int rv8803_nvram_write(void *priv, unsigned int offset, const void *val,
 			      size_t bytes)
 {
-	return rv8803_write_reg(priv, RV8803_RAM, *(u8 *)val);
+	return rv8803_write_reg(priv, RV8803_RAM, *(const u8 *)val);
 }
 
 static int rv8803_nvram_read(void *priv, unsigned int offset,
diff --git a/drivers/rtc/rtc-rx8581.c b/drivers/rtc/rtc-rx8581.c
index cf4dab94c337..6da6219ed8fe 100644
--- a/drivers/rtc/rtc-rx8581.c
+++ b/drivers/rtc/rtc-rx8581.c
@@ -188,7 +188,7 @@ static int rx8571_nvram_read(void *priv, unsigned int offset, void *val,
 	return regmap_bulk_read(regmap, RX8571_USER_RAM + offset, val, bytes);
 }
 
-static int rx8571_nvram_write(void *priv, unsigned int offset, void *val,
+static int rx8571_nvram_write(void *priv, unsigned int offset, const void *val,
 			      size_t bytes)
 {
 	struct regmap *regmap = priv;
@@ -209,7 +209,7 @@ static int rx85x1_nvram_read(void *priv, unsigned int offset, void *val,
 	return ret;
 }
 
-static int rx85x1_nvram_write(void *priv, unsigned int offset, void *val,
+static int rx85x1_nvram_write(void *priv, unsigned int offset, const void *val,
 			      size_t bytes)
 {
 	struct regmap *regmap = priv;
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index b72eef4fb099..73ff0491f675 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -67,7 +67,7 @@ struct s35390a {
 	int twentyfourhour;
 };
 
-static int s35390a_set_reg(struct s35390a *s35390a, int reg, u8  *buf, int len)
+static int s35390a_set_reg(struct s35390a *s35390a, int reg, const u8 *buf, int len)
 {
 	struct i2c_client *client = s35390a->client[reg];
 	struct i2c_msg msg[] = {
@@ -426,7 +426,7 @@ static int s35390a_nvmem_read(void *priv, unsigned int offset, void *val,
 	return s35390a_get_reg(s35390a, S35390A_CMD_FREE_REG, val, bytes);
 }
 
-static int s35390a_nvmem_write(void *priv, unsigned int offset, void *val,
+static int s35390a_nvmem_write(void *priv, unsigned int offset, const void *val,
 			       size_t bytes)
 {
 	struct s35390a *s35390a = priv;
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c
index 7cb6be1b7815..c667be6829d6 100644
--- a/drivers/rtc/rtc-stk17ta8.c
+++ b/drivers/rtc/rtc-stk17ta8.c
@@ -242,12 +242,12 @@ static int stk17ta8_nvram_read(void *priv, unsigned int pos, void *val,
 	return 0;
 }
 
-static int stk17ta8_nvram_write(void *priv, unsigned int pos, void *val,
+static int stk17ta8_nvram_write(void *priv, unsigned int pos, const void *val,
 				size_t bytes)
 {
 	struct rtc_plat_data *pdata = priv;
 	void __iomem *ioaddr = pdata->ioaddr;
-	u8 *buf = val;
+	const u8 *buf = val;
 
 	for (; bytes; bytes--)
 		writeb(*buf++, ioaddr + pos++);
diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
index 7fc60880e409..67af5198f815 100644
--- a/drivers/rtc/rtc-sun6i.c
+++ b/drivers/rtc/rtc-sun6i.c
@@ -688,10 +688,10 @@ static int sun6i_rtc_nvmem_read(void *priv, unsigned int offset, void *_val, siz
 	return 0;
 }
 
-static int sun6i_rtc_nvmem_write(void *priv, unsigned int offset, void *_val, size_t bytes)
+static int sun6i_rtc_nvmem_write(void *priv, unsigned int offset, const void *_val, size_t bytes)
 {
 	struct sun6i_rtc_dev *chip = priv;
-	u32 *val = _val;
+	const u32 *val = _val;
 	int i;
 
 	for (i = 0; i < bytes / 4; ++i)
diff --git a/drivers/rtc/rtc-ti-k3.c b/drivers/rtc/rtc-ti-k3.c
index 8df00319cb6b..03b7a7fe631e 100644
--- a/drivers/rtc/rtc-ti-k3.c
+++ b/drivers/rtc/rtc-ti-k3.c
@@ -491,7 +491,7 @@ static int ti_k3_rtc_scratch_read(void *priv_data, unsigned int offset,
 }
 
 static int ti_k3_rtc_scratch_write(void *priv_data, unsigned int offset,
-				   void *val, size_t bytes)
+				   const void *val, size_t bytes)
 {
 	struct ti_k3_rtc *priv = (struct ti_k3_rtc *)priv_data;
 	int ret;
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index e6106e67e1f4..6b5dc1f09884 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -493,7 +493,7 @@ static int twl_nvram_read(void *priv, unsigned int offset, void *val,
 	return twl_i2c_read((long)priv, val, offset, bytes);
 }
 
-static int twl_nvram_write(void *priv, unsigned int offset, void *val,
+static int twl_nvram_write(void *priv, unsigned int offset, const void *val,
 			   size_t bytes)
 {
 	return twl_i2c_write((long)priv, val, offset, bytes);
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/8] misc: make all reg_write callbacks take const void *
  2026-07-15 17:52 [PATCH 0/8] nvmem: make reg_write() take a const void * Link Mauve
                   ` (2 preceding siblings ...)
  2026-07-15 17:52 ` [PATCH 3/8] rtc: " Link Mauve
@ 2026-07-15 17:52 ` Link Mauve
  2026-07-15 18:04   ` sashiko-bot
  2026-07-15 17:52 ` [PATCH 5/8] iio: pressure: bmp280: make reg_write callback " Link Mauve
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Link Mauve @ 2026-07-15 17:52 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Link Mauve, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Jonathan Cameron, David Lechner,
	Nuno Sá, Andy Shevchenko, Sakari Ailus, Tianshu Qiu,
	Bingbu Cao, Mauro Carvalho Chehab, Aaro Koskinen, Andreas Kemnade,
	Roger Quadros, Tony Lindgren, Lee Jones, Arnd Bergmann,
	Greg Kroah-Hartman, Bartosz Golaszewski, Vaibhaav Ram T.L,
	Kumaravel Thiagarajan, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Vladimir Zapolskiy,
	André Draszik, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Praveen Teja Kundanala,
	Kalyani Akula, Michal Simek, Alexandre Belloni, Joshua Kinard,
	Antoniu Miclaus, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan, Daniel Lezcano, Johan Hovold,
	Ronald Claveau, Salah Triki, Yury Norov, David Carlier,
	Achim Gratz, Alexander Sverdlin, Patrick Wicki, Markus Heidelberg,
	Markus Perkins, Uwe Kleine-König (The Capable Hub),
	Bjorn Helgaas, Abd-Alrhman Masalkhi, Chen Ni, Kees Cook,
	linux-arm-kernel, linux-amlogic, linux-kernel, linux-iio,
	linux-media, linux-omap, mfd, linux-i2c, linux-gpio, imx,
	linux-arm-msm, linux-stm32, linux-rtc, linux-sunxi,
	rust-for-linux

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@linkmauve.fr>
---
 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


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 5/8] iio: pressure: bmp280: make reg_write callback take const void *
  2026-07-15 17:52 [PATCH 0/8] nvmem: make reg_write() take a const void * Link Mauve
                   ` (3 preceding siblings ...)
  2026-07-15 17:52 ` [PATCH 4/8] misc: " Link Mauve
@ 2026-07-15 17:52 ` Link Mauve
  2026-07-15 18:03   ` sashiko-bot
  2026-07-15 17:52 ` [PATCH 6/8] firmware: meson_sm: " Link Mauve
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Link Mauve @ 2026-07-15 17:52 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Link Mauve, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Jonathan Cameron, David Lechner,
	Nuno Sá, Andy Shevchenko, Sakari Ailus, Tianshu Qiu,
	Bingbu Cao, Mauro Carvalho Chehab, Aaro Koskinen, Andreas Kemnade,
	Roger Quadros, Tony Lindgren, Lee Jones, Arnd Bergmann,
	Greg Kroah-Hartman, Bartosz Golaszewski, Vaibhaav Ram T.L,
	Kumaravel Thiagarajan, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Vladimir Zapolskiy,
	André Draszik, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Praveen Teja Kundanala,
	Kalyani Akula, Michal Simek, Alexandre Belloni, Joshua Kinard,
	Antoniu Miclaus, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan, Daniel Lezcano, Johan Hovold,
	Ronald Claveau, Salah Triki, Yury Norov, David Carlier,
	Achim Gratz, Alexander Sverdlin, Patrick Wicki, Markus Heidelberg,
	Markus Perkins, Uwe Kleine-König (The Capable Hub),
	Bjorn Helgaas, Abd-Alrhman Masalkhi, Chen Ni, Kees Cook,
	linux-arm-kernel, linux-amlogic, linux-kernel, linux-iio,
	linux-media, linux-omap, mfd, linux-i2c, linux-gpio, imx,
	linux-arm-msm, linux-stm32, linux-rtc, linux-sunxi,
	rust-for-linux

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@linkmauve.fr>
---
 drivers/iio/pressure/bmp280-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
index 990340a9b10c..0a39c5f39378 100644
--- a/drivers/iio/pressure/bmp280-core.c
+++ b/drivers/iio/pressure/bmp280-core.c
@@ -2261,11 +2261,11 @@ static int bmp580_nvmem_read(void *priv, unsigned int offset, void *val,
 	return ret;
 }
 
-static int bmp580_nvmem_write_impl(void *priv, unsigned int offset, void *val,
+static int bmp580_nvmem_write_impl(void *priv, unsigned int offset, const void *val,
 				   size_t bytes)
 {
 	struct bmp280_data *data = priv;
-	u16 *buf = val;
+	const u16 *buf = val;
 	int ret, addr;
 
 	guard(mutex)(&data->lock);
@@ -2322,7 +2322,7 @@ static int bmp580_nvmem_write_impl(void *priv, unsigned int offset, void *val,
 	return ret;
 }
 
-static int bmp580_nvmem_write(void *priv, unsigned int offset, void *val,
+static int bmp580_nvmem_write(void *priv, unsigned int offset, const void *val,
 			      size_t bytes)
 {
 	struct bmp280_data *data = priv;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 6/8] firmware: meson_sm: make reg_write callback take const void *
  2026-07-15 17:52 [PATCH 0/8] nvmem: make reg_write() take a const void * Link Mauve
                   ` (4 preceding siblings ...)
  2026-07-15 17:52 ` [PATCH 5/8] iio: pressure: bmp280: make reg_write callback " Link Mauve
@ 2026-07-15 17:52 ` Link Mauve
  2026-07-15 18:06   ` sashiko-bot
  2026-07-15 17:52 ` [PATCH 7/8] mfd: twl-core: " Link Mauve
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Link Mauve @ 2026-07-15 17:52 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Link Mauve, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Jonathan Cameron, David Lechner,
	Nuno Sá, Andy Shevchenko, Sakari Ailus, Tianshu Qiu,
	Bingbu Cao, Mauro Carvalho Chehab, Aaro Koskinen, Andreas Kemnade,
	Roger Quadros, Tony Lindgren, Lee Jones, Arnd Bergmann,
	Greg Kroah-Hartman, Bartosz Golaszewski, Vaibhaav Ram T.L,
	Kumaravel Thiagarajan, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Vladimir Zapolskiy,
	André Draszik, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Praveen Teja Kundanala,
	Kalyani Akula, Michal Simek, Alexandre Belloni, Joshua Kinard,
	Antoniu Miclaus, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan, Daniel Lezcano, Johan Hovold,
	Ronald Claveau, Salah Triki, Yury Norov, David Carlier,
	Achim Gratz, Alexander Sverdlin, Patrick Wicki, Markus Heidelberg,
	Markus Perkins, Uwe Kleine-König (The Capable Hub),
	Bjorn Helgaas, Abd-Alrhman Masalkhi, Chen Ni, Kees Cook,
	linux-arm-kernel, linux-amlogic, linux-kernel, linux-iio,
	linux-media, linux-omap, mfd, linux-i2c, linux-gpio, imx,
	linux-arm-msm, linux-stm32, linux-rtc, linux-sunxi,
	rust-for-linux

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@linkmauve.fr>
---
 drivers/firmware/meson/meson_sm.c       | 2 +-
 include/linux/firmware/meson/meson_sm.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
index ab9751a59b55..5d4da2e3c3a9 100644
--- a/drivers/firmware/meson/meson_sm.c
+++ b/drivers/firmware/meson/meson_sm.c
@@ -196,7 +196,7 @@ EXPORT_SYMBOL(meson_sm_call_read);
  *
  * Return:	size of sent data on success, a negative value on error
  */
-int meson_sm_call_write(struct meson_sm_firmware *fw, void *buffer,
+int meson_sm_call_write(struct meson_sm_firmware *fw, const void *buffer,
 			unsigned int size, unsigned int cmd_index, u32 arg0,
 			u32 arg1, u32 arg2, u32 arg3, u32 arg4)
 {
diff --git a/include/linux/firmware/meson/meson_sm.h b/include/linux/firmware/meson/meson_sm.h
index 3ebc2bd9a976..92cc61f3a1c0 100644
--- a/include/linux/firmware/meson/meson_sm.h
+++ b/include/linux/firmware/meson/meson_sm.h
@@ -21,7 +21,7 @@ struct meson_sm_firmware;
 
 int meson_sm_call(struct meson_sm_firmware *fw, unsigned int cmd_index,
 		  s32 *ret, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
-int meson_sm_call_write(struct meson_sm_firmware *fw, void *buffer,
+int meson_sm_call_write(struct meson_sm_firmware *fw, const void *buffer,
 			unsigned int b_size, unsigned int cmd_index, u32 arg0,
 			u32 arg1, u32 arg2, u32 arg3, u32 arg4);
 int meson_sm_call_read(struct meson_sm_firmware *fw, void *buffer,
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 7/8] mfd: twl-core: make reg_write callback take const void *
  2026-07-15 17:52 [PATCH 0/8] nvmem: make reg_write() take a const void * Link Mauve
                   ` (5 preceding siblings ...)
  2026-07-15 17:52 ` [PATCH 6/8] firmware: meson_sm: " Link Mauve
@ 2026-07-15 17:52 ` Link Mauve
  2026-07-15 18:08   ` sashiko-bot
  2026-07-15 17:52 ` [PATCH 8/8] media: ov2740: remove NULL reg_write callback Link Mauve
  2026-07-15 19:02 ` [PATCH 0/8] nvmem: make reg_write() take a const void * Andy Shevchenko
  8 siblings, 1 reply; 20+ messages in thread
From: Link Mauve @ 2026-07-15 17:52 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Link Mauve, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Jonathan Cameron, David Lechner,
	Nuno Sá, Andy Shevchenko, Sakari Ailus, Tianshu Qiu,
	Bingbu Cao, Mauro Carvalho Chehab, Aaro Koskinen, Andreas Kemnade,
	Roger Quadros, Tony Lindgren, Lee Jones, Arnd Bergmann,
	Greg Kroah-Hartman, Bartosz Golaszewski, Vaibhaav Ram T.L,
	Kumaravel Thiagarajan, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Vladimir Zapolskiy,
	André Draszik, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Praveen Teja Kundanala,
	Kalyani Akula, Michal Simek, Alexandre Belloni, Joshua Kinard,
	Antoniu Miclaus, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan, Daniel Lezcano, Johan Hovold,
	Ronald Claveau, Salah Triki, Yury Norov, David Carlier,
	Achim Gratz, Alexander Sverdlin, Patrick Wicki, Markus Heidelberg,
	Markus Perkins, Uwe Kleine-König (The Capable Hub),
	Bjorn Helgaas, Abd-Alrhman Masalkhi, Chen Ni, Kees Cook,
	linux-arm-kernel, linux-amlogic, linux-kernel, linux-iio,
	linux-media, linux-omap, mfd, linux-i2c, linux-gpio, imx,
	linux-arm-msm, linux-stm32, linux-rtc, linux-sunxi,
	rust-for-linux

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@linkmauve.fr>
---
 drivers/mfd/twl-core.c  | 2 +-
 include/linux/mfd/twl.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index c024a28b057e..d7e3ab41717b 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -447,7 +447,7 @@ static struct regmap *twl_get_regmap(u8 mod_no)
  *
  * Returns 0 on success or else a negative error code.
  */
-int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
+int twl_i2c_write(u8 mod_no, const u8 *value, u8 reg, unsigned num_bytes)
 {
 	struct regmap *regmap = twl_get_regmap(mod_no);
 	int ret;
diff --git a/include/linux/mfd/twl.h b/include/linux/mfd/twl.h
index b31e07fa4d51..131451d70960 100644
--- a/include/linux/mfd/twl.h
+++ b/include/linux/mfd/twl.h
@@ -168,7 +168,7 @@ int twl_set_regcache_bypass(u8 mod_no, bool enable);
 /*
  * Read and write several 8-bit registers at once.
  */
-int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
+int twl_i2c_write(u8 mod_no, const u8 *value, u8 reg, unsigned num_bytes);
 int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
 
 /*
@@ -186,7 +186,7 @@ static inline int twl_i2c_write_u16(u8 mod_no, u16 val, u8 reg) {
 	__le16 value;
 
 	value = cpu_to_le16(val);
-	return twl_i2c_write(mod_no, (u8 *) &value, reg, 2);
+	return twl_i2c_write(mod_no, (const u8 *) &value, reg, 2);
 }
 
 static inline int twl_i2c_read_u16(u8 mod_no, u16 *val, u8 reg) {
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 8/8] media: ov2740: remove NULL reg_write callback
  2026-07-15 17:52 [PATCH 0/8] nvmem: make reg_write() take a const void * Link Mauve
                   ` (6 preceding siblings ...)
  2026-07-15 17:52 ` [PATCH 7/8] mfd: twl-core: " Link Mauve
@ 2026-07-15 17:52 ` Link Mauve
  2026-07-15 18:07   ` sashiko-bot
  2026-07-15 19:02 ` [PATCH 0/8] nvmem: make reg_write() take a const void * Andy Shevchenko
  8 siblings, 1 reply; 20+ messages in thread
From: Link Mauve @ 2026-07-15 17:52 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Link Mauve, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Jonathan Cameron, David Lechner,
	Nuno Sá, Andy Shevchenko, Sakari Ailus, Tianshu Qiu,
	Bingbu Cao, Mauro Carvalho Chehab, Aaro Koskinen, Andreas Kemnade,
	Roger Quadros, Tony Lindgren, Lee Jones, Arnd Bergmann,
	Greg Kroah-Hartman, Bartosz Golaszewski, Vaibhaav Ram T.L,
	Kumaravel Thiagarajan, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Vladimir Zapolskiy,
	André Draszik, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Praveen Teja Kundanala,
	Kalyani Akula, Michal Simek, Alexandre Belloni, Joshua Kinard,
	Antoniu Miclaus, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan, Daniel Lezcano, Johan Hovold,
	Ronald Claveau, Salah Triki, Yury Norov, David Carlier,
	Achim Gratz, Alexander Sverdlin, Patrick Wicki, Markus Heidelberg,
	Markus Perkins, Uwe Kleine-König (The Capable Hub),
	Bjorn Helgaas, Abd-Alrhman Masalkhi, Chen Ni, Kees Cook,
	linux-arm-kernel, linux-amlogic, linux-kernel, linux-iio,
	linux-media, linux-omap, mfd, linux-i2c, linux-gpio, imx,
	linux-arm-msm, linux-stm32, linux-rtc, linux-sunxi,
	rust-for-linux

This field is already initialized to NULL, so there is no reason to
write it again.

This prevents it from appearing while grepping for reg_write in the
future.

Signed-off-by: Link Mauve <linkmauve@linkmauve.fr>
---
 drivers/media/i2c/ov2740.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c
index fb590dfadda1..799eca4023da 100644
--- a/drivers/media/i2c/ov2740.c
+++ b/drivers/media/i2c/ov2740.c
@@ -1271,7 +1271,6 @@ static int ov2740_register_nvmem(struct i2c_client *client,
 	nvmem_config.compat = true;
 	nvmem_config.base_dev = dev;
 	nvmem_config.reg_read = ov2740_nvmem_read;
-	nvmem_config.reg_write = NULL;
 	nvmem_config.priv = nvm;
 	nvmem_config.stride = 1;
 	nvmem_config.word_size = 1;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/8] nvmem: core: make reg_write() take a const void *
  2026-07-15 17:52 ` [PATCH 1/8] nvmem: core: " Link Mauve
@ 2026-07-15 18:00   ` sashiko-bot
  2026-07-15 18:58   ` Andy Shevchenko
  1 sibling, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-07-15 18:00 UTC (permalink / raw)
  To: Link Mauve
  Cc: linux-sunxi, lee, imx, Frank.Li, neil.armstrong, linux-rtc,
	Alexandre Belloni, linux-amlogic, mfd, ojeda

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Modifying the `nvmem_reg_write_t` callback signature to use `const void *val` without updating the implementing drivers causes widespread build failures and runtime kCFI panics.
--

--- Patch [1]: [PATCH 1/8] nvmem: core: make reg_write() take a const void * ---
commit 465aa1ef7ad6475c286716a1fffc7cdb9b6f09dc
Author: Link Mauve <linkmauve@linkmauve.fr>

nvmem: core: make reg_write() take a const void *

This commit changes the nvmem_reg_write_t callback signature to expect
a const void * instead of a mutable void *.

> diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
> index f3b13da78aac9..e62285836cbbe 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);

[Severity: High]
Does modifying this callback signature without updating the implementing
drivers cause widespread build failures and runtime kCFI panics?

For example, drivers/nvmem/bcm-ocotp.c:bcm_otpc_write() still expects
a mutable void *:

static int bcm_otpc_write(void *context, unsigned int offset, void *val,
                          size_t bytes)

When this is assigned to reg_write in bcm_otpc_nvmem_config, it causes an
incompatible pointer type mismatch. This leads to build errors with modern
compilers or -Werror, and will trigger kernel panics upon any nvmem write
operation on kernels with Control-Flow Integrity (kCFI) enabled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715175229.24672-1-linkmauve@linkmauve.fr?part=1

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/8] rtc: make all reg_write callbacks take const void *
  2026-07-15 17:52 ` [PATCH 3/8] rtc: " Link Mauve
@ 2026-07-15 18:01   ` sashiko-bot
  0 siblings, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-07-15 18:01 UTC (permalink / raw)
  To: Link Mauve
  Cc: linux-amlogic, mfd, Frank.Li, linux-rtc, linux-sunxi, lee, imx,
	ojeda, neil.armstrong, Alexandre Belloni

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Implicit pointer conversions discard the 'const' qualifier, causing compiler warnings.
--

--- Patch [3]: [PATCH 3/8] rtc: make all reg_write callbacks take const void * ---
commit dcceba66c45aeb1e0da5dfaf4cd7b3e0828ec69e
Author: Link Mauve <linkmauve@linkmauve.fr>

rtc: make all reg_write callbacks take const void *

This commit updates various RTC drivers to use a const void * parameter for
their nvmem_config write callbacks, aligning with the updated nvmem_config API.

> diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
> index fa04ece151b8b..09da71a0009e8 100644
> --- a/drivers/rtc/rtc-cmos.c
> +++ b/drivers/rtc/rtc-cmos.c
[ ... ]
> @@ -659,7 +659,7 @@ static int cmos_nvram_read(void *priv, unsigned int off, void *val,
>  	return 0;
>  }
>  
> -static int cmos_nvram_write(void *priv, unsigned int off, void *val,
> +static int cmos_nvram_write(void *priv, unsigned int off, const void *val,
>  			    size_t count)
>  {
>  	struct cmos_rtc	*cmos = priv;

[Severity: Low]
Does this cause a compiler warning for discarded qualifiers?

In the body of cmos_nvram_write(), the code assigns val to a non-const
pointer just below the diff context:

    unsigned char *buf = val;
    
Should buf also be declared as const unsigned char * to avoid breaking
builds where warnings are treated as errors?

> diff --git a/drivers/rtc/rtc-rv3032.c b/drivers/rtc/rtc-rv3032.c
> index 6bafdec637aea..b6b401be09bb5 100644
> --- a/drivers/rtc/rtc-rv3032.c
> +++ b/drivers/rtc/rtc-rv3032.c
[ ... ]
> @@ -493,7 +493,7 @@ static int rv3032_nvram_read(void *priv, unsigned int offset, void *val, size_t
>  	return regmap_bulk_read(priv, RV3032_RAM1 + offset, val, bytes);
>  }
>  
> -static int rv3032_eeprom_write(void *priv, unsigned int offset, void *val, size_t bytes)
> +static int rv3032_eeprom_write(void *priv, unsigned int offset, const void *val, size_t bytes)
>  {
>  	struct rv3032_data *rv3032 = priv;
>  	u32 status, eerd;

[Severity: Low]
Similar to the cmos driver, does this discard the const qualifier?

The rv3032_eeprom_write() function assigns the new const void *val to a 
non-const pointer just below the quoted diff context:

    u8 *buf = val;

Should this be updated to const u8 *buf as well?

> diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
> index b72eef4fb0997..73ff0491f6750 100644
> --- a/drivers/rtc/rtc-s35390a.c
> +++ b/drivers/rtc/rtc-s35390a.c
[ ... ]
> @@ -67,7 +67,7 @@ struct s35390a {
>  	int twentyfourhour;
>  };
>  
> -static int s35390a_set_reg(struct s35390a *s35390a, int reg, u8  *buf, int len)
> +static int s35390a_set_reg(struct s35390a *s35390a, int reg, const u8 *buf, int len)
>  {
>  	struct i2c_client *client = s35390a->client[reg];
>  	struct i2c_msg msg[] = {

[Severity: Low]
Does this assignment in s35390a_set_reg() trigger a discarded qualifiers
warning?

The struct i2c_msg defines its buf member as __u8 * (non-const). When the
msg array is initialized just below this hunk:

    struct i2c_msg msg[] = {
        {
            .addr = client->addr,
            .len = len,
            .buf = buf
        },
    };

Will assigning the const u8 *buf to the non-const .buf field cause a compiler
warning? Would it be better to explicitly cast it like (u8 *)buf to satisfy
the i2c_msg struct definition?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715175229.24672-1-linkmauve@linkmauve.fr?part=3

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 5/8] iio: pressure: bmp280: make reg_write callback take const void *
  2026-07-15 17:52 ` [PATCH 5/8] iio: pressure: bmp280: make reg_write callback " Link Mauve
@ 2026-07-15 18:03   ` sashiko-bot
  0 siblings, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-07-15 18:03 UTC (permalink / raw)
  To: Link Mauve
  Cc: mfd, linux-amlogic, imx, ojeda, Alexandre Belloni, Frank.Li, lee,
	linux-sunxi, linux-rtc, neil.armstrong

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Low] Syntax error due to 'void void *_val' parameter in qfprom_reg_write.

Pre-existing issues:
- [Critical] m48t59_nvram_read and m48t59_nvram_write completely ignore the requested offset.
--

--- Patch [5]: [PATCH 5/8] iio: pressure: bmp280: make reg_write callback take const void * ---
commit bd8404c8c6d692d9a700578455111f78fd0eaf2a
Author: Link Mauve <linkmauve@linkmauve.fr>

iio: pressure: bmp280: make reg_write callback take const void *

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.

> diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c
> index a872c640b8c5a..bacdcb5610bae 100644
> --- a/drivers/nvmem/qfprom.c
> +++ b/drivers/nvmem/qfprom.c
> @@ -253,13 +253,13 @@ static int qfprom_enable_fuse_blowing(const struct qfprom_priv *priv,
>   *
>   * Return: 0 or -err.
>   */
> -static int qfprom_reg_write(void *context, unsigned int reg, void *_val,
> +static int qfprom_reg_write(void *context, unsigned int reg, void void *_val,
>  			    size_t bytes)
>  {

[Severity: Low]
Does this syntax error in qfprom_reg_write() prevent the qfprom driver from
compiling?

It looks like "void void *_val" was introduced during a find-and-replace
to make the callback take a const void pointer.

>  	struct qfprom_priv *priv = context;
>  	struct qfprom_touched_values old;
>  	int words = bytes / 4;
> -	u32 *value = _val;
> +	const u32 *value = _val;
>  	u32 blow_status;

[ ... ]

> diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
> index 4e608bc8bbd36..ad407faecf1f8 100644
> --- a/drivers/rtc/rtc-m48t59.c
> +++ b/drivers/rtc/rtc-m48t59.c
> @@ -325,7 +325,7 @@ static int m48t59_nvram_write(void *priv, unsigned int offset, void *val,
>  	struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
>  	ssize_t cnt = 0;
>  	unsigned long flags;
> -	u8 *buf = val;
> +	const u8 *buf = val;
>  
>  	spin_lock_irqsave(&m48t59->lock, flags);
>  

[Severity: Critical]
This is a pre-existing issue, but does the loop in m48t59_nvram_write()
completely ignore the requested offset?

It appears that cnt starts at 0 and is used as the hardware address instead
of adding the requested offset:

drivers/rtc/rtc-m48t59.c:m48t59_nvram_write() {
    ...
	for (; cnt < size; cnt++)
		M48T59_WRITE(*buf++, cnt);
    ...
}

Any subsystem or user-space application performing an NVMEM write at an
offset greater than 0 will silently overwrite data at the very beginning
of the NVRAM.

The same issue seems to be present in m48t59_nvram_read(), which could
lead to incorrect data disclosure:

drivers/rtc/rtc-m48t59.c:m48t59_nvram_read() {
    ...
	for (; cnt < size; cnt++)
		*buf++ = M48T59_READ(cnt);
    ...
}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715175229.24672-1-linkmauve@linkmauve.fr?part=5

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 4/8] misc: make all reg_write callbacks take const void *
  2026-07-15 17:52 ` [PATCH 4/8] misc: " Link Mauve
@ 2026-07-15 18:04   ` sashiko-bot
  0 siblings, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-07-15 18:04 UTC (permalink / raw)
  To: Link Mauve
  Cc: ojeda, neil.armstrong, Alexandre Belloni, lee, linux-sunxi,
	linux-rtc, Frank.Li, linux-amlogic, imx, mfd

Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:

New issues:
- [Low] Passing `const void *` to `nvmem_device_write` discards the `const` qualifier, causing a compiler warning/error.

Pre-existing issues:
- [Critical] The `m24lr_write` function uses the device offset to index the source memory buffer, causing a critical out-of-bounds read of kernel memory.
- [High] Writing a dereferenced `const char *` byte to a 32-bit memory-mapped register triggers sign-extension, potentially writing corrupted values to the hardware.
- [High] Silent data loss when writing an odd number of bytes in 16-bit mode.
--

--- Patch [4]: [PATCH 4/8] misc: make all reg_write callbacks take const void * ---
commit 8fae9381bce13733c89619440fc083ff647125a4
Author: Link Mauve <linkmauve@linkmauve.fr>

misc: make all reg_write callbacks take const void *

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.

[ ... ]
> diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c
> index 5230e910a1d11..8de85433d593c 100644
> --- a/drivers/misc/eeprom/eeprom_93xx46.c
> +++ b/drivers/misc/eeprom/eeprom_93xx46.c
> @@ -269,10 +269,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;

[Severity: High]
This is a pre-existing issue, but does this function silently drop data when
writing an odd number of bytes in 16-bit mode?

In 16-bit word mode (EE_ADDR16), the driver intercepts the call and truncates
the count:

    count &= ~1;

If count is 1, it becomes 0, skipping the write loop entirely and returning 0.
Because the nvmem core interprets a 0 return value as success, the caller
believes the data was written even though the hardware was unmodified.

[ ... ]
> diff --git a/drivers/misc/eeprom/m24lr.c b/drivers/misc/eeprom/m24lr.c
> index 7a9fd45a8e460..22f3221e232b5 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)

[Severity: Critical]
This is a pre-existing issue, but does m24lr_write() use the device offset to
index the source memory buffer?

When m24lr_nvmem_write() calls m24lr_write(..., val, bytes, offset, true),
m24lr_write() passes buf + offset to the regmap write instead of advancing
by the number of bytes written:

    err = m24lr_regmap_write(regmap, buf + offset, n, offset);

Since buf is only sized for the data chunk being written, adding the device
offset pushes the pointer far past the end of buf, leading to an out-of-bounds
read of kernel memory that gets written to the external EEPROM.

>  {
>  	ssize_t err;

[ ... ]
> diff --git a/drivers/misc/keba/cp500.c b/drivers/misc/keba/cp500.c
> index 6c65fbf22e756..ee7889cb63a8b 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;

[Severity: Low]
Does passing the now-const val directly to nvmem_device_write() discard the
const qualifier?

nvmem_device_write() expects a mutable void pointer, which will cause a build
warning (and potentially break the build if -Werror is enabled):

    ret = nvmem_device_write(nvmem->base_nvmem, nvmem->offset + offset,
                             bytes, val);

[ ... ]
> diff --git a/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c b/drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_otpe2p.c
> index a2ed477e0370b..f2759e9b41386 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;

[Severity: High]
This is a pre-existing issue, but does dereferencing this const char pointer
trigger sign-extension when passed to writel()?

Later in this function, the byte is written like this:

    writel(*(value + byte), rb + MMAP_EEPROM_OFFSET(EEPROM_DATA_REG));

If the byte has its most significant bit set (e.g. is negative), the C compiler
will sign-extend it to a 32-bit negative integer before passing it to writel(),
which writes 1s into the upper 24 bits of the register. Should value be cast to
const u8 * to ensure safe zero-extension?

>  	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;

[Severity: High]
This is a pre-existing issue, but this has the same sign-extension behavior
when writing to OTP_PRGM_DATA_OFFSET:

    writel(*(value + byte), rb + MMAP_OTP_OFFSET(OTP_PRGM_DATA_OFFSET));

Should this pointer also be changed to const u8 *?

>  	u32 regval;
>  	u32 byte;
>  	int ret;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715175229.24672-1-linkmauve@linkmauve.fr?part=4

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/8] firmware: meson_sm: make reg_write callback take const void *
  2026-07-15 17:52 ` [PATCH 6/8] firmware: meson_sm: " Link Mauve
@ 2026-07-15 18:06   ` sashiko-bot
  0 siblings, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-07-15 18:06 UTC (permalink / raw)
  To: Link Mauve
  Cc: lee, Alexandre Belloni, neil.armstrong, linux-amlogic, mfd, imx,
	ojeda, Frank.Li, linux-sunxi, linux-rtc

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Concurrent calls to `meson_sm_call_write` or `meson_sm_call_read` will corrupt the shared IOMEM buffer.
--

--- Patch [6]: [PATCH 6/8] firmware: meson_sm: make reg_write callback take const void * ---
commit 05903fc223bec5b04f497c8b4bf66c4c6d90ebfe
Author: Link Mauve <linkmauve@linkmauve.fr>

firmware: meson_sm: make reg_write callback take const void *

This commit updates the meson_sm_call_write callback and its header
declaration to take a const void * buffer. This aligns with a previous
change to the nvmem_config API that switched from a mutable to an
immutable data pointer.

> diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
> index ab9751a59b552..5d4da2e3c3a94 100644
> --- a/drivers/firmware/meson/meson_sm.c
> +++ b/drivers/firmware/meson/meson_sm.c
> @@ -196,7 +196,7 @@ EXPORT_SYMBOL(meson_sm_call_read);
>   *
>   * Return:	size of sent data on success, a negative value on error
>   */
> -int meson_sm_call_write(struct meson_sm_firmware *fw, void *buffer,
> +int meson_sm_call_write(struct meson_sm_firmware *fw, const void *buffer,
>  			unsigned int size, unsigned int cmd_index, u32 arg0,
>  			u32 arg1, u32 arg2, u32 arg3, u32 arg4)
>  {

[ ... ]

>  	memcpy(fw->sm_shmem_in_base, buffer, size);
>  
>  	if (meson_sm_call(fw, cmd_index, &written, arg0, arg1, arg2, arg3, arg4) < 0)
>  		return -EINVAL;

[Severity: High]
This isn't a bug introduced by this patch, but does this function need
locking to protect the shared IOMEM buffer?

It appears that concurrent calls to meson_sm_call_write() or
meson_sm_call_read() could corrupt the shared sm_shmem_in_base and
sm_shmem_out_base buffers. If multiple threads concurrently write or read
the nvmem sysfs files, they might overwrite each other's payloads before
the SMC executes, sending corrupted data to the Secure Monitor.

A similar pattern exists in meson_sm_call_read():

	if (buffer)
		memcpy(buffer, fw->sm_shmem_out_base, size);

Are there external locks that guarantee serialized access to these functions,
or should we be synchronizing these shared memory operations?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715175229.24672-1-linkmauve@linkmauve.fr?part=6

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 8/8] media: ov2740: remove NULL reg_write callback
  2026-07-15 17:52 ` [PATCH 8/8] media: ov2740: remove NULL reg_write callback Link Mauve
@ 2026-07-15 18:07   ` sashiko-bot
  0 siblings, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-07-15 18:07 UTC (permalink / raw)
  To: Link Mauve
  Cc: imx, linux-amlogic, linux-sunxi, Alexandre Belloni, mfd, ojeda,
	neil.armstrong, linux-rtc, Frank.Li, lee

> This field is already initialized to NULL, so there is no reason to
> write it again.
> 
> This prevents it from appearing while grepping for reg_write in the
> future.
> 
> Signed-off-by: Link Mauve <linkmauve@linkmauve.fr>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715175229.24672-1-linkmauve@linkmauve.fr?part=8


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/8] nvmem: make all reg_write callbacks take const void *
  2026-07-15 17:52 ` [PATCH 2/8] nvmem: make all reg_write callbacks take " Link Mauve
@ 2026-07-15 18:08   ` sashiko-bot
  0 siblings, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-07-15 18:08 UTC (permalink / raw)
  To: Link Mauve
  Cc: Frank.Li, ojeda, imx, linux-rtc, linux-sunxi, lee,
	Alexandre Belloni, linux-amlogic, mfd, neil.armstrong

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Syntax error in `qfprom_reg_write` signature causing compilation failure
- [Low] Incomplete API migration causing widespread incompatible-pointer-types build errors across other subsystems
--

--- Patch [2]: [PATCH 2/8] nvmem: make all reg_write callbacks take const void * ---
commit 7e2f42ea4c9950738972bc60aeca19f14bd93ce4
Author: Link Mauve <linkmauve@linkmauve.fr>

nvmem: make all reg_write callbacks take const void *

This patch updates the reg_write callbacks in the nvmem subsystem to take a
const void pointer instead of a mutable void pointer for the value buffer.

>     nvmem: make all reg_write callbacks take const void *
>     
>     The previous commit switched from a pointer to mutable data to a pointer
>     to immutable data, so let’s fix all users of this API.

[Severity: Low]
Are there users of this API outside of the drivers/nvmem/ directory that were
missed during this migration?

For example, when building drivers like drivers/rtc/rtc-cmos.c or
drivers/misc/eeprom/at24.c, will assigning their unupdated callbacks to
nvmem_config.reg_write trigger incompatible-pointer-types build errors?

> diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c
> index a872c640b8c5a..bacdcb5610bae 100644
> --- a/drivers/nvmem/qfprom.c
> +++ b/drivers/nvmem/qfprom.c
[ ... ]
> @@ -253,13 +253,13 @@ static int qfprom_enable_fuse_blowing(const struct qfprom_priv *priv,
>   *
>   * Return: 0 or -err.
>   */
> -static int qfprom_reg_write(void *context, unsigned int reg, void *_val,
> +static int qfprom_reg_write(void *context, unsigned int reg, void void *_val,
>  			    size_t bytes)
>  {

[Severity: Low]
Does this cause a compilation failure?

The double void void declaration appears to be a syntax error that will break
the build when the Qualcomm QFPROM driver is enabled.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715175229.24672-1-linkmauve@linkmauve.fr?part=2

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 7/8] mfd: twl-core: make reg_write callback take const void *
  2026-07-15 17:52 ` [PATCH 7/8] mfd: twl-core: " Link Mauve
@ 2026-07-15 18:08   ` sashiko-bot
  0 siblings, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-07-15 18:08 UTC (permalink / raw)
  To: Link Mauve
  Cc: Alexandre Belloni, ojeda, neil.armstrong, linux-rtc, imx, mfd,
	Frank.Li, lee, linux-sunxi, linux-amlogic

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Low] The commit message description is not capitalized, violating MFD subsystem guidelines.

Pre-existing issues:
- [High] Probe failure during MFD device registration skips manual resource cleanup, causing resource leaks.
--

--- Patch [7]: [PATCH 7/8] mfd: twl-core: make reg_write callback take const void * ---
commit 5525fd3bfa73424e942892bd1e1fb2d2e9554159
Author: Link Mauve <linkmauve@linkmauve.fr>

mfd: twl-core: make reg_write callback take const void *

This commit updates the reg_write callback to use a const void pointer for
its data argument. It fixes all users of the nvmem_config API to accommodate
this change.

> mfd: twl-core: make reg_write callback take const void *

[Severity: Low]
This isn't a bug, but should the description after the subsystem prefix be
capitalized (i.e., "Make reg_write...") to match the MFD subsystem guidelines?

[Severity: High]
This is a pre-existing issue, but I noticed a potential resource leak in
twl_probe(). If devm_mfd_add_devices() fails, the code jumps directly to
the 'free' label, skipping the 'fail' label:

drivers/mfd/twl-core.c:twl_probe() {
    ...
		status = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_NONE,
					      cells, num_cells, NULL, 0, NULL);
		if (status < 0)
			goto free;
    ...
fail:
	if (status < 0)
		twl_remove(client);
free:
	if (status < 0)
		platform_device_unregister(pdev);
    ...
}

Does this bypass leak manually requested IRQ domains and unmanaged dummy I2C
devices by skipping twl_remove()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260715175229.24672-1-linkmauve@linkmauve.fr?part=7

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/8] nvmem: core: make reg_write() take a const void *
  2026-07-15 17:52 ` [PATCH 1/8] nvmem: core: " Link Mauve
  2026-07-15 18:00   ` sashiko-bot
@ 2026-07-15 18:58   ` Andy Shevchenko
  2026-07-15 19:03     ` Link Mauve
  1 sibling, 1 reply; 20+ messages in thread
From: Andy Shevchenko @ 2026-07-15 18:58 UTC (permalink / raw)
  To: Link Mauve
  Cc: Srinivas Kandagatla, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Jonathan Cameron, David Lechner,
	Nuno Sá, Andy Shevchenko, Sakari Ailus, Tianshu Qiu,
	Bingbu Cao, Mauro Carvalho Chehab, Aaro Koskinen, Andreas Kemnade,
	Roger Quadros, Tony Lindgren, Lee Jones, Arnd Bergmann,
	Greg Kroah-Hartman, Bartosz Golaszewski, Vaibhaav Ram T.L,
	Kumaravel Thiagarajan, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Vladimir Zapolskiy,
	André Draszik, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Praveen Teja Kundanala,
	Kalyani Akula, Michal Simek, Alexandre Belloni, Joshua Kinard,
	Antoniu Miclaus, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan, Daniel Lezcano, Johan Hovold,
	Ronald Claveau, Salah Triki, Yury Norov, David Carlier,
	Achim Gratz, Alexander Sverdlin, Patrick Wicki, Markus Heidelberg,
	Markus Perkins, Uwe Kleine-König (The Capable Hub),
	Bjorn Helgaas, Abd-Alrhman Masalkhi, Chen Ni, Kees Cook,
	linux-arm-kernel, linux-amlogic, linux-kernel, linux-iio,
	linux-media, linux-omap, mfd, linux-i2c, linux-gpio, imx,
	linux-arm-msm, linux-stm32, linux-rtc, linux-sunxi,
	rust-for-linux

On Wed, Jul 15, 2026 at 07:52:17PM +0200, Link Mauve wrote:
> This callback used to take a mutable void * for no reason, this was
> found while drafting the Rust abstraction.

I don't understand how it was compiled. const void * != void * in C and can't
be implicitly covered, if I am not mistaken. So, this patch heavily should
break the build. What did I miss?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 0/8] nvmem: make reg_write() take a const void *
  2026-07-15 17:52 [PATCH 0/8] nvmem: make reg_write() take a const void * Link Mauve
                   ` (7 preceding siblings ...)
  2026-07-15 17:52 ` [PATCH 8/8] media: ov2740: remove NULL reg_write callback Link Mauve
@ 2026-07-15 19:02 ` Andy Shevchenko
  8 siblings, 0 replies; 20+ messages in thread
From: Andy Shevchenko @ 2026-07-15 19:02 UTC (permalink / raw)
  To: Link Mauve
  Cc: Srinivas Kandagatla, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Jonathan Cameron, David Lechner,
	Nuno Sá, Andy Shevchenko, Sakari Ailus, Tianshu Qiu,
	Bingbu Cao, Mauro Carvalho Chehab, Aaro Koskinen, Andreas Kemnade,
	Roger Quadros, Tony Lindgren, Lee Jones, Arnd Bergmann,
	Greg Kroah-Hartman, Bartosz Golaszewski, Vaibhaav Ram T.L,
	Kumaravel Thiagarajan, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Vladimir Zapolskiy,
	André Draszik, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Praveen Teja Kundanala,
	Kalyani Akula, Michal Simek, Alexandre Belloni, Joshua Kinard,
	Antoniu Miclaus, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan, Daniel Lezcano, Johan Hovold,
	Ronald Claveau, Salah Triki, Yury Norov, David Carlier,
	Achim Gratz, Alexander Sverdlin, Patrick Wicki, Markus Heidelberg,
	Markus Perkins, Uwe Kleine-König (The Capable Hub),
	Bjorn Helgaas, Abd-Alrhman Masalkhi, Chen Ni, Kees Cook,
	linux-arm-kernel, linux-amlogic, linux-kernel, linux-iio,
	linux-media, linux-omap, mfd, linux-i2c, linux-gpio, imx,
	linux-arm-msm, linux-stm32, linux-rtc, linux-sunxi,
	rust-for-linux

On Wed, Jul 15, 2026 at 07:52:16PM +0200, Link Mauve wrote:
> This callback used to take a mutable void * for no reason, which causes
> the compiler to be unaware that the val buffer should never be modified
> by the callback.
> 
> This was found while drafting the nvmem-provider Rust abstraction.
> 
> I’ve split this series based on the subsystem each patch affects, but I
> think it should go through the nvmem tree in one go after gathering the
> acks from the other subsystem maintainers.

It's an option. The other option (and often we go this way) is to introduce
a new name, convert users, convert the name back.

See, for example, how GPIO subsystem changed a proto of .set() callback.

> I’ve been told previously to not include too many maintainers in Cc, but
> I don’t know which ones to remove from the get_maintainers.pl output, so
> I’ve still included everyone, sorry about that.

With this, rather standard, way you will fulfill the above requirement
automatically. Also you won't need treewide change to bother everybody
with this. And also increase the chances to go in (maybe in a few releases
span).

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/8] nvmem: core: make reg_write() take a const void *
  2026-07-15 18:58   ` Andy Shevchenko
@ 2026-07-15 19:03     ` Link Mauve
  0 siblings, 0 replies; 20+ messages in thread
From: Link Mauve @ 2026-07-15 19:03 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Link Mauve, Srinivas Kandagatla, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Jonathan Cameron,
	David Lechner, Nuno Sá, Andy Shevchenko, Sakari Ailus,
	Tianshu Qiu, Bingbu Cao, Mauro Carvalho Chehab, Aaro Koskinen,
	Andreas Kemnade, Roger Quadros, Tony Lindgren, Lee Jones,
	Arnd Bergmann, Greg Kroah-Hartman, Bartosz Golaszewski,
	Vaibhaav Ram T.L, Kumaravel Thiagarajan, Frank Li, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Vladimir Zapolskiy,
	André Draszik, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Maxime Coquelin, Alexandre Torgue, Praveen Teja Kundanala,
	Kalyani Akula, Michal Simek, Alexandre Belloni, Joshua Kinard,
	Antoniu Miclaus, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
	Alexandre Courbot, Onur Özkan, Daniel Lezcano, Johan Hovold,
	Ronald Claveau, Salah Triki, Yury Norov, David Carlier,
	Achim Gratz, Alexander Sverdlin, Patrick Wicki, Markus Heidelberg,
	Markus Perkins, Uwe Kleine-König (The Capable Hub),
	Bjorn Helgaas, Abd-Alrhman Masalkhi, Chen Ni, Kees Cook,
	linux-arm-kernel, linux-amlogic, linux-kernel, linux-iio,
	linux-media, linux-omap, mfd, linux-i2c, linux-gpio, imx,
	linux-arm-msm, linux-stm32, linux-rtc, linux-sunxi,
	rust-for-linux

On Wed, Jul 15, 2026 at 09:58:08PM +0300, Andy Shevchenko wrote:
> On Wed, Jul 15, 2026 at 07:52:17PM +0200, Link Mauve wrote:
> > This callback used to take a mutable void * for no reason, this was
> > found while drafting the Rust abstraction.
> 
> I don't understand how it was compiled. const void * != void * in C and can't
> be implicitly covered, if I am not mistaken. So, this patch heavily should
> break the build. What did I miss?

I think I missed a lot of those drivers while compiling, probably
because I built it for my target hardware instead of doing a
COMPILE_TEST.

> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

-- 
Link Mauve

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-07-15 19:03 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15 17:52 [PATCH 0/8] nvmem: make reg_write() take a const void * Link Mauve
2026-07-15 17:52 ` [PATCH 1/8] nvmem: core: " Link Mauve
2026-07-15 18:00   ` sashiko-bot
2026-07-15 18:58   ` Andy Shevchenko
2026-07-15 19:03     ` Link Mauve
2026-07-15 17:52 ` [PATCH 2/8] nvmem: make all reg_write callbacks take " Link Mauve
2026-07-15 18:08   ` sashiko-bot
2026-07-15 17:52 ` [PATCH 3/8] rtc: " Link Mauve
2026-07-15 18:01   ` sashiko-bot
2026-07-15 17:52 ` [PATCH 4/8] misc: " Link Mauve
2026-07-15 18:04   ` sashiko-bot
2026-07-15 17:52 ` [PATCH 5/8] iio: pressure: bmp280: make reg_write callback " Link Mauve
2026-07-15 18:03   ` sashiko-bot
2026-07-15 17:52 ` [PATCH 6/8] firmware: meson_sm: " Link Mauve
2026-07-15 18:06   ` sashiko-bot
2026-07-15 17:52 ` [PATCH 7/8] mfd: twl-core: " Link Mauve
2026-07-15 18:08   ` sashiko-bot
2026-07-15 17:52 ` [PATCH 8/8] media: ov2740: remove NULL reg_write callback Link Mauve
2026-07-15 18:07   ` sashiko-bot
2026-07-15 19:02 ` [PATCH 0/8] nvmem: make reg_write() take a const void * Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox