Re: [PATCH v1 06/16] iio: dac: ad5446: Use put_unaligned_be24()

Jonathan Cameron
2020-04-25T16:31:26Z

On Tue, 21 Apr 2020 03:31:25 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> This makes the driver code slightly easier to read.
>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Cc: Michael Hennerich <Michael.Hennerich@analog.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

You've guessed it. Applied with missing header added.

Thanks, J
> ---
> drivers/iio/dac/ad5446.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c
> index 61c670f7fc5f..87ff863bdc10 100644
> --- a/drivers/iio/dac/ad5446.c
> +++ b/drivers/iio/dac/ad5446.c
> @@ -302,9 +302,7 @@ static int ad5660_write(struct ad5446_state *st, unsigned val)
> struct spi_device *spi = to_spi_device(st->dev);
> uint8_t data[3];
>
> - data[0] = (val >> 16) & 0xFF;
> - data[1] = (val >> 8) & 0xFF;
> - data[2] = val & 0xFF;
> + put_unaligned_be24(val, &data[0]);
>
> return spi_write(spi, data, sizeof(data));
> }