Re: [PATCH v1 03/16] iio: adc: ti-ads124s08: Use get_unaligned_be24()

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

 



On Tue, 21 Apr 2020 03:31:22 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> This makes the driver code slightly easier to read.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Added
#include <asm/unaligned.h>
and applied.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/ti-ads124s08.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c
> index 552c2be8d87a..2516e42ad00d 100644
> --- a/drivers/iio/adc/ti-ads124s08.c
> +++ b/drivers/iio/adc/ti-ads124s08.c
> @@ -188,7 +188,6 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan)
>  {
>  	struct ads124s_private *priv = iio_priv(indio_dev);
>  	int ret;
> -	u32 tmp;
>  	struct spi_transfer t[] = {
>  		{
>  			.tx_buf = &priv->data[0],
> @@ -208,9 +207,7 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan)
>  	if (ret < 0)
>  		return ret;
>  
> -	tmp = priv->data[2] << 16 | priv->data[3] << 8 | priv->data[4];
> -
> -	return tmp;
> +	return get_unaligned_be24(&priv->data[2]);
>  }
>  
>  static int ads124s_read_raw(struct iio_dev *indio_dev,




[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