V4L/DVB (9417): DVB_ATTACH for STB0899, STB6100, TDA8261
authorManu Abraham <abraham.manu@gmail.com>
Mon, 8 Oct 2007 21:51:54 +0000 (18:51 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 29 Dec 2008 19:53:18 +0000 (17:53 -0200)
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/stb0899_drv.h
drivers/media/dvb/frontends/stb6100.h
drivers/media/dvb/frontends/tda8261.h
drivers/media/dvb/ttpci/budget-av.c
drivers/media/dvb/ttpci/budget-ci.c

index 8cb320643f8e7b0be1aa27dfb8559a39c22cced3..1e28114febf36b2cc70ef803664b59ecf092a819 100644 (file)
@@ -97,6 +97,21 @@ struct stb0899_config {
        int (*tuner_set_rfsiggain)(struct dvb_frontend *fe, u32 rf_gain);
 };
 
-extern struct dvb_frontend *stb0899_attach(struct stb0899_config *config, struct i2c_adapter *i2c);
+#if defined(CONFIG_DVB_STB0899) || (defined(CONFIG_DVB_STB0899_MODULE) && defined(MODULE))
+
+extern struct dvb_frontend *stb0899_attach(struct stb0899_config *config,
+                                          struct i2c_adapter *i2c);
+
+#else
+
+static inline struct dvb_frontend *stb0899_attach(struct stb0899_config *config,
+                                                 struct i2c_adapter *i2c)
+{
+       printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
+       return NULL;
+}
+
+#endif //CONFIG_DVB_STB0899
+
 
 #endif
index 771914a8a1cc2dee30abc05d18eb3ca4ca7e8e36..395d056599a603bd7c3d6582fe41bc6dacdbec59 100644 (file)
@@ -94,8 +94,22 @@ struct stb6100_state {
        u32 reference;
 };
 
-struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
-                                   struct stb6100_config* config,
-                                   struct i2c_adapter *i2c);
+#if defined(CONFIG_DVB_STB6100) || (defined(CONFIG_DVB_STB6100_MODULE) && defined(MODULE))
+
+extern struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
+                                          struct stb6100_config *config,
+                                          struct i2c_adapter *i2c);
+
+#else
+
+static inline struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe,
+                                                 struct stb6100_config *config,
+                                                 struct i2c_adapter *i2c)
+{
+       printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
+       return NULL;
+}
+
+#endif //CONFIG_DVB_STB6100
 
 #endif
index 1381d8e22a83490ae00e514fac370caeecaa84e8..a1814d39f63d1dfae605e5223c2ceb0ec5253a63 100644 (file)
@@ -15,8 +15,22 @@ struct tda8261_config {
        enum tda8261_step       step_size;
 };
 
+#if defined(CONFIG_DVB_TDA8261) || (defined(CONFIG_DVB_TDA8261_MODULE) && defined(MODULE))
+
 extern struct dvb_frontend *tda8261_attach(struct dvb_frontend *fe,
                                           const struct tda8261_config *config,
                                           struct i2c_adapter *i2c);
 
+#else
+
+static inline struct dvb_frontend *tda8261_attach(struct dvb_frontend *fe,
+                                                 const struct tda8261_config *config,
+                                                 struct i2c_adapter *i2c)
+{
+       printk(KERN_WARNING "%s: Driver disabled by Kconfig\n", __func__);
+       return NULL;
+}
+
+#endif //CONFIG_DVB_TDA8261
+
 #endif// __TDA8261_H
index ae28b0e7ab8d0a072be8b1e4bf208945f526fe82..ec31895c07294ec4d0ba0c808410051265602f67 100644 (file)
@@ -1603,8 +1603,8 @@ static void frontend_init(struct budget_av *budget_av)
        case SUBID_DVBS2_KNC1:
        case SUBID_DVBS2_KNC1_OEM:
                budget_av->reinitialise_demod = 1;
-               if ((fe = stb0899_attach(&knc1_dvbs2_config, &budget_av->budget.i2c_adap)))
-                       tda8261_attach(fe, &sd1878c_config, &budget_av->budget.i2c_adap);
+               if ((fe = dvb_attach(stb0899_attach, &knc1_dvbs2_config, &budget_av->budget.i2c_adap)))
+                       dvb_attach(tda8261_attach, fe, &sd1878c_config, &budget_av->budget.i2c_adap);
 
                break;
        case SUBID_DVBS_CINERGY1200:
index 169acfae54d2f9b1a647f141c1d28faab771eb78..6b77b123f75ca5c8eef4b26fea7fd0417894a1a2 100644 (file)
@@ -1768,20 +1768,17 @@ static void frontend_init(struct budget_ci *budget_ci)
                break;
 
        case 0x1019:            // TT S2-3200 PCI
-               budget_ci->budget.dvb_frontend = stb0899_attach(&tt3200_config, &budget_ci->budget.i2c_adap);
+               budget_ci->budget.dvb_frontend = dvb_attach(stb0899_attach, &tt3200_config, &budget_ci->budget.i2c_adap);
                if (budget_ci->budget.dvb_frontend) {
-                       if (stb6100_attach(budget_ci->budget.dvb_frontend, &tt3200_stb6100_config, &budget_ci->budget.i2c_adap)) {
-                               if (!lnbp21_attach(budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, 0, 0)) {
+                       if (dvb_attach(stb6100_attach, budget_ci->budget.dvb_frontend, &tt3200_stb6100_config, &budget_ci->budget.i2c_adap)) {
+                               if (!dvb_attach(lnbp21_attach, budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, 0, 0)) {
                                        printk("%s: No LNBP21 found!\n", __FUNCTION__);
-                                       if (budget_ci->budget.dvb_frontend->ops.tuner_ops.release)
-                                               budget_ci->budget.dvb_frontend->ops.tuner_ops.release(budget_ci->budget.dvb_frontend);
-                                       if (budget_ci->budget.dvb_frontend->ops.release)
-                                               budget_ci->budget.dvb_frontend->ops.release(budget_ci->budget.dvb_frontend);
+                                       dvb_frontend_detach(budget_ci->budget.dvb_frontend);
                                        budget_ci->budget.dvb_frontend = NULL;
                                }
                        } else {
-                               if (budget_ci->budget.dvb_frontend->ops.release)
-                                       budget_ci->budget.dvb_frontend->ops.release(budget_ci->budget.dvb_frontend);
+                                       dvb_frontend_detach(budget_ci->budget.dvb_frontend);
+                                       budget_ci->budget.dvb_frontend = NULL;
                        }
                }
                break;