]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
V4L/DVB (7045): xc5000: Small amount of cleanup and commenting
authorSteven Toth <stoth@hauppauge.com>
Sat, 5 Jan 2008 20:08:05 +0000 (17:08 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 25 Jan 2008 21:05:07 +0000 (19:05 -0200)
xc5000: Small amount of cleanup and commenting, just for clarification.

Signed-off-by: Steven Toth <stoth@hauppauge.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/frontends/xc5000.c
drivers/media/dvb/frontends/xc5000.h
drivers/media/video/cx23885/cx23885-cards.c
drivers/media/video/cx23885/cx23885-dvb.c
drivers/media/video/cx23885/cx23885.h
drivers/media/video/cx88/cx88-cards.c
drivers/media/video/cx88/cx88-dvb.c
drivers/media/video/tuner-core.c

index 28048d5307a20b73e5d8d0fa8039b8a015cfe581..a0705a640bafa6074b08fc2272d591c6b0c35e99 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <linux/module.h>
 #include <linux/moduleparam.h>
-#include <linux/videodev2.h>
+#include <linux/videodev.h>
 #include <linux/delay.h>
 #include <linux/dvb/frontend.h>
 #include <linux/i2c.h>
@@ -212,7 +212,7 @@ static void xc5000_TunerReset(struct dvb_frontend *fe)
        dprintk(1, "%s()\n", __FUNCTION__);
 
        if (priv->cfg->tuner_callback) {
-               ret = priv->cfg->tuner_callback(priv->cfg->video_dev,
+               ret = priv->cfg->tuner_callback(priv->cfg->priv,
                                                XC5000_TUNER_RESET, 0);
                if (ret)
                        printk(KERN_ERR "xc5000: reset failed\n");
index 85b2d438fa411c1e5d8ada989da9b433726146cb..e0e84562aed12fc4e1f3357376524069829c9520 100644 (file)
@@ -30,8 +30,16 @@ struct i2c_adapter;
 struct xc5000_config {
        u8   i2c_address;
        u32  if_khz;
-       void *video_dev;
-       int  (*tuner_callback) (void *dev, int command, int arg);
+
+       /* For each bridge framework, when it attaches either analog or digital,
+        * it has to store a reference back to its _core equivalent structure,
+        * so that it can service the hardware by steering gpio's etc.
+        * Each bridge implementation is different so cast priv accordingly.
+        * The xc5000 driver cares not for this value, other than ensuring
+        * it's passed back to a bridge during tuner_callback().
+        */
+       void *priv;
+       int  (*tuner_callback) (void *priv, int command, int arg);
 };
 
 /* xc5000 callback command */
index ee3f1b099145b4f9017bed92a23afe196d3e61ba..2d414dad5c31ac2b9c184459d6d04a6b42746dce 100644 (file)
@@ -247,9 +247,9 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
 /* Tuner callback function for cx23885 boards. Currently only needed
  * for HVR1500Q, which has an xc5000 tuner.
  */
-int cx23885_tuner_callback(void *i2c_bus, int command, int arg)
+int cx23885_tuner_callback(void *priv, int command, int arg)
 {
-       struct cx23885_i2c *bus = i2c_bus;
+       struct cx23885_i2c *bus = priv;
        struct cx23885_dev *dev = bus->dev;
 
        switch(dev->board) {
@@ -271,7 +271,7 @@ int cx23885_tuner_callback(void *i2c_bus, int command, int arg)
 
        return 0; /* Should never be here */
 }
-EXPORT_SYMBOL(cx23885_tuner_callback);
+
 void cx23885_gpio_setup(struct cx23885_dev *dev)
 {
        switch(dev->board) {
index 61d75d04db8dea0e21c97b03c78ff2d458d223f4..ed465c007cea64d201b001b20100827c10825608 100644 (file)
@@ -156,7 +156,6 @@ static struct s5h1409_config hauppauge_hvr1500q_config = {
 static struct xc5000_config hauppauge_hvr1500q_tunerconfig = {
        .i2c_address      = 0x61,
        .if_khz           = 5380,
-       /* cannot set .video_dev here, do it before attach. */
        .tuner_callback   = cx23885_tuner_callback
 };
 
@@ -282,11 +281,7 @@ static int dvb_register(struct cx23885_tsport *port)
                                                &hauppauge_hvr1500q_config,
                                                &dev->i2c_bus[0].i2c_adap);
                if (port->dvb.frontend != NULL) {
-                       /* tunerconfig.video_dev must point to
-                        * i2c_adap.algo_data
-                        */
-                       hauppauge_hvr1500q_tunerconfig.video_dev =
-                               i2c_bus->i2c_adap.algo_data;
+                       hauppauge_hvr1500q_tunerconfig.priv = i2c_bus;
                        dvb_attach(xc5000_attach, port->dvb.frontend,
                                &i2c_bus->i2c_adap,
                                &hauppauge_hvr1500q_tunerconfig);
index ac9a76624e987f052d8731ed7945b209ab1bc954..7cb2179f26227456ed25a507ee8ac20a1da3047b 100644 (file)
@@ -393,7 +393,7 @@ extern const unsigned int cx23885_bcount;
 extern struct cx23885_subid cx23885_subids[];
 extern const unsigned int cx23885_idcount;
 
-extern int cx23885_tuner_callback(void *i2c_bus, int command, int arg);
+extern int cx23885_tuner_callback(void *priv, int command, int arg);
 extern void cx23885_card_list(struct cx23885_dev *dev);
 extern int  cx23885_ir_init(struct cx23885_dev *dev);
 extern void cx23885_gpio_setup(struct cx23885_dev *dev);
index 3ba31572c65702d022221e06c470d0cb41e12ea2..254290975cdb62f4327c43a31e5829858b32b3c2 100644 (file)
@@ -1885,10 +1885,10 @@ static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
  * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both      *
  * analog tuner attach (tuner-core.c) and dvb tuner attach (cx88-dvb.c)    */
 
-int cx88_tuner_callback(void *i2c_algo, int command, int arg)
+int cx88_tuner_callback(void *priv, int command, int arg)
 {
-       struct i2c_algo_bit_data *algo = i2c_algo;
-       struct cx88_core *core = algo->data;
+       struct i2c_algo_bit_data *i2c_algo = priv;
+       struct cx88_core *core = i2c_algo->data;
 
        switch(core->boardnr) {
        case CX88_BOARD_PINNACLE_PCTV_HD_800i:
@@ -1898,7 +1898,6 @@ int cx88_tuner_callback(void *i2c_algo, int command, int arg)
                        cx_clear(MO_GP0_IO, 0x00000004);
                        mdelay(200);
                        cx_set(MO_GP0_IO, 0x00000004);
-                       printk(KERN_ERR "xc5000: in reset for xc5000\n");
                        mdelay(200);
                        return 0;
                }
index 0246f97a9987f35847b3b5730b6f67fa2ea50ddb..c852efca1592fdbacd5732f79456bfd853ac7176 100644 (file)
@@ -385,7 +385,6 @@ static struct s5h1409_config pinnacle_pctv_hd_800i_config = {
 static struct xc5000_config pinnacle_pctv_hd_800i_tuner_config = {
        .i2c_address    = 0x64,
        .if_khz         = 5380,
-       /* cannot set .video_dev here, do it right before attach */
        .tuner_callback = cx88_tuner_callback,
 };
 
@@ -654,7 +653,7 @@ static int dvb_register(struct cx8802_dev *dev)
                        /* tuner_config.video_dev must point to
                         * i2c_adap.algo_data
                         */
-                       pinnacle_pctv_hd_800i_tuner_config.video_dev =
+                       pinnacle_pctv_hd_800i_tuner_config.priv =
                                                dev->core->i2c_adap.algo_data;
                        dvb_attach(xc5000_attach, dev->dvb.frontend,
                                   &dev->core->i2c_adap,
index 16cdeeafeb6c833298a67fffdf280f2c1bd50671..8e406b168d7169b57b424d8f05292d627a1b7863 100644 (file)
@@ -434,7 +434,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
        case TUNER_XC5000:
                xc5000_cfg.i2c_address    = t->i2c->addr;
                xc5000_cfg.if_khz         = 5380;
-               xc5000_cfg.video_dev      = c->adapter->algo_data;
+               xc5000_cfg.priv           = c->adapter->algo_data;
                xc5000_cfg.tuner_callback = t->tuner_callback;
                if (!xc5000_attach(&t->fe, t->i2c->adapter, &xc5000_cfg)) {
                        t->type = TUNER_ABSENT;