Re: [PATCH v3 5/8] rtc: abx80x: use regmap instead of I2C specific API

Antoni Pokusinski <[email protected]> Mon, 3 Aug 2026 22:53:41 +0200
Newsgroups org.kernel.vger.linux-devicetree,dev.linux.lists.sashiko-reviews,org.kernel.vger.linux-rtc
Message-ID <anD_b4RX2Lz0kHs7@antoniarch>
On Fri, Jul 31, 2026 at 07:05:58PM +0000, [email protected] wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] Variables declared as `int` are passed by reference to `regmap_read`, which expects an `unsigned int *`.
> --
> 
> --- Patch [5]: [PATCH v3 5/8] rtc: abx80x: use regmap instead of I2C specific API ---
> commit 5bae78c37282c7d7693255ad432126ac7e8c51f8
> Author: Antoni Pokusinski <[email protected]>
> 
> rtc: abx80x: use regmap instead of I2C specific API
> 
> This commit reworks the abx80x RTC driver to use regmap API instead of 
> i2c_smbus functions. This prepares the driver for future ABX81X SPI support.
> 
> > diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
> > index 4ac3ace687a1e..23823fc2f5458 100644
> > --- a/drivers/rtc/rtc-abx80x.c
> > +++ b/drivers/rtc/rtc-abx80x.c
> 
> [ ... ]
> 
> > @@ -221,8 +224,7 @@ static int abx80x_rtc_read_time(struct device *dev, struct rtc_time *tm)
> >  
> >  static int abx80x_rtc_set_time(struct device *dev, struct rtc_time *tm)
> >  {
> > -	struct i2c_client *client = to_i2c_client(dev);
> > -	struct abx80x_priv *priv = i2c_get_clientdata(client);
> > +	struct abx80x_priv *priv = dev_get_drvdata(dev);
> >  	unsigned char buf[8];
> >  	int err, flags;
> >  
> 
> [ ... ]
> 
> >  	/* Clear the OF bit of Oscillator Status Register */
> > -	flags = i2c_smbus_read_byte_data(client, ABX8XX_REG_OSS);
> > -	if (flags < 0)
> > -		return flags;
> > +	err = regmap_read(priv->regmap, ABX8XX_REG_OSS, &flags);
> 
> [Severity: Low]
> Will this cause a compiler error on GCC 14+ due to incompatible pointer types?
> 
> The regmap_read() function expects an "unsigned int *" for its third argument,
> but "flags" is declared as an "int" here.
> 
> It looks like this same issue with passing an "int *" to regmap_read() also
> happens with the "flags" variable in abx80x_rtc_set_autocalibration() and
> oscillator_store(), as well as with the "data" variable in abx80x_probe().
>
I compiled this with arm-linux-gnueabihf-gcc (GCC) 15.2.1 and did not
experience any issues. But it's no big deal to have make the `flags`
variable an uint, will change that in v4
> [ ... ]
> 
> -- 
> Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=5