All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Link Mauve" <linkmauve@linkmauve.fr>
Cc: linux-amlogic@lists.infradead.org, mfd@lists.linux.dev,
	Frank.Li@kernel.org, linux-rtc@vger.kernel.org,
	linux-sunxi@lists.linux.dev, lee@kernel.org, imx@lists.linux.dev,
	ojeda@kernel.org, neil.armstrong@linaro.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH 3/8] rtc: make all reg_write callbacks take const void *
Date: Wed, 15 Jul 2026 18:01:23 +0000	[thread overview]
Message-ID: <20260715180123.C22591F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260715175229.24672-4-linkmauve@linkmauve.fr>

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

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Link Mauve" <linkmauve@linkmauve.fr>
Cc: linux-amlogic@lists.infradead.org, mfd@lists.linux.dev,
	Frank.Li@kernel.org, linux-rtc@vger.kernel.org,
	linux-sunxi@lists.linux.dev, lee@kernel.org, imx@lists.linux.dev,
	ojeda@kernel.org, neil.armstrong@linaro.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH 3/8] rtc: make all reg_write callbacks take const void *
Date: Wed, 15 Jul 2026 18:01:23 +0000	[thread overview]
Message-ID: <20260715180123.C22591F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260715175229.24672-4-linkmauve@linkmauve.fr>

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

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

  reply	other threads:[~2026-07-15 18:01 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 17:52 ` [PATCH 1/8] nvmem: core: " Link Mauve
2026-07-15 17:52   ` Link Mauve
2026-07-15 18:00   ` sashiko-bot
2026-07-15 18:00     ` sashiko-bot
2026-07-15 18:58   ` Andy Shevchenko
2026-07-15 18:58     ` Andy Shevchenko
2026-07-15 19:03     ` Link Mauve
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 17:52   ` Link Mauve
2026-07-15 18:08   ` sashiko-bot
2026-07-15 18:08     ` sashiko-bot
2026-07-15 17:52 ` [PATCH 3/8] rtc: " Link Mauve
2026-07-15 17:52   ` Link Mauve
2026-07-15 18:01   ` sashiko-bot [this message]
2026-07-15 18:01     ` sashiko-bot
2026-07-15 17:52 ` [PATCH 4/8] misc: " Link Mauve
2026-07-15 17:52   ` Link Mauve
2026-07-15 18:04   ` sashiko-bot
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 17:52   ` Link Mauve
2026-07-15 18:03   ` sashiko-bot
2026-07-15 18:03     ` sashiko-bot
2026-07-15 17:52 ` [PATCH 6/8] firmware: meson_sm: " Link Mauve
2026-07-15 17:52   ` Link Mauve
2026-07-15 18:06   ` sashiko-bot
2026-07-15 18:06     ` sashiko-bot
2026-07-15 17:52 ` [PATCH 7/8] mfd: twl-core: " Link Mauve
2026-07-15 17:52   ` Link Mauve
2026-07-15 18:08   ` sashiko-bot
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 17:52   ` Link Mauve
2026-07-15 18:07   ` sashiko-bot
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
2026-07-15 19:02   ` Andy Shevchenko
2026-07-15 19:09   ` Link Mauve
2026-07-15 19:09     ` Link Mauve
2026-07-15 20:09   ` Yury Norov
2026-07-15 20:09     ` Yury Norov

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=20260715180123.C22591F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=imx@lists.linux.dev \
    --cc=lee@kernel.org \
    --cc=linkmauve@linkmauve.fr \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mfd@lists.linux.dev \
    --cc=neil.armstrong@linaro.org \
    --cc=ojeda@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.