Re: [PATCH v6 7/8] iio: adc: ad9467: convert to backend framework

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

 



On Fri, 19 Jan 2024 17:00:53 +0100
Nuno Sa via B4 Relay <devnull+nuno.sa.analog.com@xxxxxxxxxx> wrote:

> From: Nuno Sa <nuno.sa@xxxxxxxxxx>
> 
> Convert the driver to use the new IIO backend framework. The device
> functionality is expected to be the same (meaning no added or removed
> features).
> 
> Also note this patch effectively breaks ABI and that's needed so we can
> properly support this device and add needed features making use of the
> new IIO framework.

A statement here on why we think no one will notice or that, if anyone does,
they can be helped around the incompatibility by Analog tech support etc
would be good to have here.

I'm happy to accept that is this the case but such a statement in this patch
description would be good to avoid scaring people too much with the ABI breakage.

One trivial comment inline.

Jonathan


> 
> Signed-off-by: Nuno Sa <nuno.sa@xxxxxxxxxx>
> ---
>  drivers/iio/adc/Kconfig  |   2 +-
>  drivers/iio/adc/ad9467.c | 272 +++++++++++++++++++++++++++++++----------------
>  2 files changed, 181 insertions(+), 93 deletions(-)
> 
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index 10316e15c954..ff88e5b29f33 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -324,7 +324,7 @@ config AD799X
>  config AD9467
>  	tristate "Analog Devices AD9467 High Speed ADC driver"
>  	depends on SPI
> -	depends on ADI_AXI_ADC
> +	select IIO_BACKEND
>  	help
>  	  Say yes here to build support for Analog Devices:
>  	  * AD9467 16-Bit, 200 MSPS/250 MSPS Analog-to-Digital Converter
> diff --git a/drivers/iio/adc/ad9467.c b/drivers/iio/adc/ad9467.c
> index 6581fce4ba95..9e448c4c6b92 100644
> --- a/drivers/iio/adc/ad9467.c
> +++ b/drivers/iio/adc/ad9467.c
> @@ -17,13 +17,12 @@
>  #include <linux/of.h>
>  
>
> -static int ad9467_get_scale(struct adi_axi_adc_conv *conv, int *val, int *val2)
> +static int ad9467_get_scale(struct ad9467_state *st, int *val, int *val2)
>  {
> -	const struct adi_axi_adc_chip_info *info = conv->chip_info;
> -	const struct ad9467_chip_info *info1 = to_ad9467_chip_info(info);
> -	struct ad9467_state *st = adi_axi_adc_conv_priv(conv);
> +	const struct ad9467_chip_info *info = st->info;
>  	unsigned int i, vref_val;
>  	int ret;
>  
> @@ -282,25 +278,24 @@ static int ad9467_get_scale(struct adi_axi_adc_conv *conv, int *val, int *val2)
>  	if (ret < 0)
>  		return ret;
>  
> -	vref_val = ret & info1->vref_mask;
> +	vref_val = ret & info->vref_mask;
>  
> -	for (i = 0; i < info->num_scales; i++) {
> +	for (i = 0; i < st->info->num_scales; i++) {

Use local variable info for this as well, and the other one below.

>  		if (vref_val == info->scale_table[i][1])
>  			break;
>  	}
>  
> -	if (i == info->num_scales)
> +	if (i == st->info->num_scales)
>  		return -ERANGE;
>  
> -	__ad9467_get_scale(conv, i, val, val2);
> +	__ad9467_get_scale(st, i, val, val2);
>  
>  	return IIO_VAL_INT_PLUS_MICRO;
>  }






[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux