mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: "Gary Guo" <gary@garyguo.net>
To: "Link Mauve" <linkmauve@linkmauve.fr>,
	"Srinivas Kandagatla" <srini@kernel.org>
Cc: "Andy Shevchenko" <andriy.shevchenko@intel.com>,
	"Neil Armstrong" <neil.armstrong@linaro.org>,
	"Kevin Hilman" <khilman@baylibre.com>,
	"Jerome Brunet" <jbrunet@baylibre.com>,
	"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
	"Sven Peter" <sven@kernel.org>, "Janne Grunau" <j@jannau.net>,
	"Neal Gompa" <neal@gompa.dev>, "Frank Li" <Frank.Li@nxp.com>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Vladimir Zapolskiy" <vz@mleia.com>,
	"André Draszik" <andre.draszik@linaro.org>,
	"Orson Zhai" <orsonzhai@gmail.com>,
	"Baolin Wang" <baolin.wang@linux.alibaba.com>,
	"Chunyan Zhang" <zhang.lyra@gmail.com>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
	"Kalyani Akula" <kalyani.akula@amd.com>,
	"Michal Simek" <michal.simek@amd.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>,
	"Johan Hovold" <johan@kernel.org>,
	"Ronald Claveau" <linux-kernel-dev@aliel.fr>,
	"Daniel Lezcano" <daniel.lezcano@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org,
	asahi@lists.linux.dev, imx@lists.linux.dev,
	linux-arm-msm@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v3 0/4] nvmem: fix a const-unsoundness in reg_write
Date: Thu, 16 Jul 2026 16:23:46 +0100	[thread overview]
Message-ID: <DK03KZBE5E3T.3VQJY9DIBYON7@garyguo.net> (raw)
In-Reply-To: <20260716142415.28718-1-linkmauve@linkmauve.fr>

On Thu Jul 16, 2026 at 3:24 PM BST, 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.
>
> Thanks to the guidance of Andy Shevchenko, this now introduces a new
> callback and deprecates the existing one, with the goal of renaming the
> new one into the old one once no user remains in the kernel.

I wouldn't call the series "const-unsoundness fix". There's nothing wrong (in
the sense of UB) in using "void *" for constant data as long as it is not
actually mutated. Yes, it's better to use "const void *", but just call it
"migrate to const void * in reg_write" or something similar.

Best,
Gary

>
> Changes since v2:
> - Link to v2:
>   https://lore.kernel.org/rust-for-linux/aljAqBNVXV1aVJqx@luna/T/
> - Rebase on top of linux-next/master.
> - Fix logic error which made all devices read-only.
> - Remove a blanket cast of function pointers to void * in
>   apple-spmi-nvmem (patch 3).
> - Also fix constness of write buffer in firmware: meson, which is used
>   exclusively by meson-efuse (patch 4).
> - Re-review all changes to make sure the passed types are more correct
>   than they were before.
> - Actually test with COMPILE_TEST, which I forgot to enable before…
>
> Changes since v1:
> - Link to v1:
>   https://lore.kernel.org/rust-for-linux/20260715175229.24672-1-linkmauve@linkmauve.fr/
> - Removed all changes to other subsystems than nvmem.
> - Added a new reg_write_const callback instead of changing the exisitng
>   reg_write.
> - Deprecated the existing reg_write callback, it will get removed once
>   all users in the kernel will be done migrating to the new one.
>
> Link Mauve (4):
>   nvmem: core: deprecate reg_write callback and add reg_write_const
>   nvmem: make all reg_write callbacks take const void *
>   nvmem: apple-spmi: improve calling safety with wrapper functions
>   firmware: meson: pass a const buffer to meson_sm_call_write()
>
>  drivers/firmware/meson/meson_sm.c       |  2 +-
>  drivers/nvmem/apple-spmi-nvmem.c        | 18 ++++++++++++++--
>  drivers/nvmem/bcm-ocotp.c               |  8 +++----
>  drivers/nvmem/core.c                    | 28 ++++++++++++++-----------
>  drivers/nvmem/imx-ocotp-scu.c           |  6 +++---
>  drivers/nvmem/imx-ocotp.c               |  6 +++---
>  drivers/nvmem/internals.h               |  1 +
>  drivers/nvmem/lan9662-otpc.c            |  6 +++---
>  drivers/nvmem/lpc18xx_eeprom.c          |  6 +++---
>  drivers/nvmem/max77759-nvmem.c          |  4 ++--
>  drivers/nvmem/meson-efuse.c             |  8 +++----
>  drivers/nvmem/qcom-spmi-sdam.c          |  6 +++---
>  drivers/nvmem/qfprom.c                  |  6 +++---
>  drivers/nvmem/rave-sp-eeprom.c          |  6 +++---
>  drivers/nvmem/snvs_lpgpr.c              |  4 ++--
>  drivers/nvmem/sprd-efuse.c              |  6 +++---
>  drivers/nvmem/stm32-bsec-optee-ta.c     |  2 +-
>  drivers/nvmem/stm32-bsec-optee-ta.h     |  4 ++--
>  drivers/nvmem/stm32-romem.c             | 10 ++++-----
>  drivers/nvmem/zynqmp_nvmem.c            |  6 +++---
>  include/linux/firmware/meson/meson_sm.h |  2 +-
>  include/linux/nvmem-provider.h          |  6 +++++-
>  22 files changed, 87 insertions(+), 64 deletions(-)
>
>
> base-commit: b8809969e1d7a591e0f49dd464a5d04b3cf02ab1



_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  parent reply	other threads:[~2026-07-16 15:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 14:24 Link Mauve
2026-07-16 14:24 ` [PATCH v3 1/4] nvmem: core: deprecate reg_write callback and add reg_write_const Link Mauve
2026-07-16 14:24 ` [PATCH v3 2/4] nvmem: make all reg_write callbacks take const void * Link Mauve
2026-07-16 14:37   ` sashiko-bot
2026-07-16 14:24 ` [PATCH v3 3/4] nvmem: apple-spmi: improve calling safety with wrapper functions Link Mauve
2026-07-16 18:07   ` Andy Shevchenko
2026-07-16 14:24 ` [PATCH v3 4/4] firmware: meson: pass a const buffer to meson_sm_call_write() Link Mauve
2026-07-16 14:36   ` sashiko-bot
2026-07-16 15:23 ` Gary Guo [this message]
2026-07-16 18:09 ` [PATCH v3 0/4] nvmem: fix a const-unsoundness in reg_write Andy Shevchenko

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=DK03KZBE5E3T.3VQJY9DIBYON7@garyguo.net \
    --to=gary@garyguo.net \
    --cc=Frank.Li@nxp.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=aliceryhl@google.com \
    --cc=andre.draszik@linaro.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=asahi@lists.linux.dev \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=daniel.lezcano@kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=j@jannau.net \
    --cc=jbrunet@baylibre.com \
    --cc=johan@kernel.org \
    --cc=kalyani.akula@amd.com \
    --cc=kernel@pengutronix.de \
    --cc=khilman@baylibre.com \
    --cc=linkmauve@linkmauve.fr \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel-dev@aliel.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=lossin@kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=michal.simek@amd.com \
    --cc=neal@gompa.dev \
    --cc=neil.armstrong@linaro.org \
    --cc=ojeda@kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=srini@kernel.org \
    --cc=sven@kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=vz@mleia.com \
    --cc=work@onurozkan.dev \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

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

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

Powered by JetHome