diff mbox series

[v1,04/16] iio: dac: ltc2632: Use put_unaligned_be24()

Message ID 20200421003135.23060-4-andriy.shevchenko@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [v1,01/16] iio: adc: ad_sigma_delta: Use {get,put}_unaligned_be24() | expand

Commit Message

Andy Shevchenko April 21, 2020, 12:31 a.m. UTC
This makes the driver code slightly easier to read.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/dac/ltc2632.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Jonathan Cameron April 25, 2020, 4:26 p.m. UTC | #1
On Tue, 21 Apr 2020 03:31:23 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> This makes the driver code slightly easier to read.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied with same include fix.

Jonathan

> ---
>  drivers/iio/dac/ltc2632.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/dac/ltc2632.c b/drivers/iio/dac/ltc2632.c
> index 7adc91056aa1..5123776cb63e 100644
> --- a/drivers/iio/dac/ltc2632.c
> +++ b/drivers/iio/dac/ltc2632.c
> @@ -75,9 +75,7 @@ static int ltc2632_spi_write(struct spi_device *spi,
>  	 * 10-, 8-bit input code followed by 4, 6, or 8 don't care bits.
>  	 */
>  	data = (cmd << 20) | (addr << 16) | (val << shift);
> -	msg[0] = data >> 16;
> -	msg[1] = data >> 8;
> -	msg[2] = data;
> +	put_unaligned_be24(data, &msg[0]);
>  
>  	return spi_write(spi, msg, sizeof(msg));
>  }
diff mbox series

Patch

diff --git a/drivers/iio/dac/ltc2632.c b/drivers/iio/dac/ltc2632.c
index 7adc91056aa1..5123776cb63e 100644
--- a/drivers/iio/dac/ltc2632.c
+++ b/drivers/iio/dac/ltc2632.c
@@ -75,9 +75,7 @@  static int ltc2632_spi_write(struct spi_device *spi,
 	 * 10-, 8-bit input code followed by 4, 6, or 8 don't care bits.
 	 */
 	data = (cmd << 20) | (addr << 16) | (val << shift);
-	msg[0] = data >> 16;
-	msg[1] = data >> 8;
-	msg[2] = data;
+	put_unaligned_be24(data, &msg[0]);
 
 	return spi_write(spi, msg, sizeof(msg));
 }