Re: [PATCH RESEND v3 08/17] iio: adc: ad7768-1: convert driver to use regmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 12 Feb 2025 15:17:16 -0300
Jonathan Santos <Jonathan.Santos@xxxxxxxxxx> wrote:

> Convert the AD7768-1 driver to use the regmap API for register
> access. This change simplifies and standardizes register interactions,
> reducing code duplication and improving maintainability.
> 
> Create two regmap configurations, one for 8-bit register values and
> other for 24-bit register values.
> 
> Since we are using regmap now, define the remaining registers from 0x32
> to 0x34.
> 
> Signed-off-by: Jonathan Santos <Jonathan.Santos@xxxxxxxxxx>
Looks good.  Just one passing suggestion that might reduce chance of
future bugs a tiny bit.  Any bug that uses the wrong regmap should show
up quickly in testing but none the less, maybe naming can help too.

Not an important comment though so don't respin the series just for this.

Jonathan


>  
>  static int ad7768_scan_direct(struct iio_dev *indio_dev)
> @@ -233,9 +269,10 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev)
>  	if (!ret)
>  		return -ETIMEDOUT;
>  
> -	readval = ad7768_spi_reg_read(st, AD7768_REG_ADC_DATA, 3);
> -	if (readval < 0)
> -		return readval;
> +	ret = regmap_read(st->regmap24, AD7768_REG_ADC_DATA, &readval);
I wonder if it is worth reducing the possibility of reading the register
via the wrong regmap by changing the defintion to
AD7768_REG24_ADC_DATA or something along those lines?

> +	if (ret)
> +		return ret;
> +





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux