]> err.no Git - linux-2.6/commitdiff
tuner: Do not alter i2c_client.name
authorMichael Krufky <mkrufky@linuxtv.org>
Mon, 26 May 2008 14:08:40 +0000 (16:08 +0200)
committerJean Delvare <khali@hyperion.delvare>
Mon, 26 May 2008 14:08:40 +0000 (16:08 +0200)
The tuner driver used to change i2c_client.name for its own needs, but
it really shouldn't, as this field is used by i2c-core to do the
device/driver matching. So, create and use a separate field for the
tuner driver needs.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
drivers/media/video/tuner-core.c

index 198f0afb812e2c93612af7b9786482bbe373367e..a0f7bc1edaa25da81d8e71d1fdb2b99881eb8bd3 100644 (file)
@@ -92,6 +92,7 @@ struct tuner {
        unsigned int        type; /* chip type id */
        unsigned int        config;
        int (*tuner_callback) (void *dev, int command, int arg);
+       const char          *name;
 };
 
 /* standard i2c insmod options */
@@ -330,13 +331,13 @@ static void tuner_i2c_address_check(struct tuner *t)
        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");
        tuner_warn("hardware has a %s tuner at i2c address 0x%02x.\n",
-                  t->i2c->name, t->i2c->addr);
+                  t->name, t->i2c->addr);
        tuner_warn("To ensure continued support for your device, please\n");
        tuner_warn("send a copy of this message, along with full dmesg\n");
        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, t->i2c->name);
+                  t->i2c->adapter->name, t->i2c->addr, t->type, t->name);
        tuner_warn("====================== WARNING! ======================\n");
 }
 
@@ -470,19 +471,17 @@ static void set_type(struct i2c_client *c, unsigned int type,
        if ((NULL == analog_ops->set_params) &&
            (fe_tuner_ops->set_analog_params)) {
 
-               strlcpy(t->i2c->name, fe_tuner_ops->info.name,
-                       sizeof(t->i2c->name));
+               t->name = fe_tuner_ops->info.name;
 
                t->fe.analog_demod_priv = t;
                memcpy(analog_ops, &tuner_core_ops,
                       sizeof(struct analog_demod_ops));
 
        } else {
-               strlcpy(t->i2c->name, analog_ops->info.name,
-                       sizeof(t->i2c->name));
+               t->name = analog_ops->info.name;
        }
 
-       tuner_dbg("type set to %s\n", t->i2c->name);
+       tuner_dbg("type set to %s\n", t->name);
 
        if (t->mode_mask == T_UNINITIALIZED)
                t->mode_mask = new_mode_mask;
@@ -1115,6 +1114,7 @@ static int tuner_probe(struct i2c_client *client,
        if (NULL == t)
                return -ENOMEM;
        t->i2c = client;
+       t->name = "(tuner unset)";
        i2c_set_clientdata(client, t);
        t->type = UNSET;
        t->audmode = V4L2_TUNER_MODE_STEREO;
@@ -1272,12 +1272,6 @@ 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;
 }