Part1: Trent Piepho's fantastic work, differently arranged, 3 hunks cut out

--- a/drivers/media/dvb/bt8xx/dst.c Fri Apr 27 12:16:31 2007 -0300
+++ b/drivers/media/dvb/bt8xx/dst.c Mon Apr 30 12:39:33 2007 -0700
@@ -1721,23 +1721,30 @@ static void dst_release(struct dvb_front
                symbol_put(dst_ca_attach);
 #endif
        }
-#ifdef CONFIG_DVB_CORE_ATTACH
-       symbol_put(dst_attach);
-#endif
        kfree(state);
 }
 
 static struct dvb_frontend_ops dst_dvbt_ops;
 static struct dvb_frontend_ops dst_dvbs_ops;
 static struct dvb_frontend_ops dst_dvbc_ops;
 static struct dvb_frontend_ops dst_atsc_ops;
 
-struct dst_state *dst_attach(struct dst_state *state, struct dvb_adapter 
*dvb_adapter)
-{
+struct dvb_frontend *dst_attach(struct dst_config *config, struct bt878 *bt,
+ struct i2c_adapter *i2c)
+{
+struct dst_state *state = kzalloc(sizeof(*state), GFP_KERNEL);
+
+       if (!state) {
+       printk(KERN_ERR "dst: No memory!\n");
+       return NULL;;
+       }
+       state->i2c = i2c;
+       state->config = config;
+       state->bt = bt;
+
        /* check if the ASIC is there */
        if (dst_probe(state) < 0) {
-               kfree(state);
-               return NULL;
+               goto fail;
        }
        /* determine settings based on type */
        /* create dvb_frontend */
@@ -1756,12 +1763,15 @@ struct dst_state *dst_attach(struct dst_
                break;
        default:
                dprintk(verbose, DST_ERROR, 1, "unknown DST type. please report 
to the LinuxTV.org DVB mailinglist.");
-               kfree(state);
-               return NULL;
+               goto fail;
        }
        state->frontend.demodulator_priv = state;
 
-       return state;                           /*      Manu (DST is a card not 
a frontend)     */
+       return &state->frontend; /* Manu (DST is a card not a frontend) */
+
+       fail:
+       kfree(state);
+       return NULL;
 }
 
 EXPORT_SYMBOL(dst_attach);
--- a/drivers/media/dvb/bt8xx/dst_ca.c Fri Apr 27 12:16:31 2007 -0300
+++ b/drivers/media/dvb/bt8xx/dst_ca.c Mon Apr 30 12:39:33 2007 -0700
@@ -699,8 +699,9 @@ static struct dvb_device dvbdev_ca = {
        .fops = &dst_ca_fops
 };
 
-struct dvb_device *dst_ca_attach(struct dst_state *dst, struct dvb_adapter 
*dvb_adapter)
-{
+struct dvb_device *dst_ca_attach(struct dvb_frontend *fe, struct dvb_adapter 
*dvb_adapter)
+{
+       struct dst_state *dst = fe->demodulator_priv;
        struct dvb_device *dvbdev;
 
        dprintk(verbose, DST_CA_ERROR, 1, "registering DST-CA device");
--- a/drivers/media/dvb/bt8xx/dst_common.h Fri Apr 27 12:16:31 2007 -0300
+++ b/drivers/media/dvb/bt8xx/dst_common.h Mon Apr 30 12:39:33 2007 -0700
@@ -178,11 +178,25 @@ int write_dst(struct dst_state *state, u
 int write_dst(struct dst_state *state, u8 * data, u8 len);
 int read_dst(struct dst_state *state, u8 * ret, u8 len);
 u8 dst_check_sum(u8 * buf, u32 len);
-struct dst_state* dst_attach(struct dst_state* state, struct dvb_adapter 
*dvb_adapter);
-struct dvb_device *dst_ca_attach(struct dst_state *state, struct dvb_adapter 
*dvb_adapter);
-int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, 
int delay);
-
-int dst_command(struct dst_state* state, u8 * data, u8 len);
-
-
+int dst_gpio_outb(struct dst_state* state, u32 mask, u32 enbb, u32 outhigh, 
int delay);
+int dst_command(struct dst_state* state, u8 * data, u8 len);
+
+#if defined(CONFIG_DVB_DST) || (defined(CONFIG_DVB_DST_MODULE) && 
defined(MODULE))
+struct dvb_frontend *dst_attach(struct dst_config *config, struct bt878 *bt,
+struct i2c_adapter *i2c);
+struct dvb_device *dst_ca_attach(struct dvb_frontend *fe, struct dvb_adapter 
*dvb_adapter);
+#else
+static inline struct dvb_frontend *dst_attach(struct dst_config *config,
+ struct bt878 *bt, struct i2c_adapter *i2c)
+{
+ printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
+ return NULL;
+}
+static inline struct dvb_device *dst_ca_attach(struct dvb_frontend *fe,
+ struct dvb_adapter *dvb_adapter)
+{
+ printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
+ return NULL;
+}
+#endif // CONFIG_DVB_DST
 #endif // DST_COMMON_H
--- a/drivers/media/dvb/bt8xx/dvb-bt8xx.c Fri Apr 27 12:16:31 2007 -0300
+++ b/drivers/media/dvb/bt8xx/dvb-bt8xx.c Mon Apr 30 12:39:33 2007 -0700
@@ -659,26 +659,17 @@ static void frontend_init(struct dvb_bt8
 
        case BTTV_BOARD_TWINHAN_DST:
                /*      DST is not a frontend driver !!!                */
-               state = kmalloc(sizeof (struct dst_state), GFP_KERNEL);
-               if (!state) {
-                       printk("dvb_bt8xx: No memory\n");
-                       break;
-               }
-               /*      Setup the Card                                  */
-               state->config = &dst_config;
-               state->i2c = card->i2c_adapter;
-               state->bt = card->bt;
-               state->dst_ca = NULL;
                /*      DST is not a frontend, attaching the ASIC       */
-               if (dvb_attach(dst_attach, state, &card->dvb_adapter) == NULL) {
-                       printk("%s: Could not find a Twinhan DST.\n", 
__FUNCTION__);
+               card->fe = dvb_attach(dst_attach, &dst_config, card->bt,
+               card->i2c_adapter);
+               if (card->fe != NULL) {
+               printk(KERN_ERR "%s: Could not find a Twinhan DST.\n", 
__FUNCTION__);
                        break;
                }
                /*      Attach other DST peripherals if any             */
                /*      Conditional Access device                       */
-               card->fe = &state->frontend;
                if (state->dst_hw_cap & DST_TYPE_HAS_CA)
-                       dvb_attach(dst_ca_attach, state, &card->dvb_adapter);
+                       dvb_attach(dst_ca_attach, card->fe, &card->dvb_adapter);
                break;
 
        case BTTV_BOARD_PINNACLESAT:

-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

Reply via email to