Re: [PATCH 07/11] staging: iio: ad2s1200: Ensure udelay(1) in all necessary code paths

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

 



On Sun, 18 Mar 2018 14:36:15 +0100
David Veenstra <davidjulianveenstra@xxxxxxxxx> wrote:

> After a successful spi transaction, a udelay(1) is needed.
> This doesn't happen for the default case of the switch statement
> in ad2s1200_read_raw. This patch makes sure that it does.
> 
> Signed-off-by: David Veenstra <davidjulianveenstra@xxxxxxxxx>
Given this one can't actually happen as the chan->type
is always one of the two options, I can't see the point
in making sure we sleep.

The default is really just there to catch bugs and to suppress
the build warning we would otherwise get.

So I am unconvinced on this patch.

Jonathan
> ---
>  drivers/staging/iio/resolver/ad2s1200.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c
> index e0e7c88368ed..6ce9ca13094a 100644
> --- a/drivers/staging/iio/resolver/ad2s1200.c
> +++ b/drivers/staging/iio/resolver/ad2s1200.c
> @@ -78,20 +78,22 @@ static int ad2s1200_read_raw(struct iio_dev *indio_dev,
>  	switch (chan->type) {
>  	case IIO_ANGL:
>  		*val = vel >> 4;
> +		ret = IIO_VAL_INT;
>  		break;
>  	case IIO_ANGL_VEL:
>  		*val = sign_extend32((s16)vel >> 4, 11);
> +		ret = IIO_VAL_INT;
>  		break;
>  	default:
> -		mutex_unlock(&st->lock);
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		break;
>  	}
>  
>  	/* delay (2 * AD2S1200_TSCLK + 20) ns for sample pulse */
>  	udelay(1);
>  	mutex_unlock(&st->lock);
>  
> -	return IIO_VAL_INT;
> +	return ret;
>  }
>  
>  static const struct iio_chan_spec ad2s1200_channels[] = {

--
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