mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
media: i2c: imx290: Make use of get_unaligned_le24(), put_unaligned_le24()
Since we have a proper endianness converters for LE 24-bit data use them. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
a1299df671
commit
44cedb7bed
1 changed files with 7 additions and 2 deletions
|
@ -16,6 +16,9 @@
|
|||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include <media/media-entity.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-device.h>
|
||||
|
@ -466,18 +469,20 @@ static int __always_unused imx290_read(struct imx290 *imx290, u32 addr, u32 *val
|
|||
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) {
|
||||
|
|
Loading…
Reference in a new issue