From e6a7be26a288f293847b92fe6333bb981eb74ba3 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 10 Feb 2023 00:12:05 +0200 Subject: [PATCH] media: i2c: imx290: Make use of get_unaligned_le24(), put_unaligned_le24() Should be upstream commit 5d129c4539c3 Since we have a proper endianness converters for LE 24-bit data use them. Signed-off-by: Andy Shevchenko Reviewed-by: Laurent Pinchart Signed-off-by: Sakari Ailus --- drivers/media/i2c/imx290.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/media/i2c/imx290.c +++ b/drivers/media/i2c/imx290.c @@ -16,6 +16,9 @@ #include #include #include + +#include + #include #include #include @@ -466,18 +469,20 @@ static int __always_unused imx290_read(s return ret; } - *value = (data[2] << 16) | (data[1] << 8) | data[0]; + *value = get_unaligned_le24(data); return 0; } static int imx290_write(struct imx290 *imx290, u32 addr, u32 value, int *err) { - u8 data[3] = { value & 0xff, (value >> 8) & 0xff, value >> 16 }; + u8 data[3]; int ret; if (err && *err) return *err; + put_unaligned_le24(value, data); + ret = regmap_raw_write(imx290->regmap, addr & IMX290_REG_ADDR_MASK, data, (addr >> IMX290_REG_SIZE_SHIFT) & 3); if (ret < 0) {