V4L/DVB (10321): dib0700: Report dib0700_i2c_enumeration failures
authorDevin Heitmueller <dheitmueller@linuxtv.org>
Wed, 21 Jan 2009 04:55:45 +0000 (01:55 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:42:28 +0000 (12:42 -0300)
Make it clear that a failure in dib0700_i2c_enumeration is a fatal condition
and we cannot continue.  If the failure occurs, do not attempt to attach to
the tuner.

Problem Noticed the issue when debugging an i2c issue a YUAN High-Tech
STK7700PH for user Roshan Karki <roshan@olenepal.org>.

Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/dvb-usb/dib0700_devices.c

index a56b9ef3c03ceb774f76f0a0ccde719efa89ac80..f291fb55f1becd76dd02776d72e6f02e92d83b8e 100644 (file)
@@ -262,7 +262,12 @@ static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap)
                msleep(10);
                dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
                msleep(10);
-               dib7000p_i2c_enumeration(&adap->dev->i2c_adap,1,18,stk7700d_dib7000p_mt2266_config);
+               if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
+                                            stk7700d_dib7000p_mt2266_config)
+                   != 0) {
+                       err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n", __func__);
+                       return -ENODEV;
+               }
        }
 
        adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
@@ -284,7 +289,12 @@ static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap)
                dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);
                msleep(10);
                dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
-               dib7000p_i2c_enumeration(&adap->dev->i2c_adap,2,18,stk7700d_dib7000p_mt2266_config);
+               if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
+                                            stk7700d_dib7000p_mt2266_config)
+                   != 0) {
+                       err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n", __func__);
+                       return -ENODEV;
+               }
        }
 
        adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1),
@@ -421,8 +431,12 @@ static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap)
        dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
        msleep(10);
 
-       dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
-               &stk7700ph_dib7700_xc3028_config);
+       if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
+                                    &stk7700ph_dib7700_xc3028_config) != 0) {
+               err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n",
+                   __func__);
+               return -ENODEV;
+       }
 
        adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
                &stk7700ph_dib7700_xc3028_config);
@@ -1187,8 +1201,12 @@ static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap)
        msleep(10);
        dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
 
-       dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
-               &dib7070p_dib7000p_config);
+       if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18,
+                                    &dib7070p_dib7000p_config) != 0) {
+               err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n",
+                   __func__);
+               return -ENODEV;
+       }
 
        adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80,
                &dib7070p_dib7000p_config);
@@ -1244,7 +1262,12 @@ static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap)
        msleep(10);
        dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
 
-       dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, stk7070pd_dib7000p_config);
+       if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18,
+                                    stk7070pd_dib7000p_config) != 0) {
+               err("%s: dib7000p_i2c_enumeration failed.  Cannot continue\n",
+                   __func__);
+               return -ENODEV;
+       }
 
        adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]);
        return adap->fe == NULL ? -ENODEV : 0;