]> git.karo-electronics.de Git - linux-beck.git/commitdiff
V4L/DVB (6842): tda9887: remove dependency on struct tuner
authorMichael Krufky <mkrufky@linuxtv.org>
Sun, 16 Dec 2007 23:11:46 +0000 (20:11 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 25 Jan 2008 21:03:55 +0000 (19:03 -0200)
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/tda9887.c
drivers/media/video/tda9887.h
drivers/media/video/tuner-core.c

index 95d974298fe93b5319b46211bc6c7f59b83784ee..0b5dc37fea514bd25dbbf750cf39512b4e21d49b 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/videodev.h>
 #include <media/v4l2-common.h>
 #include <media/tuner.h>
+#include "tuner-driver.h"
 #include "tuner-i2c.h"
 #include "tda9887.h"
 
@@ -665,26 +666,25 @@ static struct analog_tuner_ops tda9887_tuner_ops = {
        .set_config     = tda9887_set_config,
 };
 
-int tda9887_attach(struct tuner *t)
+struct dvb_frontend *tda9887_attach(struct dvb_frontend *fe,
+                                   struct i2c_adapter *i2c_adap,
+                                   u8 i2c_addr)
 {
        struct tda9887_priv *priv = NULL;
 
        priv = kzalloc(sizeof(struct tda9887_priv), GFP_KERNEL);
        if (priv == NULL)
-               return -ENOMEM;
-       t->fe.analog_demod_priv = priv;
+               return NULL;
+       fe->analog_demod_priv = priv;
 
-       priv->i2c_props.addr = t->i2c->addr;
-       priv->i2c_props.adap = t->i2c->adapter;
+       priv->i2c_props.addr = i2c_addr;
+       priv->i2c_props.adap = i2c_adap;
 
-       strlcpy(t->i2c->name, "tda9887", sizeof(t->i2c->name));
+       tda9887_info("tda988[5/6/7] found\n");
 
-       tda9887_info("tda988[5/6/7] found @ 0x%x (%s)\n", t->i2c->addr,
-                    t->i2c->driver->driver.name);
+       fe->ops.analog_demod_ops = &tda9887_tuner_ops;
 
-       t->fe.ops.analog_demod_ops = &tda9887_tuner_ops;
-
-       return 0;
+       return fe;
 }
 EXPORT_SYMBOL_GPL(tda9887_attach);
 
index b879f0ec2855e9c6870537bd28174f81368e7649..8f873a8e6ed20ef80b16ff2dfe4bdf4809be33ab 100644 (file)
 #ifndef __TDA9887_H__
 #define __TDA9887_H__
 
-#include "tuner-driver.h"
+#include <linux/i2c.h>
+#include "dvb_frontend.h"
 
 /* ------------------------------------------------------------------------ */
 #if defined(CONFIG_TUNER_TDA9887) || (defined(CONFIG_TUNER_TDA9887_MODULE) && defined(MODULE))
-extern int tda9887_attach(struct tuner *t);
+extern struct dvb_frontend *tda9887_attach(struct dvb_frontend *fe,
+                                          struct i2c_adapter *i2c_adap,
+                                          u8 i2c_addr);
 #else
-static inline int tda9887_attach(struct tuner *t)
+static inline struct dvb_frontend *tda9887_attach(struct dvb_frontend *fe,
+                                                 struct i2c_adapter *i2c_adap,
+                                                 u8 i2c_addr)
 {
        printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
-       return -EINVAL;
+       return NULL;
 }
 #endif
 
index 695f39ebe77ba8416b3a86211de0ea940f2fef40..d51f3afa969d55a71cb1e4e9babbbd8a912a0c06 100644 (file)
@@ -408,7 +408,7 @@ static void set_type(struct i2c_client *c, unsigned int type,
                break;
        }
        case TUNER_TDA9887:
-               tda9887_attach(t);
+               tda9887_attach(&t->fe, t->i2c->adapter, t->i2c->addr);
                break;
        default:
                attach_simple_tuner(t);