]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (4465): Attach the dib3000mc correctly
authorPatrick Boettcher <pb@linuxtv.org>
Wed, 2 Aug 2006 11:44:31 +0000 (08:44 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Tue, 26 Sep 2006 14:53:47 +0000 (11:53 -0300)
Flynn Marquardt found out that there is problem with the new dib3000mc-driver
when using with the real dib3000mc. It resulted in a segfault.
Fixed two things: use the correct I2C address and do not attach a tuner, when
the demod was previously failing.

Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/dvb-usb/dibusb-common.c
drivers/media/dvb/dvb-usb/dvb-usb-dvb.c

index 390ced9ae4bcdfc5a655754e1f1a452ad9158ad0..6723c153e3f44d1bdd4c91ef7d8747dd25334083 100644 (file)
@@ -230,15 +230,19 @@ static struct dib3000mc_config mod3000p_dib3000p_config = {
 
 int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d)
 {
-       if (dib3000mc_attach(&d->i2c_adap, 1, DEFAULT_DIB3000P_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &d->fe) == 0) {
-               if (d->priv != NULL) {
-                       struct dibusb_state *st = d->priv;
-                       st->ops.pid_parse = dib3000mc_pid_parse;
-                       st->ops.pid_ctrl  = dib3000mc_pid_control;
-               }
-               return 0;
+       int ret;
+       if ((ret = dib3000mc_attach(&d->i2c_adap, 1, DEFAULT_DIB3000P_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &d->fe)) != 0)
+               return ret;
+
+       if ((ret = dib3000mc_attach(&d->i2c_adap, 1, DEFAULT_DIB3000MC_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &d->fe)) != 0)
+               return ret;
+
+       if (d->priv != NULL) {
+               struct dibusb_state *st = d->priv;
+               st->ops.pid_parse = dib3000mc_pid_parse;
+               st->ops.pid_ctrl  = dib3000mc_pid_control;
        }
-       return -ENODEV;
+       return 0;
 }
 EXPORT_SYMBOL(dibusb_dib3000mc_frontend_attach);
 
index 71a754e2287e1557fe4560a2beccbfb49fad1bfe..3a19689d9c9a4f8c95acd20b9c9a98cd6d01573e 100644 (file)
@@ -191,12 +191,13 @@ int dvb_usb_fe_init(struct dvb_usb_device* d)
                        d->fe = NULL;
                        return -ENODEV;
                }
+
+               /* only attach the tuner if the demod is there */
+               if (d->props.tuner_attach != NULL)
+                       d->props.tuner_attach(d);
        } else
                err("no frontend was attached by '%s'",d->desc->name);
 
-       if (d->props.tuner_attach != NULL)
-               d->props.tuner_attach(d);
-
        return 0;
 }