diff options
author | Sakari Ailus <sakari.ailus@iki.fi> | 2014-12-13 23:53:37 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-09-05 21:39:11 +0300 |
commit | 073fe63513edfc7f072fa35c6fd23c919d1b8a03 (patch) | |
tree | fe65dfb3d5279e204e0e8287f288fec99b3b78c4 /drivers/media/i2c/smiapp/smiapp-regs.c | |
parent | 3c59bb4750659bf893e12fd9728a1ebbda930018 (diff) | |
download | linux-073fe63513edfc7f072fa35c6fd23c919d1b8a03.tar.xz |
[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: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/i2c/smiapp/smiapp-regs.c')
-rw-r--r-- | drivers/media/i2c/smiapp/smiapp-regs.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/media/i2c/smiapp/smiapp-regs.c b/drivers/media/i2c/smiapp/smiapp-regs.c index 6b6c20b61397..1e501c06d18c 100644 --- a/drivers/media/i2c/smiapp/smiapp-regs.c +++ b/drivers/media/i2c/smiapp/smiapp-regs.c @@ -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, ®, 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) |