Commit 073fe635 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

[media] smiapp: Unify enforced and need-based 8-bit read

Unify enforced 8-bit read access with that based on actual need.
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: default avatarSebastian Reichel <sre@kernel.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 3c59bb47
......@@ -188,7 +188,8 @@ int smiapp_read_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 *val)
SMIAPP_QUIRK_FLAG_8BIT_READ_ONLY));
}
int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val)
static int smiapp_read_quirk(struct smiapp_sensor *sensor, u32 reg, u32 *val,
bool force8)
{
int rval;
......@@ -199,21 +200,20 @@ int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val)
if (rval < 0)
return rval;
if (force8)
return __smiapp_read(sensor, reg, val, true);
return smiapp_read_no_quirk(sensor, reg, val);
}
int smiapp_read_8only(struct smiapp_sensor *sensor, u32 reg, u32 *val)
int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val)
{
int rval;
*val = 0;
rval = smiapp_call_quirk(sensor, reg_access, false, &reg, val);
if (rval == -ENOIOCTLCMD)
return 0;
if (rval < 0)
return rval;
return smiapp_read_quirk(sensor, reg, val, false);
}
return __smiapp_read(sensor, reg, val, true);
int smiapp_read_8only(struct smiapp_sensor *sensor, u32 reg, u32 *val)
{
return smiapp_read_quirk(sensor, reg, val, true);
}
int smiapp_write_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 val)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment