V4L/DVB (7127): tuner: remove dependency of tuner-core on tuner-types
[cascardo/linux.git] / drivers / media / video / tuner-core.c
index 16cdeea..d6b64e9 100644 (file)
@@ -68,9 +68,9 @@ static unsigned short normal_i2c[] = {
 I2C_CLIENT_INSMOD;
 
 /* insmod options used at init time => read/only */
-static unsigned int addr = 0;
-static unsigned int no_autodetect = 0;
-static unsigned int show_i2c = 0;
+static unsigned int addr;
+static unsigned int no_autodetect;
+static unsigned int show_i2c;
 
 /* insmod options used at runtime => read/write */
 static int tuner_debug;
@@ -297,6 +297,12 @@ static void tuner_i2c_address_check(struct tuner *t)
            ((t->i2c->addr < 0x64) || (t->i2c->addr > 0x6f)))
                return;
 
+       /* We already know that the XC5000 can only be located at
+        * i2c address 0x61, 0x62, 0x63 or 0x64 */
+       if ((t->type == TUNER_XC5000) &&
+           ((t->i2c->addr <= 0x64)) && (t->i2c->addr >= 0x61))
+               return;
+
        tuner_warn("====================== WARNING! ======================\n");
        tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n");
        tuner_warn("will soon be dropped. This message indicates that your\n");
@@ -307,18 +313,13 @@ static void tuner_i2c_address_check(struct tuner *t)
        tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n");
        tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n");
        tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n",
-                  t->i2c->adapter->name, t->i2c->addr, t->type,
-                  tuners[t->type].name);
+                  t->i2c->adapter->name, t->i2c->addr, t->type, t->i2c->name);
        tuner_warn("====================== WARNING! ======================\n");
 }
 
-static void attach_simple_tuner(struct tuner *t)
+static inline void attach_simple_tuner(struct tuner *t)
 {
-       struct simple_tuner_config cfg = {
-               .type = t->type,
-               .tun  = &tuners[t->type]
-       };
-       simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr, &cfg);
+       simple_tuner_attach(&t->fe, t->i2c->adapter, t->i2c->addr, t->type);
 }
 
 static void attach_tda829x(struct tuner *t)
@@ -346,11 +347,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
                return;
        }
 
-       if (type >= tuner_count) {
-               tuner_warn ("tuner 0x%02x: Tuner count greater than %d\n",c->addr,tuner_count);
-               return;
-       }
-
        t->type = type;
        t->config = new_config;
        if (tuner_callback != NULL) {
@@ -434,7 +430,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;
@@ -1032,7 +1028,7 @@ static int tuner_resume(struct i2c_client *c)
 
 /* ---------------------------------------------------------------------- */
 
-LIST_HEAD(tuner_list);
+static LIST_HEAD(tuner_list);
 
 /* Search for existing radio and/or TV tuners on the given I2C adapter.
    Note that when this function is called from tuner_probe you can be