Re: [PATCH v5 6/9] rtc: abx80x: use regmap instead of I2C specific API

[email protected]
Newsgroups org.kernel.vger.linux-rtc,org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Passing an `int *` to `regmap_read()` triggers a `-Wpointer-sign` compiler warning.
--

--- Patch [6]: [PATCH v5 6/9] rtc: abx80x: use regmap instead of I2C specific API ---
commit 451b30314b8903deb9d330c3f8568f14d2e08147
Author: Antoni Pokusinski <[email protected]>

rtc: abx80x: use regmap instead of I2C specific API

This commit reworks the ABX80X RTC driver to use the regmap API for
device communication instead of I2C-specific functions. This prepares
the driver to support SPI-based ABX81X devices in the future.

> diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
> index 12a4dbfec6396..5d41882f3c704 100644
> --- a/drivers/rtc/rtc-abx80x.c
> +++ b/drivers/rtc/rtc-abx80x.c

[ ... ]

> @@ -227,8 +230,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]
Does passing an int pointer to regmap_read() here cause a -Wpointer-sign
compiler warning? 

regmap_read() expects an unsigned int pointer for its val parameter, but
flags is declared as an int at the top of abx80x_rtc_set_time(). This might
break the build if CONFIG_WERROR is enabled.

> +	if (err < 0)
> +		return err;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.