Skip to content

Commit

Permalink
[media] smiapp: Unify enforced and need-based 8-bit read
Browse files Browse the repository at this point in the history
Unify enforced 8-bit read access with that based on actual need.

Signed-off-by: Sakari Ailus <[email protected]>
Reviewed-by: Sebastian Reichel <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
Sakari Ailus authored and mchehab committed Sep 5, 2016
1 parent 3c59bb4 commit 073fe63
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions drivers/media/i2c/smiapp/smiapp-regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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)
Expand Down

0 comments on commit 073fe63

Please sign in to comment.