]> err.no Git - linux-2.6/blobdiff - drivers/media/video/tuner-core.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
[linux-2.6] / drivers / media / video / tuner-core.c
index b5dacde023ee3b9f78ebb122da399bb5c1610963..198f0afb812e2c93612af7b9786482bbe373367e 100644 (file)
@@ -448,10 +448,10 @@ static void set_type(struct i2c_client *c, unsigned int type,
 
                xc5000_cfg.i2c_address    = t->i2c->addr;
                xc5000_cfg.if_khz         = 5380;
-               xc5000_cfg.priv           = c->adapter->algo_data;
                xc5000_cfg.tuner_callback = t->tuner_callback;
                if (!dvb_attach(xc5000_attach,
-                               &t->fe, t->i2c->adapter, &xc5000_cfg))
+                               &t->fe, t->i2c->adapter, &xc5000_cfg,
+                               c->adapter->algo_data))
                        goto attach_failed;
 
                xc_tuner_ops = &t->fe.ops.tuner_ops;
@@ -1115,7 +1115,6 @@ static int tuner_probe(struct i2c_client *client,
        if (NULL == t)
                return -ENOMEM;
        t->i2c = client;
-       strlcpy(client->name, "(tuner unset)", sizeof(client->name));
        i2c_set_clientdata(client, t);
        t->type = UNSET;
        t->audmode = V4L2_TUNER_MODE_STEREO;
@@ -1165,7 +1164,7 @@ static int tuner_probe(struct i2c_client *client,
                        /* If chip is not tda8290, don't register.
                           since it can be tda9887*/
                        if (tuner_symbol_probe(tda829x_probe, t->i2c->adapter,
-                                              t->i2c->addr) == 0) {
+                                              t->i2c->addr) >= 0) {
                                tuner_dbg("tda829x detected\n");
                        } else {
                                /* Default is being tda9887 */
@@ -1179,7 +1178,7 @@ static int tuner_probe(struct i2c_client *client,
                case 0x60:
                        if (tuner_symbol_probe(tea5767_autodetection,
                                               t->i2c->adapter, t->i2c->addr)
-                                       != EINVAL) {
+                                       >= 0) {
                                t->type = TUNER_TEA5767;
                                t->mode_mask = T_RADIO;
                                t->mode = T_STANDBY;
@@ -1273,11 +1272,26 @@ static int tuner_remove(struct i2c_client *client)
 
        list_del(&t->list);
        kfree(t);
+
+       /* The probing code has overwritten the device name, restore it so
+          that reloading the driver will work. Ideally the device name
+          should not be overwritten in the first place, but for now that
+          will do. */
+       strlcpy(client->name, "tuner", I2C_NAME_SIZE);
        return 0;
 }
 
 /* ----------------------------------------------------------------------- */
 
+/* This driver supports many devices and the idea is to let the driver
+   detect which device is present. So rather than listing all supported
+   devices here, we pretend to support a single, fake device type. */
+static const struct i2c_device_id tuner_id[] = {
+       { "tuner", }, /* autodetect */
+       { }
+};
+MODULE_DEVICE_TABLE(i2c, tuner_id);
+
 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
        .name = "tuner",
        .driverid = I2C_DRIVERID_TUNER,
@@ -1287,6 +1301,7 @@ static struct v4l2_i2c_driver_data v4l2_i2c_data = {
        .suspend = tuner_suspend,
        .resume = tuner_resume,
        .legacy_probe = tuner_legacy_probe,
+       .id_table = tuner_id,
 };