summaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends/tda10071.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2012-12-17 02:37:11 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-12-21 20:36:54 +0400
commit41f55d57552b7d2236f94fccb5cdd07dbf2e8557 (patch)
tree20dcabeb29e427d87a1446dbf9d940d9a13ddec6 /drivers/media/dvb-frontends/tda10071.c
parentbb9e31f3928dd9b1ecb66689890d1f5f3d19227c (diff)
downloadlinux-41f55d57552b7d2236f94fccb5cdd07dbf2e8557.tar.xz
[media] tda10071: make sure both tuner and demod i2c addresses are specified
display an error message if either tuner_i2c_addr or demod_i2c_addr are not specified in the tda10071_config structure Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb-frontends/tda10071.c')
-rw-r--r--drivers/media/dvb-frontends/tda10071.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/media/dvb-frontends/tda10071.c b/drivers/media/dvb-frontends/tda10071.c
index 710362916f83..02f9234a5400 100644
--- a/drivers/media/dvb-frontends/tda10071.c
+++ b/drivers/media/dvb-frontends/tda10071.c
@@ -30,7 +30,7 @@ static int tda10071_wr_regs(struct tda10071_priv *priv, u8 reg, u8 *val,
u8 buf[len+1];
struct i2c_msg msg[1] = {
{
- .addr = priv->cfg.i2c_address,
+ .addr = priv->cfg.demod_i2c_addr,
.flags = 0,
.len = sizeof(buf),
.buf = buf,
@@ -59,12 +59,12 @@ static int tda10071_rd_regs(struct tda10071_priv *priv, u8 reg, u8 *val,
u8 buf[len];
struct i2c_msg msg[2] = {
{
- .addr = priv->cfg.i2c_address,
+ .addr = priv->cfg.demod_i2c_addr,
.flags = 0,
.len = 1,
.buf = &reg,
}, {
- .addr = priv->cfg.i2c_address,
+ .addr = priv->cfg.demod_i2c_addr,
.flags = I2C_M_RD,
.len = sizeof(buf),
.buf = buf,
@@ -1202,6 +1202,18 @@ struct dvb_frontend *tda10071_attach(const struct tda10071_config *config,
goto error;
}
+ /* make sure demod i2c address is specified */
+ if (!config->demod_i2c_addr) {
+ dev_dbg(&i2c->dev, "%s: invalid demod i2c address!\n", __func__);
+ goto error;
+ }
+
+ /* make sure tuner i2c address is specified */
+ if (!config->tuner_i2c_addr) {
+ dev_dbg(&i2c->dev, "%s: invalid tuner i2c address!\n", __func__);
+ goto error;
+ }
+
/* setup the priv */
priv->i2c = i2c;
memcpy(&priv->cfg, config, sizeof(struct tda10071_config));