summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-10-29 11:33:18 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-29 11:33:18 -0300
commitd10b8499d66b31d7e906fe3303b9d86ad7a6858f (patch)
tree248faf14c31c113e09552604ba5120c14ecd18dc
parent20340f725c5078f9bdc715efb2e926d6ce408816 (diff)
downloadmediapointer-dvb-s2-d10b8499d66b31d7e906fe3303b9d86ad7a6858f.tar.gz
mediapointer-dvb-s2-d10b8499d66b31d7e906fe3303b9d86ad7a6858f.tar.bz2
Prevents double tuner registering
From: Mauro Carvalho Chehab <mchehab@infradead.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org> --- linux/drivers/media/video/tuner-core.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
-rw-r--r--linux/drivers/media/video/tuner-core.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c
index 71ef32124..c53b64fb8 100644
--- a/linux/drivers/media/video/tuner-core.c
+++ b/linux/drivers/media/video/tuner-core.c
@@ -304,14 +304,11 @@ static void set_type(struct i2c_client *c, unsigned int type,
t->tuner_callback = tuner_callback;
}
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
- /* This code detects calls by card attach_inform */
- if (NULL == t->i2c.dev.driver) {
+ if (t->mode == T_UNINITIALIZED) {
tuner_dbg ("tuner 0x%02x: called during i2c_client register by adapter's attach_inform\n", c->addr);
return;
}
-#endif
/* discard private data, in case set_type() was previously called */
if (ops && ops->release)
@@ -725,6 +722,16 @@ static int tuner_attach(struct i2c_adapter *adap, int addr,
/* Should be just before return */
register_client:
tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
+
+ /* Sets a default mode */
+ if (t->mode_mask & T_ANALOG_TV) {
+ t->mode = T_ANALOG_TV;
+ } else if (t->mode_mask & T_RADIO) {
+ t->mode = T_RADIO;
+ } else {
+ t->mode = T_DIGITAL_TV;
+ }
+
i2c_attach_client (client);
set_type (client,t->type, t->mode_mask, t->config, t->tuner_callback);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)