diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/tuners/qt1010.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/media/tuners/qt1010.c b/drivers/media/tuners/qt1010.c index e48faf942830..3853a3d43d4f 100644 --- a/drivers/media/tuners/qt1010.c +++ b/drivers/media/tuners/qt1010.c @@ -222,23 +222,24 @@ static int qt1010_init_meas1(struct qt1010_priv *priv, { QT1010_WR, reg, reg_init_val }, { QT1010_WR, 0x1e, 0x00 }, { QT1010_WR, 0x1e, oper }, - { QT1010_RD, reg, 0xff } }; for (i = 0; i < ARRAY_SIZE(i2c_data); i++) { - if (i2c_data[i].oper == QT1010_WR) { - err = qt1010_writereg(priv, i2c_data[i].reg, - i2c_data[i].val); - } else { - err = qt1010_readreg(priv, i2c_data[i].reg, &val2); - } - if (err) return err; + err = qt1010_writereg(priv, i2c_data[i].reg, + i2c_data[i].val); + if (err) + return err; } + err = qt1010_readreg(priv, reg, &val2); + if (err) + return err; do { val1 = val2; err = qt1010_readreg(priv, reg, &val2); - if (err) return err; + if (err) + return err; + dev_dbg(&priv->i2c->dev, "%s: compare reg:%02x %02x %02x\n", __func__, reg, val1, val2); } while (val1 != val2); @@ -250,7 +251,7 @@ static int qt1010_init_meas1(struct qt1010_priv *priv, static int qt1010_init_meas2(struct qt1010_priv *priv, u8 reg_init_val, u8 *retval) { - u8 i, val; + u8 i, val = 0xff; int err; qt1010_i2c_oper_t i2c_data[] = { { QT1010_WR, 0x07, reg_init_val }, @@ -261,6 +262,7 @@ static int qt1010_init_meas2(struct qt1010_priv *priv, { QT1010_WR, 0x1e, 0x00 }, { QT1010_WR, 0x22, 0xff } }; + for (i = 0; i < ARRAY_SIZE(i2c_data); i++) { if (i2c_data[i].oper == QT1010_WR) { err = qt1010_writereg(priv, i2c_data[i].reg, @@ -268,7 +270,8 @@ static int qt1010_init_meas2(struct qt1010_priv *priv, } else { err = qt1010_readreg(priv, i2c_data[i].reg, &val); } - if (err) return err; + if (err) + return err; } *retval = val; return 0; |