Re: [PATCH] iio: proximity: lidar: switch to iio_device_claim_*_mode helpers

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

 



On 08/06/16 05:18, Matt Ranostay wrote:
> Switch from using indio_dev->mlock to the iio_device_claim_*_mode
> helper functions.
> 
> Signed-off-by: Matt Ranostay <mranostay@xxxxxxxxx>
You beat Alison to it ;)

Applied to the togreg branch of iio.git

Thanks,

Jonathan
> ---
>  drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> index 4f502386..c0b0e82 100644
> --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> @@ -203,22 +203,19 @@ static int lidar_read_raw(struct iio_dev *indio_dev,
>  	struct lidar_data *data = iio_priv(indio_dev);
>  	int ret = -EINVAL;
>  
> -	mutex_lock(&indio_dev->mlock);
> -
> -	if (iio_buffer_enabled(indio_dev) && mask == IIO_CHAN_INFO_RAW) {
> -		ret = -EBUSY;
> -		goto error_busy;
> -	}
> -
>  	switch (mask) {
>  	case IIO_CHAN_INFO_RAW: {
>  		u16 reg;
>  
> +		if (iio_device_claim_direct_mode(indio_dev))
> +			return -EBUSY;
> +
>  		ret = lidar_get_measurement(data, &reg);
>  		if (!ret) {
>  			*val = reg;
>  			ret = IIO_VAL_INT;
>  		}
> +		iio_device_release_direct_mode(indio_dev);
>  		break;
>  	}
>  	case IIO_CHAN_INFO_SCALE:
> @@ -228,9 +225,6 @@ static int lidar_read_raw(struct iio_dev *indio_dev,
>  		break;
>  	}
>  
> -error_busy:
> -	mutex_unlock(&indio_dev->mlock);
> -
>  	return ret;
>  }
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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