Re: [RFC PATCH 02/27] iio: chemical: scd30: Switch to sparse friendly claim/release_direct()

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

 



On 1/5/25 11:25 AM, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> 
> This driver caused a false positive with __cond_lock() style solution
> but is fine with the simple boolean return approach now used.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> ---
>  drivers/iio/chemical/scd30_core.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c
> index d613c54cb28d..cfbf2f5e9443 100644
> --- a/drivers/iio/chemical/scd30_core.c
> +++ b/drivers/iio/chemical/scd30_core.c
> @@ -211,18 +211,19 @@ static int scd30_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const
>  			break;
>  		}
>  
> -		ret = iio_device_claim_direct_mode(indio_dev);
> -		if (ret)
> +		if (!iio_device_claim_direct(indio_dev)) {
> +			ret = -EBUSY;
>  			break;
> +		}
>  
>  		ret = scd30_read(state);
>  		if (ret) {
> -			iio_device_release_direct_mode(indio_dev);
> +			iio_device_release_direct(indio_dev);
>  			break;
>  		}
>  
>  		*val = state->meas[chan->address];
> -		iio_device_release_direct_mode(indio_dev);
> +		iio_device_release_direct(indio_dev);
>  		ret = IIO_VAL_INT;
>  		break;
>  	case IIO_CHAN_INFO_SCALE:

Could do with a precursor patch to use guard(mutex) to allow returning directly
everywhere and avoid break;.




[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