Re: [PATCH 20/29] iio: adc: ad_sigma_delta: Switch to sparse friendly iio_device_claim/release_direct()

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

 



On Mon, 2025-02-17 at 14:16 +0000, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> 
> These new functions allow sparse to find failures to release
> direct mode reducing chances of bugs over the claim_direct_mode()
> functions that are deprecated.
> 
> This is a complex function with a lot more than the release of direct
> mode to unwind on error. As such no attempt made to factor out
> the inner code.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> Cc: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxx>
> ---

Reviewed-by: Nuno Sá <nuno.sa@xxxxxxxxxx>

>  drivers/iio/adc/ad_sigma_delta.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad_sigma_delta.c
> b/drivers/iio/adc/ad_sigma_delta.c
> index 10e635fc4fa4..5907c35b98e5 100644
> --- a/drivers/iio/adc/ad_sigma_delta.c
> +++ b/drivers/iio/adc/ad_sigma_delta.c
> @@ -386,9 +386,8 @@ int ad_sigma_delta_single_conversion(struct iio_dev
> *indio_dev,
>  	unsigned int data_reg;
>  	int ret = 0;
>  
> -	ret = iio_device_claim_direct_mode(indio_dev);
> -	if (ret)
> -		return ret;
> +	if (!iio_device_claim_direct(indio_dev))
> +		return -EBUSY;
>  
>  	ad_sigma_delta_set_channel(sigma_delta, chan->address);
>  
> @@ -431,7 +430,7 @@ int ad_sigma_delta_single_conversion(struct iio_dev
> *indio_dev,
>  	sigma_delta->keep_cs_asserted = false;
>  	sigma_delta->bus_locked = false;
>  	spi_bus_unlock(sigma_delta->spi->controller);
> -	iio_device_release_direct_mode(indio_dev);
> +	iio_device_release_direct(indio_dev);
>  
>  	if (ret)
>  		return ret;






[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