tda10071: make sure both tuner and demod i2c addresses are specified
Subsystems (3)
PATCH 1/1 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
--- drivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)
drivers/media/dvb-frontends/tda10071.c +15 -3
@@ -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 = ®, }, { - .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 ));
drivers/media/dvb-frontends/tda10071.h +2 -2
@@ -28,10 +28,10 @@ struct tda10071_config {* Default: none, must set * Values: 0x55, */ -u8 i2c_address; +u8 demod_i2c_addr;/* Tuner I2C address. -* Default: 0x14 +* Default: none, must set * Values: 0x14, 0x54, ... */ u8 tuner_i2c_addr;
drivers/media/pci/cx23885/cx23885-dvb.c +1 -1
@@ -662,7 +662,7 @@ static struct mt2063_config terratec_mt2063_config[] = { };static const struct tda10071_config hauppauge_tda10071_config = { - .i2c_address =0x05 , + .demod_i2c_addr =0x05 , .tuner_i2c_addr =0x54 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL ,
drivers/media/usb/em28xx/em28xx-dvb.c +2 -1
@@ -714,7 +714,8 @@ static struct tda18271_config em28xx_cxd2820r_tda18271_config = { };static const struct tda10071_config em28xx_tda10071_config = { - .i2c_address =0x55 ,/* (0xaa >> 1) */ + .demod_i2c_addr =0x55 ,/* (0xaa >> 1) */ + .tuner_i2c_addr =0x14 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL , .spec_inv =0 ,
Signature · 1 line
1.7.10.4
Mauro,
Please merge:
The following changes since commit 4c8e64232d4a71e68d68b9093506966c0244a526:
cx23885: add basic DVB-S2 support for Hauppauge HVR-4400 (2012-12-16
12:27:25 -0500)
are available in the git repository at:
git://linuxtv.org/mkrufky/tuners tda10071
for you to fetch changes up to 326e65af0104faf8a243e534eb8bfdb35b73f4ed:
tda10071: make sure both tuner and demod i2c addresses are specified
(2012-12-16 18:05:02 -0500)
----------------------------------------------------------------
Michael Krufky (1):
tda10071: make sure both tuner and demod i2c addresses are specified
drivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)
Cheers,
Mike
Quoted 105 lines · Michael Krufky
display an error message if either
tuner_i2c_addrordemod_i2c_addrare not specified in thetda10071_configstructureSigned-off-by Michael Krufky <[email protected]>--- drivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)drivers/media/dvb-frontends/tda10071.c +15
-3@@ -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 = ®, }, { - .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 ));drivers/media/dvb-frontends/tda10071.h +2
-2@@ -28,10 +28,10 @@ struct tda10071_config {* Default: none, must set * Values: 0x55, */ -u8 i2c_address; +u8 demod_i2c_addr;/* Tuner I2C address. -* Default: 0x14 +* Default: none, must set * Values: 0x14, 0x54, ... */ u8 tuner_i2c_addr;drivers/media/pci/cx23885/cx23885-dvb.c +1
-1@@ -662,7 +662,7 @@ static struct mt2063_config terratec_mt2063_config[] = { };static const struct tda10071_config hauppauge_tda10071_config = { - .i2c_address =0x05 , + .demod_i2c_addr =0x05 , .tuner_i2c_addr =0x54 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL ,drivers/media/usb/em28xx/em28xx-dvb.c +2
-2@@ -714,7 +714,8 @@ static struct tda18271_config em28xx_cxd2820r_tda18271_config = { };static const struct tda10071_config em28xx_tda10071_config = { - .i2c_address =0x55 ,/* (0xaa >> 1) */ + .demod_i2c_addr =0x55 ,/* (0xaa >> 1) */ + .tuner_i2c_addr =0x14 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL , .spec_inv =0 , --1.7.10.4
As discussed on irc, the following pwclient commands should update the status of the patches in patchwork to correspond with this merge request:
pwclient update -s 'superseded' 15923
pwclient update -s 'accepted' 15930
Cheers,
Mike
Quoted 138 lines · Michael Krufky
Mauro,
Please merge:
The following changes since commit
4c8e64232d4a71e68d68b9093506966c0244a526:cx23885: add basic DVB-S2 support for Hauppauge HVR-4400 (2012-12-16
12:27:25 -0500)are available in the git repository at:
git://linuxtv.org/mkrufky/tunerstda10071for you to fetch changes up to
326e65af0104faf8a243e534eb8bfdb35b73f4ed:tda10071: make sure both tuner and demod i2c addresses are specified
(2012-12-16 18:05:02 -0500)----------------------------------------------------------------
Michael Krufky (1):
tda10071: make sure both tuner and demod i2c addresses are specifieddrivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)Cheers,
Mike
Quoted 105 lines · Michael Krufky
display an error message if either
tuner_i2c_addrordemod_i2c_addrare not specified in thetda10071_configstructureSigned-off-by Michael Krufky <[email protected]>--- drivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)drivers/media/dvb-frontends/tda10071.c +15
-3@@ -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 = ®, }, { - .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 ));drivers/media/dvb-frontends/tda10071.h +2
-2@@ -28,10 +28,10 @@ struct tda10071_config {* Default: none, must set * Values: 0x55, */ -u8 i2c_address; +u8 demod_i2c_addr;/* Tuner I2C address. -* Default: 0x14 +* Default: none, must set * Values: 0x14, 0x54, ... */ u8 tuner_i2c_addr;drivers/media/pci/cx23885/cx23885-dvb.c +1
-1@@ -662,7 +662,7 @@ static struct mt2063_config terratec_mt2063_config[] = { };static const struct tda10071_config hauppauge_tda10071_config = { - .i2c_address =0x05 , + .demod_i2c_addr =0x05 , .tuner_i2c_addr =0x54 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL ,drivers/media/usb/em28xx/em28xx-dvb.c +2
-2@@ -714,7 +714,8 @@ static struct tda18271_config em28xx_cxd2820r_tda18271_config = { };static const struct tda10071_config em28xx_tda10071_config = { - .i2c_address =0x55 ,/* (0xaa >> 1) */ + .demod_i2c_addr =0x55 ,/* (0xaa >> 1) */ + .tuner_i2c_addr =0x14 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL , .spec_inv =0 , --1.7.10.4
rebased against today's tip, as per your request :-)
pwclient update -s 'superseded' 15923
pwclient update -s 'superseded' 15930
The following changes since commit 1b5901331ff3af4bdc1b998a056a248c9924e2d1:
[media] exynos-gsc: modify number of output/capture buffers
(2012-12-21 10:26:44 -0200)
are available in the git repository at:
git://git.linuxtv.org/mkrufky/tuners tda10071
for you to fetch changes up to d562d77132333f0a7b1d704edc992a092d6d6bbe:
tda10071: make sure both tuner and demod i2c addresses are specified
(2012-12-21 08:29:49 -0500)
----------------------------------------------------------------
Michael Krufky (1):
tda10071: make sure both tuner and demod i2c addresses are specified
drivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)
Cheers,
Mike
Quoted 151 lines · Michael Krufky
As discussed on irc, the following pwclient commands should update the status of the patches in patchwork to correspond with this merge request:
pwclient update -s 'superseded' 15923
pwclient update -s 'accepted' 15930Cheers,
Mike
Quoted 138 lines · Michael Krufky
Mauro,
Please merge:
The following changes since commit
4c8e64232d4a71e68d68b9093506966c0244a526:cx23885: add basic DVB-S2 support for Hauppauge HVR-4400 (2012-12-16
12:27:25 -0500)are available in the git repository at:
git://linuxtv.org/mkrufky/tunerstda10071for you to fetch changes up to
326e65af0104faf8a243e534eb8bfdb35b73f4ed:tda10071: make sure both tuner and demod i2c addresses are specified
(2012-12-16 18:05:02 -0500)----------------------------------------------------------------
Michael Krufky (1):
tda10071: make sure both tuner and demod i2c addresses are specifieddrivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)Cheers,
Mike
Quoted 105 lines · Michael Krufky
display an error message if either
tuner_i2c_addrordemod_i2c_addrare not specified in thetda10071_configstructureSigned-off-by Michael Krufky <[email protected]>--- drivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)drivers/media/dvb-frontends/tda10071.c +15
-3@@ -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 = ®, }, { - .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 ));drivers/media/dvb-frontends/tda10071.h +2
-2@@ -28,10 +28,10 @@ struct tda10071_config {* Default: none, must set * Values: 0x55, */ -u8 i2c_address; +u8 demod_i2c_addr;/* Tuner I2C address. -* Default: 0x14 +* Default: none, must set * Values: 0x14, 0x54, ... */ u8 tuner_i2c_addr;drivers/media/pci/cx23885/cx23885-dvb.c +1
-1@@ -662,7 +662,7 @@ static struct mt2063_config terratec_mt2063_config[] = { };static const struct tda10071_config hauppauge_tda10071_config = { - .i2c_address =0x05 , + .demod_i2c_addr =0x05 , .tuner_i2c_addr =0x54 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL ,drivers/media/usb/em28xx/em28xx-dvb.c +2
-2@@ -714,7 +714,8 @@ static struct tda18271_config em28xx_cxd2820r_tda18271_config = { };static const struct tda10071_config em28xx_tda10071_config = { - .i2c_address =0x55 ,/* (0xaa >> 1) */ + .demod_i2c_addr =0x55 ,/* (0xaa >> 1) */ + .tuner_i2c_addr =0x14 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL , .spec_inv =0 , --1.7.10.4
rebased against today's tip, as per your request :-)
pwclient update -s 'superseded' 15923
pwclient update -s 'superseded' 15930
The following changes since commit 1b5901331ff3af4bdc1b998a056a248c9924e2d1:
[media] exynos-gsc: modify number of output/capture buffers
(2012-12-21 10:26:44 -0200)
are available in the git repository at:
git://git.linuxtv.org/mkrufky/tuners tda10071
for you to fetch changes up to d562d77132333f0a7b1d704edc992a092d6d6bbe:
tda10071: make sure both tuner and demod i2c addresses are specified
(2012-12-21 08:29:49 -0500)
Cheers,
Mike
Quoted 187 lines · Michael Krufky
rebased against today's tip, as per your request :-)
pwclient update -s 'superseded' 15923
pwclient update -s 'superseded' 15930The following changes since commit
1b5901331ff3af4bdc1b998a056a248c9924e2d1:[media] exynos-gsc: modify number of output/capture buffers
(2012-12-21 10:26:44 -0200)are available in the git repository at:
git://git.linuxtv.org/mkrufky/tunerstda10071for you to fetch changes up to
d562d77132333f0a7b1d704edc992a092d6d6bbe:tda10071: make sure both tuner and demod i2c addresses are specified
(2012-12-21 08:29:49 -0500)----------------------------------------------------------------
Michael Krufky (1):
tda10071: make sure both tuner and demod i2c addresses are specifieddrivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)Cheers,
Mike
Quoted 151 lines · Michael Krufky
As discussed on irc, the following pwclient commands should update the status of the patches in patchwork to correspond with this merge request:
pwclient update -s 'superseded' 15923
pwclient update -s 'accepted' 15930Cheers,
Mike
Quoted 138 lines · Michael Krufky
Mauro,
Please merge:
The following changes since commit
4c8e64232d4a71e68d68b9093506966c0244a526:cx23885: add basic DVB-S2 support for Hauppauge HVR-4400 (2012-12-16
12:27:25 -0500)are available in the git repository at:
git://linuxtv.org/mkrufky/tunerstda10071for you to fetch changes up to
326e65af0104faf8a243e534eb8bfdb35b73f4ed:tda10071: make sure both tuner and demod i2c addresses are specified
(2012-12-16 18:05:02 -0500)----------------------------------------------------------------
Michael Krufky (1):
tda10071: make sure both tuner and demod i2c addresses are specifieddrivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)Cheers,
Mike
Quoted 105 lines · Michael Krufky
display an error message if either
tuner_i2c_addrordemod_i2c_addrare not specified in thetda10071_configstructureSigned-off-by Michael Krufky <[email protected]>--- drivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)drivers/media/dvb-frontends/tda10071.c +15
-3@@ -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 = ®, }, { - .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 ));drivers/media/dvb-frontends/tda10071.h +2
-2@@ -28,10 +28,10 @@ struct tda10071_config {* Default: none, must set * Values: 0x55, */ -u8 i2c_address; +u8 demod_i2c_addr;/* Tuner I2C address. -* Default: 0x14 +* Default: none, must set * Values: 0x14, 0x54, ... */ u8 tuner_i2c_addr;drivers/media/pci/cx23885/cx23885-dvb.c +1
-1@@ -662,7 +662,7 @@ static struct mt2063_config terratec_mt2063_config[] = { };static const struct tda10071_config hauppauge_tda10071_config = { - .i2c_address =0x05 , + .demod_i2c_addr =0x05 , .tuner_i2c_addr =0x54 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL ,drivers/media/usb/em28xx/em28xx-dvb.c +2
-2@@ -714,7 +714,8 @@ static struct tda18271_config em28xx_cxd2820r_tda18271_config = { };static const struct tda10071_config em28xx_tda10071_config = { - .i2c_address =0x55 ,/* (0xaa >> 1) */ + .demod_i2c_addr =0x55 ,/* (0xaa >> 1) */ + .tuner_i2c_addr =0x14 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL , .spec_inv =0 , --1.7.10.4
Antti Palosaari
NAKQuoted 2 lines · Michael Krufky
display an error message if either
tuner_i2c_addrordemod_i2c_addrare not specified in thetda10071_configstructure
Nack.
I don't see it necessary at all to check correctness of driver configuration values explicitly like that. Those are values which user cannot never change and when driver developer pass wrong values he will find it out very soon as hardware is not working.
Adding comments to configuration struct which says possible values is advisable and enough IMHO.
Maybe you should open own topic for discussion if you really would like to add this kind of checks. It is not tda10071 driver specific change, it affects about all drivers.
regards
Antti
Quoted 101 lines
Signed-off-by Michael Krufky <[email protected]>--- drivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)drivers/media/dvb-frontends/tda10071.c +15
-3@@ -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 = ®, }, { - .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 ));drivers/media/dvb-frontends/tda10071.h +2
-2@@ -28,10 +28,10 @@ struct tda10071_config {* Default: none, must set * Values: 0x55, */ -u8 i2c_address; +u8 demod_i2c_addr;/* Tuner I2C address. -* Default: 0x14 +* Default: none, must set * Values: 0x14, 0x54, ... */ u8 tuner_i2c_addr;drivers/media/pci/cx23885/cx23885-dvb.c +1
-1@@ -662,7 +662,7 @@ static struct mt2063_config terratec_mt2063_config[] = { };static const struct tda10071_config hauppauge_tda10071_config = { - .i2c_address =0x05 , + .demod_i2c_addr =0x05 , .tuner_i2c_addr =0x54 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL ,drivers/media/usb/em28xx/em28xx-dvb.c +2
-1@@ -714,7 +714,8 @@ static struct tda18271_config em28xx_cxd2820r_tda18271_config = { };static const struct tda10071_config em28xx_tda10071_config = { - .i2c_address =0x55 ,/* (0xaa >> 1) */ + .demod_i2c_addr =0x55 ,/* (0xaa >> 1) */ + .tuner_i2c_addr =0x14 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL , .spec_inv =0 ,
Signature · 1 line
http://palosaari.fi/
Quoted 13 lines · Antti Palosaari
Quoted 3 lines · Michael Krufky
display an error message if either
tuner_i2c_addrordemod_i2c_addrare not specified in thetda10071_configstructureNack.
I don't see it necessary at all to check correctness of driver configuration values explicitly like that. Those are values which user cannot never change and when driver developer pass wrong values he will find it out very soon as hardware is not working.
Quoted 6 lines
Adding comments to configuration struct which says possible values is advisable and enough IMHO.
Maybe you should open own topic for discussion if you really would like to add this kind of checks. It is not tda10071 driver specific change, it affects about all drivers.
Antti,
I don't believe that your NACK has any technical merit- we are trying to enforce good programming practice here, and when we find that a piece of silicon has a configurable option, we like to expose that option. We try not to make default values unless its necessary, but when there are differing i2c addresses, it is always best to have that listed explicitly in the configuration structures. It's called self-documenting code- It's the way we try to write code in the Linux kernel.
In this case, there was one previous user of the tda10071 driver and it was a small change to add both tuner and demod i2c addresses to the configuration structure.
We did speak about this on IRC on the sixteenth of December, and you seemed OK with the idea:
[18:21] <mkrufky> dunno if you saw i asked earlier, but.... if you want to review the patches, i can include your credentials on the pull request
[18:21] <mkrufky> tda10071 patch:
http://git.linuxtv.org/mkrufky/hauppauge.git/commitdiff/4244d8155324263df37a8b2e067e7b9b81faec29
[18:22] <mkrufky> cx23885 patch:
http://git.linuxtv.org/mkrufky/hauppauge.git/commitdiff/eb658993b7a834911a3e8aabc7729b2505eef7d0
[18:22] <mkrufky> and i'll add another patch error out if the tuner_i2c_addr is not specified, as devin recommended [18:22] <mkrufky> (and also change the other tda10071 user to specify 0x14 for tuner_i2c_addr)
[18:23] <crope> Acked-by: Antti Palosaari <[email protected]> [18:23] <crope> Reviewed-by: Antti Palosaari <[email protected]> [18:23] <mkrufky> cool, thanks :-)
[18:24] <crope> I think 14 is the default, it is hard to understand why ever one wants to use some other address in case of it is controlled by demod :] but feel free to do that
[18:24] <mkrufky> ok
[18:25] <mkrufky> thats why i'll do it in a separate patch -- no need to confuse a board addition with other cleanups
[18:25] <crope> eg cx24116/cx24118 does not specify tuner address at all (as far as I see) => I think it is hard coded even to firmware [18:26] <mkrufky> yea ur right
...the tuner and demod addresses can be changed, so we represent that in the configuration structure. I see no reason why you should have any complaints about this patch.
Best regards,
Mike
Quoted 125 lines
regards
AnttiQuoted 110 lines
Signed-off-by Michael Krufky <[email protected]>--- drivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)drivers/media/dvb-frontends/tda10071.c +1
-1@@ -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,drivers/media/dvb-frontends/tda10071.c +2
-2@@ -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 = ®, }, { - .addr = priv->cfg.i2c_address, + .addr = priv->cfg.demod_i2c_addr, .flags =I2C_M_RD , .len =sizeof (buf),.buf = buf,drivers/media/dvb-frontends/tda10071.c +12
-0@@ -1202,6 +1202,18 @@ struct dvb_frontend *tda10071_attach(const structtda10071_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));drivers/media/dvb-frontends/tda10071.h +2
-2@@ -28,10 +28,10 @@ struct tda10071_config {* Default: none, must set * Values: 0x55, */ -u8 i2c_address; +u8 demod_i2c_addr;/* Tuner I2C address. -* Default: 0x14 +* Default: none, must set * Values: 0x14, 0x54, ... */ u8 tuner_i2c_addr;drivers/media/pci/cx23885/cx23885-dvb.c +1
-1@@ -662,7 +662,7 @@ static struct mt2063_config terratec_mt2063_config[] = { };static const struct tda10071_config hauppauge_tda10071_config = { - .i2c_address =0x05 , + .demod_i2c_addr =0x05 , .tuner_i2c_addr =0x54 , .i2c_wr_max =64 ,.ts_mode = TDA10071_TS_SERIAL,drivers/media/usb/em28xx/em28xx-dvb.c +2
-1@@ -714,7 +714,8 @@ static struct tda18271_config em28xx_cxd2820r_tda18271_config = { };static const struct tda10071_config em28xx_tda10071_config = { - .i2c_address =0x55 ,/* (0xaa >> 1) */ + .demod_i2c_addr =0x55 ,/* (0xaa >> 1) */ + .tuner_i2c_addr =0x14 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL ,Quoted 2 lines
.spec_inv = 0,--
http://palosaari.fi/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 24 lines · Michael Krufky
Quoted 13 lines · Antti Palosaari
Quoted 3 lines · Michael Krufky
display an error message if either
tuner_i2c_addrordemod_i2c_addrare not specified in thetda10071_configstructureNack.
I don't see it necessary at all to check correctness of driver configuration values explicitly like that. Those are values which user cannot never change and when driver developer pass wrong values he will find it out very soon as hardware is not working.
Quoted 6 lines
Adding comments to configuration struct which says possible values is advisable and enough IMHO.
Maybe you should open own topic for discussion if you really would like to add this kind of checks. It is not tda10071 driver specific change, it affects about all drivers.
Antti,
Quoted 8 lines
I don't believe that your NACK has any technical merit- we are trying to enforce good programming practice here, and when we find that a piece of silicon has a configurable option, we like to expose that option. We try not to make default values unless its necessary, but when there are differing i2c addresses, it is always best to have that listed explicitly in the configuration structures. It's called self-documenting code- It's the way we try to write code in the Linux kernel.
I am against checking explicitly that kind of I2C address correctness! Address is set compile time and cannot change during device operation. It is just stupid check, adding few lines more code to driver complexity and making bloated binary without a good reason.
It is *logging without a good reason/need*. Someone could put BOG_ON or WARN_ON in such places, but really, I would like to leave it totally without and let it fail for I/O error. My opinion is we should think if we really need to add all kind of logging, if not, do not log.
I could maybe agree that situation if we make general rule to add as much as checking for all the configuration parameters for all the drivers. I don't like it was added to my driver, whilst about 100% other drivers are just without currently.
Quoted 3 lines
In this case, there was one previous user of the tda10071 driver and it was a small change to add both tuner and demod i2c addresses to the configuration structure.
I was (and I am) fine for those two patches.
Quoted 27 lines
We did speak about this on IRC on the sixteenth of December, and you seemed OK with the idea:
[18:21] <mkrufky> dunno if you saw i asked earlier, but.... if you want to review the patches, i can include your credentials on the pull request
[18:21] <mkrufky> tda10071 patch:
http://git.linuxtv.org/mkrufky/hauppauge.git/commitdiff/4244d8155324263df37a8b2e067e7b9b81faec29
[18:22] <mkrufky> cx23885 patch:
http://git.linuxtv.org/mkrufky/hauppauge.git/commitdiff/eb658993b7a834911a3e8aabc7729b2505eef7d0
[18:22] <mkrufky> and i'll add another patch error out if thetuner_i2c_addris not specified, as devin recommended [18:22] <mkrufky> (and also change the other tda10071 user to specify0x14fortuner_i2c_addr)
[18:23] <crope> Acked-by: Antti Palosaari <[email protected]> [18:23] <crope> Reviewed-by: Antti Palosaari <[email protected]> [18:23] <mkrufky> cool, thanks :-)
[18:24] <crope> I think 14 is the default, it is hard to understand why ever one wants to use some other address in case of it is controlled by demod :] but feel free to do that
[18:24] <mkrufky> ok
[18:25] <mkrufky> thats why i'll do it in a separate patch -- no need to confuse a board addition with other cleanups
[18:25] <crope> eg cx24116/cx24118 does not specify tuner address at all (as far as I see) => I think it is hard coded even to firmware [18:26] <mkrufky> yea ur right
Quoted 11 lines
...the tuner and demod addresses can be changed, so we represent that in the configuration structure. I see no reason why you should have any complaints about this patch.
Best regards,
Mike
Quoted 2 lines
regards
Antti
Antti
Quoted 123 lines
Quoted 123 lines
Quoted 113 lines
Signed-off-by Michael Krufky <[email protected]>--- drivers/media/dvb-frontends/tda10071.c | 18 +++++++++++++++--- drivers/media/dvb-frontends/tda10071.h | 4 ++-- drivers/media/pci/cx23885/cx23885-dvb.c | 2 +- drivers/media/usb/em28xx/em28xx-dvb.c | 3 ++- 4 files changed, 20 insertions(+), 7 deletions(-)drivers/media/dvb-frontends/tda10071.c +1
-1@@ -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,drivers/media/dvb-frontends/tda10071.c +2
-2@@ -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 = ®, }, { - .addr = priv->cfg.i2c_address, + .addr = priv->cfg.demod_i2c_addr, .flags =I2C_M_RD , .len =sizeof (buf),.buf = buf,drivers/media/dvb-frontends/tda10071.c +12
-0@@ -1202,6 +1202,18 @@ struct dvb_frontend *tda10071_attach(const structtda10071_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));drivers/media/dvb-frontends/tda10071.h +2
-2@@ -28,10 +28,10 @@ struct tda10071_config {* Default: none, must set * Values: 0x55, */ -u8 i2c_address; +u8 demod_i2c_addr;/* Tuner I2C address. -* Default: 0x14 +* Default: none, must set * Values: 0x14, 0x54, ... */ u8 tuner_i2c_addr;drivers/media/pci/cx23885/cx23885-dvb.c +1
-1@@ -662,7 +662,7 @@ static struct mt2063_config terratec_mt2063_config[] = { };static const struct tda10071_config hauppauge_tda10071_config = { - .i2c_address =0x05 , + .demod_i2c_addr =0x05 , .tuner_i2c_addr =0x54 , .i2c_wr_max =64 ,.ts_mode = TDA10071_TS_SERIAL,drivers/media/usb/em28xx/em28xx-dvb.c +2
-1@@ -714,7 +714,8 @@ static struct tda18271_config em28xx_cxd2820r_tda18271_config = { };static const struct tda10071_config em28xx_tda10071_config = { - .i2c_address =0x55 ,/* (0xaa >> 1) */ + .demod_i2c_addr =0x55 ,/* (0xaa >> 1) */ + .tuner_i2c_addr =0x14 , .i2c_wr_max =64 , .ts_mode =TDA10071_TS_SERIAL ,Quoted 2 lines
.spec_inv = 0,--
http://palosaari.fi/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
http://palosaari.fi/