summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/frontends/s5h1420.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/dvb/frontends/s5h1420.c')
-rw-r--r--linux/drivers/media/dvb/frontends/s5h1420.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/linux/drivers/media/dvb/frontends/s5h1420.c b/linux/drivers/media/dvb/frontends/s5h1420.c
index 587718fa3..2d95c9d2a 100644
--- a/linux/drivers/media/dvb/frontends/s5h1420.c
+++ b/linux/drivers/media/dvb/frontends/s5h1420.c
@@ -51,7 +51,7 @@ static int debug = 0;
static int s5h1420_writereg (struct s5h1420_state* state, u8 reg, u8 data)
{
u8 buf [] = { reg, data };
- struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 3 };
+ struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 2 };
int err;
if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) {
@@ -67,13 +67,15 @@ static u8 s5h1420_readreg (struct s5h1420_state* state, u8 reg)
int ret;
u8 b0 [] = { reg };
u8 b1 [] = { 0 };
- struct i2c_msg msg [] = { { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 2 },
- { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } };
+ struct i2c_msg msg1 = { .addr = state->config->demod_address, .flags = 0, .buf = b0, .len = 1 };
+ struct i2c_msg msg2 = { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 };
- ret = i2c_transfer (state->i2c, msg, 2);
-
- if (ret != 2) return ret;
+ if ((ret = i2c_transfer (state->i2c, &msg1, 1)) != 1)
+ return ret;
+ if ((ret = i2c_transfer (state->i2c, &msg2, 1)) != 1)
+ return ret;
+
return b1[0];
}