Re: [PATCH v1 13/16] iio: pressure: ms5611: Use get_unaligned_be24()

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

 



On Tue, Apr 21, 2020 at 03:31:32AM +0300, Andy Shevchenko wrote:
> This makes the driver code slightly easier to read.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  drivers/iio/pressure/ms5611_i2c.c | 2 +-
>  drivers/iio/pressure/ms5611_spi.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/pressure/ms5611_i2c.c b/drivers/iio/pressure/ms5611_i2c.c
> index 8089c59adce5..ced83162ae94 100644
> --- a/drivers/iio/pressure/ms5611_i2c.c
> +++ b/drivers/iio/pressure/ms5611_i2c.c
> @@ -50,7 +50,7 @@ static int ms5611_i2c_read_adc(struct ms5611_state *st, s32 *val)
>  	if (ret < 0)
>  		return ret;
>
> -	*val = (buf[0] << 16) | (buf[1] << 8) | buf[2];
> +	*val = get_unaligned_be24(&buf[0]);
>
>  	return 0;
>  }
> diff --git a/drivers/iio/pressure/ms5611_spi.c b/drivers/iio/pressure/ms5611_spi.c
> index b463eaa799ab..517295616869 100644
> --- a/drivers/iio/pressure/ms5611_spi.c
> +++ b/drivers/iio/pressure/ms5611_spi.c
> @@ -45,7 +45,7 @@ static int ms5611_spi_read_adc(struct device *dev, s32 *val)
>  	if (ret < 0)
>  		return ret;
>
> -	*val = (buf[0] << 16) | (buf[1] << 8) | buf[2];
> +	*val = get_unaligned_be24(&buf[0]);
>
>  	return 0;
>  }

Looks good.
Acked-by: Tomasz Duszynski <tduszyns@xxxxxxxxx>

> --
> 2.26.1
>



[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