diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-05-26 10:08:40 -0400 |
---|---|---|
committer | Jean Delvare <khali@hyperion.delvare> | 2008-05-26 10:08:40 -0400 |
commit | 7271e60a950b3677f136a31e084bc4b0463c7018 (patch) | |
tree | 4657584e9362e1915aa0e39b8357076209dacea8 /drivers/media | |
parent | b3733034f113a4119f734b84e94180a42c8bc1a1 (diff) |
tuner: Do not alter i2c_client.name
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>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/tuner-core.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 198f0afb812e..a0f7bc1edaa2 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -92,6 +92,7 @@ struct tuner { | |||
92 | unsigned int type; /* chip type id */ | 92 | unsigned int type; /* chip type id */ |
93 | unsigned int config; | 93 | unsigned int config; |
94 | int (*tuner_callback) (void *dev, int command, int arg); | 94 | int (*tuner_callback) (void *dev, int command, int arg); |
95 | const char *name; | ||
95 | }; | 96 | }; |
96 | 97 | ||
97 | /* standard i2c insmod options */ | 98 | /* standard i2c insmod options */ |
@@ -330,13 +331,13 @@ static void tuner_i2c_address_check(struct tuner *t) | |||
330 | tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n"); | 331 | tuner_warn("Support for tuners in i2c address range 0x64 thru 0x6f\n"); |
331 | tuner_warn("will soon be dropped. This message indicates that your\n"); | 332 | tuner_warn("will soon be dropped. This message indicates that your\n"); |
332 | tuner_warn("hardware has a %s tuner at i2c address 0x%02x.\n", | 333 | tuner_warn("hardware has a %s tuner at i2c address 0x%02x.\n", |
333 | t->i2c->name, t->i2c->addr); | 334 | t->name, t->i2c->addr); |
334 | tuner_warn("To ensure continued support for your device, please\n"); | 335 | tuner_warn("To ensure continued support for your device, please\n"); |
335 | tuner_warn("send a copy of this message, along with full dmesg\n"); | 336 | tuner_warn("send a copy of this message, along with full dmesg\n"); |
336 | tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n"); | 337 | tuner_warn("output to v4l-dvb-maintainer@linuxtv.org\n"); |
337 | tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n"); | 338 | tuner_warn("Please use subject line: \"obsolete tuner i2c address.\"\n"); |
338 | tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n", | 339 | tuner_warn("driver: %s, addr: 0x%02x, type: %d (%s)\n", |
339 | t->i2c->adapter->name, t->i2c->addr, t->type, t->i2c->name); | 340 | t->i2c->adapter->name, t->i2c->addr, t->type, t->name); |
340 | tuner_warn("====================== WARNING! ======================\n"); | 341 | tuner_warn("====================== WARNING! ======================\n"); |
341 | } | 342 | } |
342 | 343 | ||
@@ -470,19 +471,17 @@ static void set_type(struct i2c_client *c, unsigned int type, | |||
470 | if ((NULL == analog_ops->set_params) && | 471 | if ((NULL == analog_ops->set_params) && |
471 | (fe_tuner_ops->set_analog_params)) { | 472 | (fe_tuner_ops->set_analog_params)) { |
472 | 473 | ||
473 | strlcpy(t->i2c->name, fe_tuner_ops->info.name, | 474 | t->name = fe_tuner_ops->info.name; |
474 | sizeof(t->i2c->name)); | ||
475 | 475 | ||
476 | t->fe.analog_demod_priv = t; | 476 | t->fe.analog_demod_priv = t; |
477 | memcpy(analog_ops, &tuner_core_ops, | 477 | memcpy(analog_ops, &tuner_core_ops, |
478 | sizeof(struct analog_demod_ops)); | 478 | sizeof(struct analog_demod_ops)); |
479 | 479 | ||
480 | } else { | 480 | } else { |
481 | strlcpy(t->i2c->name, analog_ops->info.name, | 481 | t->name = analog_ops->info.name; |
482 | sizeof(t->i2c->name)); | ||
483 | } | 482 | } |
484 | 483 | ||
485 | tuner_dbg("type set to %s\n", t->i2c->name); | 484 | tuner_dbg("type set to %s\n", t->name); |
486 | 485 | ||
487 | if (t->mode_mask == T_UNINITIALIZED) | 486 | if (t->mode_mask == T_UNINITIALIZED) |
488 | t->mode_mask = new_mode_mask; | 487 | t->mode_mask = new_mode_mask; |
@@ -1115,6 +1114,7 @@ static int tuner_probe(struct i2c_client *client, | |||
1115 | if (NULL == t) | 1114 | if (NULL == t) |
1116 | return -ENOMEM; | 1115 | return -ENOMEM; |
1117 | t->i2c = client; | 1116 | t->i2c = client; |
1117 | t->name = "(tuner unset)"; | ||
1118 | i2c_set_clientdata(client, t); | 1118 | i2c_set_clientdata(client, t); |
1119 | t->type = UNSET; | 1119 | t->type = UNSET; |
1120 | t->audmode = V4L2_TUNER_MODE_STEREO; | 1120 | t->audmode = V4L2_TUNER_MODE_STEREO; |
@@ -1272,12 +1272,6 @@ static int tuner_remove(struct i2c_client *client) | |||
1272 | 1272 | ||
1273 | list_del(&t->list); | 1273 | list_del(&t->list); |
1274 | kfree(t); | 1274 | kfree(t); |
1275 | |||
1276 | /* The probing code has overwritten the device name, restore it so | ||
1277 | that reloading the driver will work. Ideally the device name | ||
1278 | should not be overwritten in the first place, but for now that | ||
1279 | will do. */ | ||
1280 | strlcpy(client->name, "tuner", I2C_NAME_SIZE); | ||
1281 | return 0; | 1275 | return 0; |
1282 | } | 1276 | } |
1283 | 1277 | ||