Commit 3e5b787ac38575c88ceb20619bcda09cb4c17d8b

Authored by Linus Torvalds

Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6

* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
  i2c/max6875: Really prevent 24RF08 corruption
  i2c-amd756: Fix functionality flags
  i2c: Kill the old driver matching scheme
  i2c: Convert remaining new-style drivers to use module aliasing
  i2c: Switch pasemi to the new device/driver matching scheme
  i2c: Clean up Blackfin BF527 I2C device declarations
  i2c-nforce2: Disable the second SMBus channel on the DFI Lanparty NF4 Expert
  i2c: New co-maintainer

Showing 25 changed files Side-by-side Diff

... ... @@ -1940,8 +1940,10 @@
1940 1940 S: Maintained
1941 1941  
1942 1942 I2C SUBSYSTEM
1943   -P: Jean Delvare
  1943 +P: Jean Delvare (PC drivers, core)
1944 1944 M: khali@linux-fr.org
  1945 +P: Ben Dooks (embedded platforms)
  1946 +M: ben-linux@fluff.org
1945 1947 L: i2c@lm-sensors.org
1946 1948 T: quilt http://khali.linux-fr.org/devel/linux-2.6/jdelvare-i2c/
1947 1949 S: Maintained
arch/blackfin/mach-bf527/boards/ezkit.c
... ... @@ -799,13 +799,11 @@
799 799 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
800 800 {
801 801 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
802   - .type = "pcf8574_lcd",
803 802 },
804 803 #endif
805 804 #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
806 805 {
807 806 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
808   - .type = "pcf8574_keypad",
809 807 .irq = IRQ_PF8,
810 808 },
811 809 #endif
arch/powerpc/platforms/pasemi/misc.c
... ... @@ -24,12 +24,11 @@
24 24 */
25 25 struct i2c_driver_device {
26 26 char *of_device;
27   - char *i2c_driver;
28 27 char *i2c_type;
29 28 };
30 29  
31 30 static struct i2c_driver_device i2c_devices[] __initdata = {
32   - {"dallas,ds1338", "rtc-ds1307", "ds1338"},
  31 + {"dallas,ds1338", "ds1338"},
33 32 };
34 33  
35 34 static int __init find_i2c_driver(struct device_node *node,
... ... @@ -40,9 +39,7 @@
40 39 for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) {
41 40 if (!of_device_is_compatible(node, i2c_devices[i].of_device))
42 41 continue;
43   - if (strlcpy(info->driver_name, i2c_devices[i].i2c_driver,
44   - KOBJ_NAME_LEN) >= KOBJ_NAME_LEN ||
45   - strlcpy(info->type, i2c_devices[i].i2c_type,
  42 + if (strlcpy(info->type, i2c_devices[i].i2c_type,
46 43 I2C_NAME_SIZE) >= I2C_NAME_SIZE)
47 44 return -ENOMEM;
48 45 return 0;
drivers/i2c/busses/i2c-amd756.c
... ... @@ -290,7 +290,7 @@
290 290 {
291 291 return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
292 292 I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
293   - I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_PROC_CALL;
  293 + I2C_FUNC_SMBUS_BLOCK_DATA;
294 294 }
295 295  
296 296 static const struct i2c_algorithm smbus_algorithm = {
drivers/i2c/busses/i2c-nforce2.c
... ... @@ -50,6 +50,7 @@
50 50 #include <linux/init.h>
51 51 #include <linux/i2c.h>
52 52 #include <linux/delay.h>
  53 +#include <linux/dmi.h>
53 54 #include <asm/io.h>
54 55  
55 56 MODULE_LICENSE("GPL");
... ... @@ -109,6 +110,18 @@
109 110 /* Misc definitions */
110 111 #define MAX_TIMEOUT 100
111 112  
  113 +/* We disable the second SMBus channel on these boards */
  114 +static struct dmi_system_id __devinitdata nforce2_dmi_blacklist2[] = {
  115 + {
  116 + .ident = "DFI Lanparty NF4 Expert",
  117 + .matches = {
  118 + DMI_MATCH(DMI_BOARD_VENDOR, "DFI Corp,LTD"),
  119 + DMI_MATCH(DMI_BOARD_NAME, "LP UT NF4 Expert"),
  120 + },
  121 + },
  122 + { }
  123 +};
  124 +
112 125 static struct pci_driver nforce2_driver;
113 126  
114 127 static void nforce2_abort(struct i2c_adapter *adap)
... ... @@ -367,10 +380,17 @@
367 380 smbuses[0].base = 0; /* to have a check value */
368 381 }
369 382 /* SMBus adapter 2 */
370   - res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1], "SMB2");
371   - if (res2 < 0) {
372   - dev_err(&dev->dev, "Error probing SMB2.\n");
373   - smbuses[1].base = 0; /* to have a check value */
  383 + if (dmi_check_system(nforce2_dmi_blacklist2)) {
  384 + dev_err(&dev->dev, "Disabling SMB2 for safety reasons.\n");
  385 + res2 = -EPERM;
  386 + smbuses[1].base = 0;
  387 + } else {
  388 + res2 = nforce2_probe_smb(dev, 5, NFORCE_PCI_SMB2, &smbuses[1],
  389 + "SMB2");
  390 + if (res2 < 0) {
  391 + dev_err(&dev->dev, "Error probing SMB2.\n");
  392 + smbuses[1].base = 0; /* to have a check value */
  393 + }
374 394 }
375 395 if ((res1 < 0) && (res2 < 0)) {
376 396 /* we did not find even one of the SMBuses, so we give up */
drivers/i2c/chips/max6875.c
... ... @@ -207,9 +207,6 @@
207 207 fake_client->flags = 0;
208 208 strlcpy(fake_client->name, "max6875 subclient", I2C_NAME_SIZE);
209 209  
210   - /* Prevent 24RF08 corruption (in case of user error) */
211   - i2c_smbus_write_quick(real_client, 0);
212   -
213 210 if ((err = i2c_attach_client(real_client)) != 0)
214 211 goto exit_kfree2;
215 212  
drivers/i2c/i2c-core.c
... ... @@ -74,10 +74,7 @@
74 74 if (driver->id_table)
75 75 return i2c_match_id(driver->id_table, client) != NULL;
76 76  
77   - /* new style drivers use the same kind of driver matching policy
78   - * as platform devices or SPI: compare device and driver IDs.
79   - */
80   - return strcmp(client->driver_name, drv->name) == 0;
  77 + return 0;
81 78 }
82 79  
83 80 #ifdef CONFIG_HOTPLUG
... ... @@ -91,14 +88,9 @@
91 88 if (dev->driver)
92 89 return 0;
93 90  
94   - if (client->driver_name[0]) {
95   - if (add_uevent_var(env, "MODALIAS=%s", client->driver_name))
96   - return -ENOMEM;
97   - } else {
98   - if (add_uevent_var(env, "MODALIAS=%s%s",
99   - I2C_MODULE_PREFIX, client->name))
100   - return -ENOMEM;
101   - }
  91 + if (add_uevent_var(env, "MODALIAS=%s%s",
  92 + I2C_MODULE_PREFIX, client->name))
  93 + return -ENOMEM;
102 94 dev_dbg(dev, "uevent\n");
103 95 return 0;
104 96 }
... ... @@ -206,9 +198,7 @@
206 198 static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf)
207 199 {
208 200 struct i2c_client *client = to_i2c_client(dev);
209   - return client->driver_name[0]
210   - ? sprintf(buf, "%s\n", client->driver_name)
211   - : sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
  201 + return sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name);
212 202 }
213 203  
214 204 static struct device_attribute i2c_dev_attrs[] = {
... ... @@ -282,8 +272,6 @@
282 272 client->addr = info->addr;
283 273 client->irq = info->irq;
284 274  
285   - strlcpy(client->driver_name, info->driver_name,
286   - sizeof(client->driver_name));
287 275 strlcpy(client->name, info->type, sizeof(client->name));
288 276  
289 277 /* a new style driver may be bound to this device when we
drivers/media/video/cs5345.c
... ... @@ -160,10 +160,17 @@
160 160  
161 161 /* ----------------------------------------------------------------------- */
162 162  
  163 +static const struct i2c_device_id cs5345_id[] = {
  164 + { "cs5345", 0 },
  165 + { }
  166 +};
  167 +MODULE_DEVICE_TABLE(i2c, cs5345_id);
  168 +
163 169 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
164 170 .name = "cs5345",
165 171 .driverid = I2C_DRIVERID_CS5345,
166 172 .command = cs5345_command,
167 173 .probe = cs5345_probe,
  174 + .id_table = cs5345_id,
168 175 };
drivers/media/video/cs53l32a.c
... ... @@ -144,7 +144,8 @@
144 144 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
145 145 return -EIO;
146 146  
147   - snprintf(client->name, sizeof(client->name) - 1, "cs53l32a");
  147 + if (!id)
  148 + strlcpy(client->name, "cs53l32a", sizeof(client->name));
148 149  
149 150 v4l_info(client, "chip found @ 0x%x (%s)\n",
150 151 client->addr << 1, client->adapter->name);
151 152  
... ... @@ -175,10 +176,17 @@
175 176 return 0;
176 177 }
177 178  
  179 +static const struct i2c_device_id cs53l32a_id[] = {
  180 + { "cs53l32a", 0 },
  181 + { }
  182 +};
  183 +MODULE_DEVICE_TABLE(i2c, cs53l32a_id);
  184 +
178 185 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
179 186 .name = "cs53l32a",
180 187 .driverid = I2C_DRIVERID_CS53L32A,
181 188 .command = cs53l32a_command,
182 189 .probe = cs53l32a_probe,
  190 + .id_table = cs53l32a_id,
183 191 };
drivers/media/video/cx18/cx18-i2c.c
... ... @@ -74,7 +74,7 @@
74 74 };
75 75  
76 76 /* This array should match the CX18_HW_ defines */
77   -static const char * const hw_drivernames[] = {
  77 +static const char * const hw_devicenames[] = {
78 78 "tuner",
79 79 "tveeprom",
80 80 "cs5345",
... ... @@ -95,8 +95,7 @@
95 95 id = hw_driverids[idx];
96 96 bus = hw_bus[idx];
97 97 memset(&info, 0, sizeof(info));
98   - strlcpy(info.driver_name, hw_drivernames[idx],
99   - sizeof(info.driver_name));
  98 + strlcpy(info.type, hw_devicenames[idx], sizeof(info.type));
100 99 info.addr = hw_addrs[idx];
101 100 for (i = 0; i < I2C_CLIENTS_MAX; i++)
102 101 if (cx->i2c_clients[i] == NULL)
... ... @@ -279,7 +278,7 @@
279 278  
280 279 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
281 280 if (hw_driverids[i] == id)
282   - return hw_drivernames[i];
  281 + return hw_devicenames[i];
283 282 return "unknown device";
284 283 }
285 284  
... ... @@ -290,7 +289,7 @@
290 289  
291 290 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
292 291 if (1 << i == hw)
293   - return hw_drivernames[i];
  292 + return hw_devicenames[i];
294 293 return "unknown device";
295 294 }
296 295  
drivers/media/video/cx25840/cx25840-core.c
... ... @@ -1284,11 +1284,18 @@
1284 1284 return 0;
1285 1285 }
1286 1286  
  1287 +static const struct i2c_device_id cx25840_id[] = {
  1288 + { "cx25840", 0 },
  1289 + { }
  1290 +};
  1291 +MODULE_DEVICE_TABLE(i2c, cx25840_id);
  1292 +
1287 1293 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
1288 1294 .name = "cx25840",
1289 1295 .driverid = I2C_DRIVERID_CX25840,
1290 1296 .command = cx25840_command,
1291 1297 .probe = cx25840_probe,
1292 1298 .remove = cx25840_remove,
  1299 + .id_table = cx25840_id,
1293 1300 };
drivers/media/video/ivtv/ivtv-i2c.c
... ... @@ -136,7 +136,7 @@
136 136 };
137 137  
138 138 /* This array should match the IVTV_HW_ defines */
139   -static const char * const hw_drivernames[] = {
  139 +static const char * const hw_devicenames[] = {
140 140 "cx25840",
141 141 "saa7115",
142 142 "saa7127",
... ... @@ -145,7 +145,7 @@
145 145 "wm8775",
146 146 "cs53l32a",
147 147 "tveeprom",
148   - "saa7115",
  148 + "saa7114",
149 149 "upd64031a",
150 150 "upd64083",
151 151 "saa717x",
... ... @@ -167,8 +167,7 @@
167 167 return -1;
168 168 id = hw_driverids[idx];
169 169 memset(&info, 0, sizeof(info));
170   - strlcpy(info.driver_name, hw_drivernames[idx],
171   - sizeof(info.driver_name));
  170 + strlcpy(info.type, hw_devicenames[idx], sizeof(info.type));
172 171 info.addr = hw_addrs[idx];
173 172 for (i = 0; itv->i2c_clients[i] && i < I2C_CLIENTS_MAX; i++) {}
174 173  
... ... @@ -657,7 +656,7 @@
657 656  
658 657 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
659 658 if (hw_driverids[i] == id)
660   - return hw_drivernames[i];
  659 + return hw_devicenames[i];
661 660 return "unknown device";
662 661 }
663 662  
... ... @@ -668,7 +667,7 @@
668 667  
669 668 for (i = 0; i < ARRAY_SIZE(hw_driverids); i++)
670 669 if (1 << i == hw)
671   - return hw_drivernames[i];
  670 + return hw_devicenames[i];
672 671 return "unknown device";
673 672 }
674 673  
... ... @@ -770,7 +769,7 @@
770 769 * same size and GPIO must be the last entry.
771 770 */
772 771 if (ARRAY_SIZE(hw_driverids) != ARRAY_SIZE(hw_addrs) ||
773   - ARRAY_SIZE(hw_drivernames) != ARRAY_SIZE(hw_addrs) ||
  772 + ARRAY_SIZE(hw_devicenames) != ARRAY_SIZE(hw_addrs) ||
774 773 IVTV_HW_GPIO != (1 << (ARRAY_SIZE(hw_addrs) - 1)) ||
775 774 hw_driverids[ARRAY_SIZE(hw_addrs) - 1]) {
776 775 IVTV_ERR("Mismatched I2C hardware arrays\n");
drivers/media/video/m52790.c
... ... @@ -135,8 +135,6 @@
135 135 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
136 136 return -EIO;
137 137  
138   - snprintf(client->name, sizeof(client->name) - 1, "m52790");
139   -
140 138 v4l_info(client, "chip found @ 0x%x (%s)\n",
141 139 client->addr << 1, client->adapter->name);
142 140  
143 141  
... ... @@ -159,11 +157,18 @@
159 157  
160 158 /* ----------------------------------------------------------------------- */
161 159  
  160 +static const struct i2c_device_id m52790_id[] = {
  161 + { "m52790", 0 },
  162 + { }
  163 +};
  164 +MODULE_DEVICE_TABLE(i2c, m52790_id);
  165 +
162 166 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
163 167 .name = "m52790",
164 168 .driverid = I2C_DRIVERID_M52790,
165 169 .command = m52790_command,
166 170 .probe = m52790_probe,
167 171 .remove = m52790_remove,
  172 + .id_table = m52790_id,
168 173 };
drivers/media/video/msp3400-driver.c
... ... @@ -815,7 +815,8 @@
815 815 int msp_product, msp_prod_hi, msp_prod_lo;
816 816 int msp_rom;
817 817  
818   - snprintf(client->name, sizeof(client->name) - 1, "msp3400");
  818 + if (!id)
  819 + strlcpy(client->name, "msp3400", sizeof(client->name));
819 820  
820 821 if (msp_reset(client) == -1) {
821 822 v4l_dbg(1, msp_debug, client, "msp3400 not found\n");
... ... @@ -864,9 +865,6 @@
864 865 msp_revision = (state->rev1 & 0x0f) + '@';
865 866 msp_hard = ((state->rev1 >> 8) & 0xff) + '@';
866 867 msp_rom = state->rev2 & 0x1f;
867   - snprintf(client->name, sizeof(client->name), "MSP%d4%02d%c-%c%d",
868   - msp_family, msp_product,
869   - msp_revision, msp_hard, msp_rom);
870 868 /* Rev B=2, C=3, D=4, G=7 */
871 869 state->ident = msp_family * 10000 + 4000 + msp_product * 10 +
872 870 msp_revision - '@';
... ... @@ -931,7 +929,9 @@
931 929 }
932 930  
933 931 /* hello world :-) */
934   - v4l_info(client, "%s found @ 0x%x (%s)\n", client->name,
  932 + v4l_info(client, "MSP%d4%02d%c-%c%d found @ 0x%x (%s)\n",
  933 + msp_family, msp_product,
  934 + msp_revision, msp_hard, msp_rom,
935 935 client->addr << 1, client->adapter->name);
936 936 v4l_info(client, "%s ", client->name);
937 937 if (state->has_nicam && state->has_radio)
... ... @@ -987,6 +987,12 @@
987 987  
988 988 /* ----------------------------------------------------------------------- */
989 989  
  990 +static const struct i2c_device_id msp_id[] = {
  991 + { "msp3400", 0 },
  992 + { }
  993 +};
  994 +MODULE_DEVICE_TABLE(i2c, msp_id);
  995 +
990 996 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
991 997 .name = "msp3400",
992 998 .driverid = I2C_DRIVERID_MSP3400,
... ... @@ -995,6 +1001,7 @@
995 1001 .remove = msp_remove,
996 1002 .suspend = msp_suspend,
997 1003 .resume = msp_resume,
  1004 + .id_table = msp_id,
998 1005 };
999 1006  
1000 1007  
drivers/media/video/saa7115.c
... ... @@ -1456,14 +1456,13 @@
1456 1456 struct saa711x_state *state;
1457 1457 int i;
1458 1458 char name[17];
1459   - u8 chip_id;
  1459 + char chip_id;
  1460 + int autodetect = !id || id->driver_data == 1;
1460 1461  
1461 1462 /* Check if the adapter supports the needed features */
1462 1463 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
1463 1464 return -EIO;
1464 1465  
1465   - snprintf(client->name, sizeof(client->name) - 1, "saa7115");
1466   -
1467 1466 for (i = 0; i < 0x0f; i++) {
1468 1467 saa711x_write(client, 0, i);
1469 1468 name[i] = (saa711x_read(client, 0) & 0x0f) + '0';
... ... @@ -1472,8 +1471,7 @@
1472 1471 }
1473 1472 name[i] = '\0';
1474 1473  
1475   - saa711x_write(client, 0, 5);
1476   - chip_id = saa711x_read(client, 0) & 0x0f;
  1474 + chip_id = name[5];
1477 1475  
1478 1476 /* Check whether this chip is part of the saa711x series */
1479 1477 if (memcmp(name, "1f711", 5)) {
... ... @@ -1482,8 +1480,14 @@
1482 1480 return -ENODEV;
1483 1481 }
1484 1482  
1485   - snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id);
1486   - v4l_info(client, "saa711%d found (%s) @ 0x%x (%s)\n", chip_id, name, client->addr << 1, client->adapter->name);
  1483 + /* Safety check */
  1484 + if (!autodetect && id->name[6] != chip_id) {
  1485 + v4l_warn(client, "found saa711%c while %s was expected\n",
  1486 + chip_id, id->name);
  1487 + }
  1488 + snprintf(client->name, sizeof(client->name), "saa711%c", chip_id);
  1489 + v4l_info(client, "saa711%c found (%s) @ 0x%x (%s)\n", chip_id, name,
  1490 + client->addr << 1, client->adapter->name);
1487 1491  
1488 1492 state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL);
1489 1493 i2c_set_clientdata(client, state);
1490 1494  
1491 1495  
1492 1496  
1493 1497  
... ... @@ -1499,19 +1503,19 @@
1499 1503 state->hue = 0;
1500 1504 state->sat = 64;
1501 1505 switch (chip_id) {
1502   - case 1:
  1506 + case '1':
1503 1507 state->ident = V4L2_IDENT_SAA7111;
1504 1508 break;
1505   - case 3:
  1509 + case '3':
1506 1510 state->ident = V4L2_IDENT_SAA7113;
1507 1511 break;
1508   - case 4:
  1512 + case '4':
1509 1513 state->ident = V4L2_IDENT_SAA7114;
1510 1514 break;
1511   - case 5:
  1515 + case '5':
1512 1516 state->ident = V4L2_IDENT_SAA7115;
1513 1517 break;
1514   - case 8:
  1518 + case '8':
1515 1519 state->ident = V4L2_IDENT_SAA7118;
1516 1520 break;
1517 1521 default:
... ... @@ -1553,6 +1557,17 @@
1553 1557 return 0;
1554 1558 }
1555 1559  
  1560 +static const struct i2c_device_id saa7115_id[] = {
  1561 + { "saa711x", 1 }, /* autodetect */
  1562 + { "saa7111", 0 },
  1563 + { "saa7113", 0 },
  1564 + { "saa7114", 0 },
  1565 + { "saa7115", 0 },
  1566 + { "saa7118", 0 },
  1567 + { }
  1568 +};
  1569 +MODULE_DEVICE_TABLE(i2c, saa7115_id);
  1570 +
1556 1571 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
1557 1572 .name = "saa7115",
1558 1573 .driverid = I2C_DRIVERID_SAA711X,
... ... @@ -1560,5 +1575,6 @@
1560 1575 .probe = saa7115_probe,
1561 1576 .remove = saa7115_remove,
1562 1577 .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL,
  1578 + .id_table = saa7115_id,
1563 1579 };
drivers/media/video/saa7127.c
... ... @@ -672,8 +672,6 @@
672 672 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
673 673 return -EIO;
674 674  
675   - snprintf(client->name, sizeof(client->name) - 1, "saa7127");
676   -
677 675 v4l_dbg(1, debug, client, "detecting saa7127 client on address 0x%x\n",
678 676 client->addr << 1);
679 677  
680 678  
... ... @@ -741,11 +739,18 @@
741 739  
742 740 /* ----------------------------------------------------------------------- */
743 741  
  742 +static struct i2c_device_id saa7127_id[] = {
  743 + { "saa7127", 0 },
  744 + { }
  745 +};
  746 +MODULE_DEVICE_TABLE(i2c, saa7127_id);
  747 +
744 748 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
745 749 .name = "saa7127",
746 750 .driverid = I2C_DRIVERID_SAA7127,
747 751 .command = saa7127_command,
748 752 .probe = saa7127_probe,
749 753 .remove = saa7127_remove,
  754 + .id_table = saa7127_id,
750 755 };
drivers/media/video/saa717x.c
... ... @@ -1429,8 +1429,6 @@
1429 1429 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
1430 1430 return -EIO;
1431 1431  
1432   - snprintf(client->name, sizeof(client->name) - 1, "saa717x");
1433   -
1434 1432 if (saa717x_write(client, 0x5a4, 0xfe) &&
1435 1433 saa717x_write(client, 0x5a5, 0x0f) &&
1436 1434 saa717x_write(client, 0x5a6, 0x00) &&
... ... @@ -1507,6 +1505,12 @@
1507 1505  
1508 1506 /* ----------------------------------------------------------------------- */
1509 1507  
  1508 +static const struct i2c_device_id saa717x_id[] = {
  1509 + { "saa717x", 0 },
  1510 + { }
  1511 +};
  1512 +MODULE_DEVICE_TABLE(i2c, saa717x_id);
  1513 +
1510 1514 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
1511 1515 .name = "saa717x",
1512 1516 .driverid = I2C_DRIVERID_SAA717X,
... ... @@ -1514,5 +1518,6 @@
1514 1518 .probe = saa717x_probe,
1515 1519 .remove = saa717x_remove,
1516 1520 .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL,
  1521 + .id_table = saa717x_id,
1517 1522 };
drivers/media/video/tuner-core.c
... ... @@ -1115,7 +1115,6 @@
1115 1115 if (NULL == t)
1116 1116 return -ENOMEM;
1117 1117 t->i2c = client;
1118   - strlcpy(client->name, "(tuner unset)", sizeof(client->name));
1119 1118 i2c_set_clientdata(client, t);
1120 1119 t->type = UNSET;
1121 1120 t->audmode = V4L2_TUNER_MODE_STEREO;
1122 1121  
... ... @@ -1273,11 +1272,26 @@
1273 1272  
1274 1273 list_del(&t->list);
1275 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);
1276 1281 return 0;
1277 1282 }
1278 1283  
1279 1284 /* ----------------------------------------------------------------------- */
1280 1285  
  1286 +/* This driver supports many devices and the idea is to let the driver
  1287 + detect which device is present. So rather than listing all supported
  1288 + devices here, we pretend to support a single, fake device type. */
  1289 +static const struct i2c_device_id tuner_id[] = {
  1290 + { "tuner", }, /* autodetect */
  1291 + { }
  1292 +};
  1293 +MODULE_DEVICE_TABLE(i2c, tuner_id);
  1294 +
1281 1295 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
1282 1296 .name = "tuner",
1283 1297 .driverid = I2C_DRIVERID_TUNER,
... ... @@ -1287,6 +1301,7 @@
1287 1301 .suspend = tuner_suspend,
1288 1302 .resume = tuner_resume,
1289 1303 .legacy_probe = tuner_legacy_probe,
  1304 + .id_table = tuner_id,
1290 1305 };
1291 1306  
1292 1307  
drivers/media/video/upd64031a.c
... ... @@ -228,6 +228,11 @@
228 228  
229 229 /* ----------------------------------------------------------------------- */
230 230  
  231 +static const struct i2c_device_id upd64031a_id[] = {
  232 + { "upd64031a", 0 },
  233 + { }
  234 +};
  235 +MODULE_DEVICE_TABLE(i2c, upd64031a_id);
231 236  
232 237 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
233 238 .name = "upd64031a",
... ... @@ -235,5 +240,6 @@
235 240 .command = upd64031a_command,
236 241 .probe = upd64031a_probe,
237 242 .remove = upd64031a_remove,
  243 + .id_table = upd64031a_id,
238 244 };
drivers/media/video/upd64083.c
... ... @@ -205,6 +205,11 @@
205 205  
206 206 /* ----------------------------------------------------------------------- */
207 207  
  208 +static const struct i2c_device_id upd64083_id[] = {
  209 + { "upd64083", 0 },
  210 + { }
  211 +};
  212 +MODULE_DEVICE_TABLE(i2c, upd64083_id);
208 213  
209 214 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
210 215 .name = "upd64083",
... ... @@ -212,5 +217,6 @@
212 217 .command = upd64083_command,
213 218 .probe = upd64083_probe,
214 219 .remove = upd64083_remove,
  220 + .id_table = upd64083_id,
215 221 };
drivers/media/video/vp27smpx.c
... ... @@ -130,8 +130,6 @@
130 130 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
131 131 return -EIO;
132 132  
133   - snprintf(client->name, sizeof(client->name) - 1, "vp27smpx");
134   -
135 133 v4l_info(client, "chip found @ 0x%x (%s)\n",
136 134 client->addr << 1, client->adapter->name);
137 135  
138 136  
... ... @@ -154,11 +152,18 @@
154 152  
155 153 /* ----------------------------------------------------------------------- */
156 154  
  155 +static const struct i2c_device_id vp27smpx_id[] = {
  156 + { "vp27smpx", 0 },
  157 + { }
  158 +};
  159 +MODULE_DEVICE_TABLE(i2c, vp27smpx_id);
  160 +
157 161 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
158 162 .name = "vp27smpx",
159 163 .driverid = I2C_DRIVERID_VP27SMPX,
160 164 .command = vp27smpx_command,
161 165 .probe = vp27smpx_probe,
162 166 .remove = vp27smpx_remove,
  167 + .id_table = vp27smpx_id,
163 168 };
drivers/media/video/wm8739.c
... ... @@ -313,11 +313,18 @@
313 313 return 0;
314 314 }
315 315  
  316 +static const struct i2c_device_id wm8739_id[] = {
  317 + { "wm8739", 0 },
  318 + { }
  319 +};
  320 +MODULE_DEVICE_TABLE(i2c, wm8739_id);
  321 +
316 322 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
317 323 .name = "wm8739",
318 324 .driverid = I2C_DRIVERID_WM8739,
319 325 .command = wm8739_command,
320 326 .probe = wm8739_probe,
321 327 .remove = wm8739_remove,
  328 + .id_table = wm8739_id,
322 329 };
drivers/media/video/wm8775.c
... ... @@ -216,11 +216,18 @@
216 216 return 0;
217 217 }
218 218  
  219 +static const struct i2c_device_id wm8775_id[] = {
  220 + { "wm8775", 0 },
  221 + { }
  222 +};
  223 +MODULE_DEVICE_TABLE(i2c, wm8775_id);
  224 +
219 225 static struct v4l2_i2c_driver_data v4l2_i2c_data = {
220 226 .name = "wm8775",
221 227 .driverid = I2C_DRIVERID_WM8775,
222 228 .command = wm8775_command,
223 229 .probe = wm8775_probe,
224 230 .remove = wm8775_remove,
  231 + .id_table = wm8775_id,
225 232 };
... ... @@ -155,8 +155,6 @@
155 155 * @driver: device's driver, hence pointer to access routines
156 156 * @dev: Driver model device node for the slave.
157 157 * @irq: indicates the IRQ generated by this device (if any)
158   - * @driver_name: Identifies new-style driver used with this device; also
159   - * used as the module name for hotplug/coldplug modprobe support.
160 158 * @list: list of active/busy clients (DEPRECATED)
161 159 * @released: used to synchronize client releases & detaches and references
162 160 *
... ... @@ -174,7 +172,6 @@
174 172 struct i2c_driver *driver; /* and our access routines */
175 173 struct device dev; /* the device structure */
176 174 int irq; /* irq issued by device (or -1) */
177   - char driver_name[KOBJ_NAME_LEN];
178 175 struct list_head list; /* DEPRECATED */
179 176 struct completion released;
180 177 };
... ... @@ -200,8 +197,7 @@
200 197  
201 198 /**
202 199 * struct i2c_board_info - template for device creation
203   - * @driver_name: identifies the driver to be bound to the device
204   - * @type: optional chip type information, to initialize i2c_client.name
  200 + * @type: chip type, to initialize i2c_client.name
205 201 * @flags: to initialize i2c_client.flags
206 202 * @addr: stored in i2c_client.addr
207 203 * @platform_data: stored in i2c_client.dev.platform_data
... ... @@ -220,7 +216,6 @@
220 216 * with the adapter already known.
221 217 */
222 218 struct i2c_board_info {
223   - char driver_name[KOBJ_NAME_LEN];
224 219 char type[I2C_NAME_SIZE];
225 220 unsigned short flags;
226 221 unsigned short addr;
include/linux/i2c/pcf857x.h
... ... @@ -12,8 +12,7 @@
12 12 * @context: optional parameter passed to setup() and teardown()
13 13 *
14 14 * In addition to the I2C_BOARD_INFO() state appropriate to each chip,
15   - * the i2c_board_info used with the pcf875x driver must provide the
16   - * chip "type" ("pcf8574", "pcf8574a", "pcf8575", "pcf8575c") and its
  15 + * the i2c_board_info used with the pcf875x driver must provide its
17 16 * platform_data (pointer to one of these structures) with at least
18 17 * the gpio_base value initialized.
19 18 *