diff options
74 files changed, 367 insertions, 325 deletions
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index bfb0a5520817..ee75cbace28d 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients | |||
@@ -164,7 +164,8 @@ I2C device drivers using this binding model work just like any other | |||
164 | kind of driver in Linux: they provide a probe() method to bind to | 164 | kind of driver in Linux: they provide a probe() method to bind to |
165 | those devices, and a remove() method to unbind. | 165 | those devices, and a remove() method to unbind. |
166 | 166 | ||
167 | static int foo_probe(struct i2c_client *client); | 167 | static int foo_probe(struct i2c_client *client, |
168 | const struct i2c_device_id *id); | ||
168 | static int foo_remove(struct i2c_client *client); | 169 | static int foo_remove(struct i2c_client *client); |
169 | 170 | ||
170 | Remember that the i2c_driver does not create those client handles. The | 171 | Remember that the i2c_driver does not create those client handles. The |
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c index 26fea4dcc3a0..81f1ebb4e964 100644 --- a/arch/arm/mach-at91/board-csb337.c +++ b/arch/arm/mach-at91/board-csb337.c | |||
@@ -79,8 +79,7 @@ static struct at91_udc_data __initdata csb337_udc_data = { | |||
79 | 79 | ||
80 | static struct i2c_board_info __initdata csb337_i2c_devices[] = { | 80 | static struct i2c_board_info __initdata csb337_i2c_devices[] = { |
81 | { | 81 | { |
82 | I2C_BOARD_INFO("rtc-ds1307", 0x68), | 82 | I2C_BOARD_INFO("ds1307", 0x68), |
83 | .type = "ds1307", | ||
84 | }, | 83 | }, |
85 | }; | 84 | }; |
86 | 85 | ||
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c index 0a897efeba8e..c1a813c7169b 100644 --- a/arch/arm/mach-at91/board-dk.c +++ b/arch/arm/mach-at91/board-dk.c | |||
@@ -132,8 +132,7 @@ static struct i2c_board_info __initdata dk_i2c_devices[] = { | |||
132 | I2C_BOARD_INFO("x9429", 0x28), | 132 | I2C_BOARD_INFO("x9429", 0x28), |
133 | }, | 133 | }, |
134 | { | 134 | { |
135 | I2C_BOARD_INFO("at24c", 0x50), | 135 | I2C_BOARD_INFO("24c1024", 0x50), |
136 | .type = "24c1024", | ||
137 | } | 136 | } |
138 | }; | 137 | }; |
139 | 138 | ||
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c index b7b79bb9d6c4..af1a1d8ecc30 100644 --- a/arch/arm/mach-at91/board-eb9200.c +++ b/arch/arm/mach-at91/board-eb9200.c | |||
@@ -93,8 +93,7 @@ static struct at91_mmc_data __initdata eb9200_mmc_data = { | |||
93 | 93 | ||
94 | static struct i2c_board_info __initdata eb9200_i2c_devices[] = { | 94 | static struct i2c_board_info __initdata eb9200_i2c_devices[] = { |
95 | { | 95 | { |
96 | I2C_BOARD_INFO("at24c", 0x50), | 96 | I2C_BOARD_INFO("24c512", 0x50), |
97 | .type = "24c512", | ||
98 | }, | 97 | }, |
99 | }; | 98 | }; |
100 | 99 | ||
diff --git a/arch/arm/mach-iop32x/em7210.c b/arch/arm/mach-iop32x/em7210.c index c947152f9a3c..4877597c8758 100644 --- a/arch/arm/mach-iop32x/em7210.c +++ b/arch/arm/mach-iop32x/em7210.c | |||
@@ -50,8 +50,7 @@ static struct sys_timer em7210_timer = { | |||
50 | */ | 50 | */ |
51 | static struct i2c_board_info __initdata em7210_i2c_devices[] = { | 51 | static struct i2c_board_info __initdata em7210_i2c_devices[] = { |
52 | { | 52 | { |
53 | I2C_BOARD_INFO("rtc-rs5c372", 0x32), | 53 | I2C_BOARD_INFO("rs5c372a", 0x32), |
54 | .type = "rs5c372a", | ||
55 | }, | 54 | }, |
56 | }; | 55 | }; |
57 | 56 | ||
diff --git a/arch/arm/mach-iop32x/glantank.c b/arch/arm/mach-iop32x/glantank.c index d2a7b04f1cb0..d4fca75ce542 100644 --- a/arch/arm/mach-iop32x/glantank.c +++ b/arch/arm/mach-iop32x/glantank.c | |||
@@ -176,12 +176,10 @@ static struct f75375s_platform_data glantank_f75375s = { | |||
176 | 176 | ||
177 | static struct i2c_board_info __initdata glantank_i2c_devices[] = { | 177 | static struct i2c_board_info __initdata glantank_i2c_devices[] = { |
178 | { | 178 | { |
179 | I2C_BOARD_INFO("rtc-rs5c372", 0x32), | 179 | I2C_BOARD_INFO("rs5c372a", 0x32), |
180 | .type = "rs5c372a", | ||
181 | }, | 180 | }, |
182 | { | 181 | { |
183 | I2C_BOARD_INFO("f75375", 0x2e), | 182 | I2C_BOARD_INFO("f75375", 0x2e), |
184 | .type = "f75375", | ||
185 | .platform_data = &glantank_f75375s, | 183 | .platform_data = &glantank_f75375s, |
186 | }, | 184 | }, |
187 | }; | 185 | }; |
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c index bc91d6e66bc4..2741063bf361 100644 --- a/arch/arm/mach-iop32x/n2100.c +++ b/arch/arm/mach-iop32x/n2100.c | |||
@@ -208,12 +208,10 @@ static struct f75375s_platform_data n2100_f75375s = { | |||
208 | 208 | ||
209 | static struct i2c_board_info __initdata n2100_i2c_devices[] = { | 209 | static struct i2c_board_info __initdata n2100_i2c_devices[] = { |
210 | { | 210 | { |
211 | I2C_BOARD_INFO("rtc-rs5c372", 0x32), | 211 | I2C_BOARD_INFO("rs5c372b", 0x32), |
212 | .type = "rs5c372b", | ||
213 | }, | 212 | }, |
214 | { | 213 | { |
215 | I2C_BOARD_INFO("f75375", 0x2e), | 214 | I2C_BOARD_INFO("f75375", 0x2e), |
216 | .type = "f75375", | ||
217 | .platform_data = &n2100_f75375s, | 215 | .platform_data = &n2100_f75375s, |
218 | }, | 216 | }, |
219 | }; | 217 | }; |
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c index 8cb07437a807..a51bfa6978b6 100644 --- a/arch/arm/mach-ixp4xx/dsmg600-setup.c +++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c | |||
@@ -65,7 +65,7 @@ static struct platform_device dsmg600_i2c_gpio = { | |||
65 | 65 | ||
66 | static struct i2c_board_info __initdata dsmg600_i2c_board_info [] = { | 66 | static struct i2c_board_info __initdata dsmg600_i2c_board_info [] = { |
67 | { | 67 | { |
68 | I2C_BOARD_INFO("rtc-pcf8563", 0x51), | 68 | I2C_BOARD_INFO("pcf8563", 0x51), |
69 | }, | 69 | }, |
70 | }; | 70 | }; |
71 | 71 | ||
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c index 159e1c4f1eda..84b5e62a9c0a 100644 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c | |||
@@ -54,7 +54,7 @@ static struct platform_device nas100d_flash = { | |||
54 | 54 | ||
55 | static struct i2c_board_info __initdata nas100d_i2c_board_info [] = { | 55 | static struct i2c_board_info __initdata nas100d_i2c_board_info [] = { |
56 | { | 56 | { |
57 | I2C_BOARD_INFO("rtc-pcf8563", 0x51), | 57 | I2C_BOARD_INFO("pcf8563", 0x51), |
58 | }, | 58 | }, |
59 | }; | 59 | }; |
60 | 60 | ||
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c index d9a182895a0f..a48a6655b887 100644 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c | |||
@@ -57,7 +57,7 @@ static struct i2c_gpio_platform_data nslu2_i2c_gpio_data = { | |||
57 | 57 | ||
58 | static struct i2c_board_info __initdata nslu2_i2c_board_info [] = { | 58 | static struct i2c_board_info __initdata nslu2_i2c_board_info [] = { |
59 | { | 59 | { |
60 | I2C_BOARD_INFO("rtc-x1205", 0x6f), | 60 | I2C_BOARD_INFO("x1205", 0x6f), |
61 | }, | 61 | }, |
62 | }; | 62 | }; |
63 | 63 | ||
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c index 507987720015..4b444fdaafea 100644 --- a/arch/arm/mach-omap1/board-h2.c +++ b/arch/arm/mach-omap1/board-h2.c | |||
@@ -351,11 +351,9 @@ static void __init h2_init_smc91x(void) | |||
351 | static struct i2c_board_info __initdata h2_i2c_board_info[] = { | 351 | static struct i2c_board_info __initdata h2_i2c_board_info[] = { |
352 | { | 352 | { |
353 | I2C_BOARD_INFO("tps65010", 0x48), | 353 | I2C_BOARD_INFO("tps65010", 0x48), |
354 | .type = "tps65010", | ||
355 | .irq = OMAP_GPIO_IRQ(58), | 354 | .irq = OMAP_GPIO_IRQ(58), |
356 | }, { | 355 | }, { |
357 | I2C_BOARD_INFO("isp1301_omap", 0x2d), | 356 | I2C_BOARD_INFO("isp1301_omap", 0x2d), |
358 | .type = "isp1301_omap", | ||
359 | .irq = OMAP_GPIO_IRQ(2), | 357 | .irq = OMAP_GPIO_IRQ(2), |
360 | }, | 358 | }, |
361 | }; | 359 | }; |
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c index c3ef1ee5f77b..7fbaa8d648cd 100644 --- a/arch/arm/mach-omap1/board-h3.c +++ b/arch/arm/mach-omap1/board-h3.c | |||
@@ -473,8 +473,7 @@ static struct omap_board_config_kernel h3_config[] __initdata = { | |||
473 | 473 | ||
474 | static struct i2c_board_info __initdata h3_i2c_board_info[] = { | 474 | static struct i2c_board_info __initdata h3_i2c_board_info[] = { |
475 | { | 475 | { |
476 | I2C_BOARD_INFO("tps65010", 0x48), | 476 | I2C_BOARD_INFO("tps65013", 0x48), |
477 | .type = "tps65013", | ||
478 | /* .irq = OMAP_GPIO_IRQ(??), */ | 477 | /* .irq = OMAP_GPIO_IRQ(??), */ |
479 | }, | 478 | }, |
480 | }; | 479 | }; |
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c index 4f9baba7d893..a66505f58b15 100644 --- a/arch/arm/mach-omap1/board-osk.c +++ b/arch/arm/mach-omap1/board-osk.c | |||
@@ -254,7 +254,6 @@ static struct tps65010_board tps_board = { | |||
254 | static struct i2c_board_info __initdata osk_i2c_board_info[] = { | 254 | static struct i2c_board_info __initdata osk_i2c_board_info[] = { |
255 | { | 255 | { |
256 | I2C_BOARD_INFO("tps65010", 0x48), | 256 | I2C_BOARD_INFO("tps65010", 0x48), |
257 | .type = "tps65010", | ||
258 | .irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)), | 257 | .irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)), |
259 | .platform_data = &tps_board, | 258 | .platform_data = &tps_board, |
260 | 259 | ||
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c index 872aed372327..ea3141e3e3c0 100644 --- a/arch/arm/mach-orion5x/db88f5281-setup.c +++ b/arch/arm/mach-orion5x/db88f5281-setup.c | |||
@@ -292,9 +292,7 @@ static struct mv643xx_eth_platform_data db88f5281_eth_data = { | |||
292 | * RTC DS1339 on I2C bus | 292 | * RTC DS1339 on I2C bus |
293 | ****************************************************************************/ | 293 | ****************************************************************************/ |
294 | static struct i2c_board_info __initdata db88f5281_i2c_rtc = { | 294 | static struct i2c_board_info __initdata db88f5281_i2c_rtc = { |
295 | .driver_name = "rtc-ds1307", | 295 | I2C_BOARD_INFO("ds1339", 0x68), |
296 | .type = "ds1339", | ||
297 | .addr = 0x68, | ||
298 | }; | 296 | }; |
299 | 297 | ||
300 | /***************************************************************************** | 298 | /***************************************************************************** |
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c index d67790ef236e..058a525c2ab6 100644 --- a/arch/arm/mach-orion5x/dns323-setup.c +++ b/arch/arm/mach-orion5x/dns323-setup.c | |||
@@ -220,19 +220,16 @@ static struct platform_device *dns323_plat_devices[] __initdata = { | |||
220 | static struct i2c_board_info __initdata dns323_i2c_devices[] = { | 220 | static struct i2c_board_info __initdata dns323_i2c_devices[] = { |
221 | { | 221 | { |
222 | I2C_BOARD_INFO("g760a", 0x3e), | 222 | I2C_BOARD_INFO("g760a", 0x3e), |
223 | .type = "g760a", | ||
224 | }, | 223 | }, |
225 | #if 0 | 224 | #if 0 |
226 | /* this entry requires the new-style driver model lm75 driver, | 225 | /* this entry requires the new-style driver model lm75 driver, |
227 | * for the meantime "insmod lm75.ko force_lm75=0,0x48" is needed */ | 226 | * for the meantime "insmod lm75.ko force_lm75=0,0x48" is needed */ |
228 | { | 227 | { |
229 | I2C_BOARD_INFO("lm75", 0x48), | 228 | I2C_BOARD_INFO("g751", 0x48), |
230 | .type = "g751", | ||
231 | }, | 229 | }, |
232 | #endif | 230 | #endif |
233 | { | 231 | { |
234 | I2C_BOARD_INFO("rtc-m41t80", 0x68), | 232 | I2C_BOARD_INFO("m41t80", 0x68), |
235 | .type = "m41t80", | ||
236 | } | 233 | } |
237 | }; | 234 | }; |
238 | 235 | ||
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c index 91413455beba..707db4be74a6 100644 --- a/arch/arm/mach-orion5x/kurobox_pro-setup.c +++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c | |||
@@ -162,9 +162,7 @@ static struct mv643xx_eth_platform_data kurobox_pro_eth_data = { | |||
162 | * RTC 5C372a on I2C bus | 162 | * RTC 5C372a on I2C bus |
163 | ****************************************************************************/ | 163 | ****************************************************************************/ |
164 | static struct i2c_board_info __initdata kurobox_pro_i2c_rtc = { | 164 | static struct i2c_board_info __initdata kurobox_pro_i2c_rtc = { |
165 | .driver_name = "rtc-rs5c372", | 165 | I2C_BOARD_INFO("rs5c372a", 0x32), |
166 | .type = "rs5c372a", | ||
167 | .addr = 0x32, | ||
168 | }; | 166 | }; |
169 | 167 | ||
170 | /***************************************************************************** | 168 | /***************************************************************************** |
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c index 37e8b2dc3ed5..7082fe8f83b1 100644 --- a/arch/arm/mach-orion5x/rd88f5182-setup.c +++ b/arch/arm/mach-orion5x/rd88f5182-setup.c | |||
@@ -224,9 +224,7 @@ static struct mv643xx_eth_platform_data rd88f5182_eth_data = { | |||
224 | * RTC DS1338 on I2C bus | 224 | * RTC DS1338 on I2C bus |
225 | ****************************************************************************/ | 225 | ****************************************************************************/ |
226 | static struct i2c_board_info __initdata rd88f5182_i2c_rtc = { | 226 | static struct i2c_board_info __initdata rd88f5182_i2c_rtc = { |
227 | .driver_name = "rtc-ds1307", | 227 | I2C_BOARD_INFO("ds1338", 0x68), |
228 | .type = "ds1338", | ||
229 | .addr = 0x68, | ||
230 | }; | 228 | }; |
231 | 229 | ||
232 | /***************************************************************************** | 230 | /***************************************************************************** |
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c index fd43863a86f6..6f93668b0ed5 100644 --- a/arch/arm/mach-orion5x/ts209-setup.c +++ b/arch/arm/mach-orion5x/ts209-setup.c | |||
@@ -276,8 +276,7 @@ static void __init ts209_find_mac_addr(void) | |||
276 | #define TS209_RTC_GPIO 3 | 276 | #define TS209_RTC_GPIO 3 |
277 | 277 | ||
278 | static struct i2c_board_info __initdata qnap_ts209_i2c_rtc = { | 278 | static struct i2c_board_info __initdata qnap_ts209_i2c_rtc = { |
279 | .driver_name = "rtc-s35390a", | 279 | I2C_BOARD_INFO("s35390a", 0x30), |
280 | .addr = 0x30, | ||
281 | .irq = 0, | 280 | .irq = 0, |
282 | }; | 281 | }; |
283 | 282 | ||
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c index e6be9d0aeccf..49d951db0f3d 100644 --- a/arch/arm/mach-pxa/pcm990-baseboard.c +++ b/arch/arm/mach-pxa/pcm990-baseboard.c | |||
@@ -320,16 +320,13 @@ static struct soc_camera_link iclink[] = { | |||
320 | static struct i2c_board_info __initdata pcm990_i2c_devices[] = { | 320 | static struct i2c_board_info __initdata pcm990_i2c_devices[] = { |
321 | { | 321 | { |
322 | /* Must initialize before the camera(s) */ | 322 | /* Must initialize before the camera(s) */ |
323 | I2C_BOARD_INFO("pca953x", 0x41), | 323 | I2C_BOARD_INFO("pca9536", 0x41), |
324 | .type = "pca9536", | ||
325 | .platform_data = &pca9536_data, | 324 | .platform_data = &pca9536_data, |
326 | }, { | 325 | }, { |
327 | I2C_BOARD_INFO("mt9v022", 0x48), | 326 | I2C_BOARD_INFO("mt9v022", 0x48), |
328 | .type = "mt9v022", | ||
329 | .platform_data = &iclink[0], /* With extender */ | 327 | .platform_data = &iclink[0], /* With extender */ |
330 | }, { | 328 | }, { |
331 | I2C_BOARD_INFO("mt9m001", 0x5d), | 329 | I2C_BOARD_INFO("mt9m001", 0x5d), |
332 | .type = "mt9m001", | ||
333 | .platform_data = &iclink[0], /* With extender */ | 330 | .platform_data = &iclink[0], /* With extender */ |
334 | }, | 331 | }, |
335 | }; | 332 | }; |
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c index fddce32901a2..024f418ae543 100644 --- a/arch/blackfin/mach-bf533/boards/stamp.c +++ b/arch/blackfin/mach-bf533/boards/stamp.c | |||
@@ -499,20 +499,17 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | |||
499 | #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) | 499 | #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) |
500 | { | 500 | { |
501 | I2C_BOARD_INFO("ad7142_joystick", 0x2C), | 501 | I2C_BOARD_INFO("ad7142_joystick", 0x2C), |
502 | .type = "ad7142_joystick", | ||
503 | .irq = 39, | 502 | .irq = 39, |
504 | }, | 503 | }, |
505 | #endif | 504 | #endif |
506 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) | 505 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) |
507 | { | 506 | { |
508 | I2C_BOARD_INFO("pcf8574_lcd", 0x22), | 507 | I2C_BOARD_INFO("pcf8574_lcd", 0x22), |
509 | .type = "pcf8574_lcd", | ||
510 | }, | 508 | }, |
511 | #endif | 509 | #endif |
512 | #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) | 510 | #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) |
513 | { | 511 | { |
514 | I2C_BOARD_INFO("pcf8574_keypad", 0x27), | 512 | I2C_BOARD_INFO("pcf8574_keypad", 0x27), |
515 | .type = "pcf8574_keypad", | ||
516 | .irq = 39, | 513 | .irq = 39, |
517 | }, | 514 | }, |
518 | #endif | 515 | #endif |
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c index 0cec14b1ef5c..d3727b7c2d7d 100644 --- a/arch/blackfin/mach-bf537/boards/stamp.c +++ b/arch/blackfin/mach-bf537/boards/stamp.c | |||
@@ -751,20 +751,17 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = { | |||
751 | #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) | 751 | #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE) |
752 | { | 752 | { |
753 | I2C_BOARD_INFO("ad7142_joystick", 0x2C), | 753 | I2C_BOARD_INFO("ad7142_joystick", 0x2C), |
754 | .type = "ad7142_joystick", | ||
755 | .irq = 55, | 754 | .irq = 55, |
756 | }, | 755 | }, |
757 | #endif | 756 | #endif |
758 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) | 757 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) |
759 | { | 758 | { |
760 | I2C_BOARD_INFO("pcf8574_lcd", 0x22), | 759 | I2C_BOARD_INFO("pcf8574_lcd", 0x22), |
761 | .type = "pcf8574_lcd", | ||
762 | }, | 760 | }, |
763 | #endif | 761 | #endif |
764 | #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) | 762 | #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) |
765 | { | 763 | { |
766 | I2C_BOARD_INFO("pcf8574_keypad", 0x27), | 764 | I2C_BOARD_INFO("pcf8574_keypad", 0x27), |
767 | .type = "pcf8574_keypad", | ||
768 | .irq = 72, | 765 | .irq = 72, |
769 | }, | 766 | }, |
770 | #endif | 767 | #endif |
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c index 231dfbd3bc1f..b00f68ac6bc9 100644 --- a/arch/blackfin/mach-bf548/boards/ezkit.c +++ b/arch/blackfin/mach-bf548/boards/ezkit.c | |||
@@ -641,13 +641,11 @@ static struct i2c_board_info __initdata bfin_i2c_board_info1[] = { | |||
641 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) | 641 | #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE) |
642 | { | 642 | { |
643 | I2C_BOARD_INFO("pcf8574_lcd", 0x22), | 643 | I2C_BOARD_INFO("pcf8574_lcd", 0x22), |
644 | .type = "pcf8574_lcd", | ||
645 | }, | 644 | }, |
646 | #endif | 645 | #endif |
647 | #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) | 646 | #if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE) |
648 | { | 647 | { |
649 | I2C_BOARD_INFO("pcf8574_keypad", 0x27), | 648 | I2C_BOARD_INFO("pcf8574_keypad", 0x27), |
650 | .type = "pcf8574_keypad", | ||
651 | .irq = 212, | 649 | .irq = 212, |
652 | }, | 650 | }, |
653 | #endif | 651 | #endif |
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 7b45670c7af3..324c01b70ddd 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -418,22 +418,21 @@ arch_initcall(gfar_of_init); | |||
418 | #include <linux/i2c.h> | 418 | #include <linux/i2c.h> |
419 | struct i2c_driver_device { | 419 | struct i2c_driver_device { |
420 | char *of_device; | 420 | char *of_device; |
421 | char *i2c_driver; | ||
422 | char *i2c_type; | 421 | char *i2c_type; |
423 | }; | 422 | }; |
424 | 423 | ||
425 | static struct i2c_driver_device i2c_devices[] __initdata = { | 424 | static struct i2c_driver_device i2c_devices[] __initdata = { |
426 | {"ricoh,rs5c372a", "rtc-rs5c372", "rs5c372a",}, | 425 | {"ricoh,rs5c372a", "rs5c372a"}, |
427 | {"ricoh,rs5c372b", "rtc-rs5c372", "rs5c372b",}, | 426 | {"ricoh,rs5c372b", "rs5c372b"}, |
428 | {"ricoh,rv5c386", "rtc-rs5c372", "rv5c386",}, | 427 | {"ricoh,rv5c386", "rv5c386"}, |
429 | {"ricoh,rv5c387a", "rtc-rs5c372", "rv5c387a",}, | 428 | {"ricoh,rv5c387a", "rv5c387a"}, |
430 | {"dallas,ds1307", "rtc-ds1307", "ds1307",}, | 429 | {"dallas,ds1307", "ds1307"}, |
431 | {"dallas,ds1337", "rtc-ds1307", "ds1337",}, | 430 | {"dallas,ds1337", "ds1337"}, |
432 | {"dallas,ds1338", "rtc-ds1307", "ds1338",}, | 431 | {"dallas,ds1338", "ds1338"}, |
433 | {"dallas,ds1339", "rtc-ds1307", "ds1339",}, | 432 | {"dallas,ds1339", "ds1339"}, |
434 | {"dallas,ds1340", "rtc-ds1307", "ds1340",}, | 433 | {"dallas,ds1340", "ds1340"}, |
435 | {"stm,m41t00", "rtc-ds1307", "m41t00"}, | 434 | {"stm,m41t00", "m41t00"}, |
436 | {"dallas,ds1374", "rtc-ds1374", "rtc-ds1374",}, | 435 | {"dallas,ds1374", "rtc-ds1374"}, |
437 | }; | 436 | }; |
438 | 437 | ||
439 | static int __init of_find_i2c_driver(struct device_node *node, | 438 | static int __init of_find_i2c_driver(struct device_node *node, |
@@ -444,9 +443,7 @@ static int __init of_find_i2c_driver(struct device_node *node, | |||
444 | for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) { | 443 | for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) { |
445 | if (!of_device_is_compatible(node, i2c_devices[i].of_device)) | 444 | if (!of_device_is_compatible(node, i2c_devices[i].of_device)) |
446 | continue; | 445 | continue; |
447 | if (strlcpy(info->driver_name, i2c_devices[i].i2c_driver, | 446 | if (strlcpy(info->type, i2c_devices[i].i2c_type, |
448 | KOBJ_NAME_LEN) >= KOBJ_NAME_LEN || | ||
449 | strlcpy(info->type, i2c_devices[i].i2c_type, | ||
450 | I2C_NAME_SIZE) >= I2C_NAME_SIZE) | 447 | I2C_NAME_SIZE) >= I2C_NAME_SIZE) |
451 | return -ENOMEM; | 448 | return -ENOMEM; |
452 | return 0; | 449 | return 0; |
diff --git a/arch/sh/boards/renesas/migor/setup.c b/arch/sh/boards/renesas/migor/setup.c index 00d52a20d8a5..e7c150d49702 100644 --- a/arch/sh/boards/renesas/migor/setup.c +++ b/arch/sh/boards/renesas/migor/setup.c | |||
@@ -199,8 +199,7 @@ static struct platform_device *migor_devices[] __initdata = { | |||
199 | 199 | ||
200 | static struct i2c_board_info __initdata migor_i2c_devices[] = { | 200 | static struct i2c_board_info __initdata migor_i2c_devices[] = { |
201 | { | 201 | { |
202 | I2C_BOARD_INFO("rtc-rs5c372", 0x32), | 202 | I2C_BOARD_INFO("rs5c372b", 0x32), |
203 | .type = "rs5c372b", | ||
204 | }, | 203 | }, |
205 | { | 204 | { |
206 | I2C_BOARD_INFO("migor_ts", 0x51), | 205 | I2C_BOARD_INFO("migor_ts", 0x51), |
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c index a5c5e9236501..ac0a96522e45 100644 --- a/arch/sh/boards/renesas/r7780rp/setup.c +++ b/arch/sh/boards/renesas/r7780rp/setup.c | |||
@@ -199,8 +199,7 @@ static struct platform_device smbus_device = { | |||
199 | 199 | ||
200 | static struct i2c_board_info __initdata highlander_i2c_devices[] = { | 200 | static struct i2c_board_info __initdata highlander_i2c_devices[] = { |
201 | { | 201 | { |
202 | I2C_BOARD_INFO("rtc-rs5c372", 0x32), | 202 | I2C_BOARD_INFO("r2025sd", 0x32), |
203 | .type = "r2025sd", | ||
204 | }, | 203 | }, |
205 | }; | 204 | }; |
206 | 205 | ||
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index e0e0af536108..5a99e81d2784 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -23,13 +23,7 @@ | |||
23 | #define PCA953X_INVERT 2 | 23 | #define PCA953X_INVERT 2 |
24 | #define PCA953X_DIRECTION 3 | 24 | #define PCA953X_DIRECTION 3 |
25 | 25 | ||
26 | /* This is temporary - in 2.6.26 i2c_driver_data should replace it. */ | 26 | static const struct i2c_device_id pca953x_id[] = { |
27 | struct pca953x_desc { | ||
28 | char name[I2C_NAME_SIZE]; | ||
29 | unsigned long driver_data; | ||
30 | }; | ||
31 | |||
32 | static const struct pca953x_desc pca953x_descs[] = { | ||
33 | { "pca9534", 8, }, | 27 | { "pca9534", 8, }, |
34 | { "pca9535", 16, }, | 28 | { "pca9535", 16, }, |
35 | { "pca9536", 4, }, | 29 | { "pca9536", 4, }, |
@@ -37,7 +31,9 @@ static const struct pca953x_desc pca953x_descs[] = { | |||
37 | { "pca9538", 8, }, | 31 | { "pca9538", 8, }, |
38 | { "pca9539", 16, }, | 32 | { "pca9539", 16, }, |
39 | /* REVISIT several pca955x parts should work here too */ | 33 | /* REVISIT several pca955x parts should work here too */ |
34 | { } | ||
40 | }; | 35 | }; |
36 | MODULE_DEVICE_TABLE(i2c, pca953x_id); | ||
41 | 37 | ||
42 | struct pca953x_chip { | 38 | struct pca953x_chip { |
43 | unsigned gpio_start; | 39 | unsigned gpio_start; |
@@ -192,26 +188,17 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios) | |||
192 | gc->owner = THIS_MODULE; | 188 | gc->owner = THIS_MODULE; |
193 | } | 189 | } |
194 | 190 | ||
195 | static int __devinit pca953x_probe(struct i2c_client *client) | 191 | static int __devinit pca953x_probe(struct i2c_client *client, |
192 | const struct i2c_device_id *id) | ||
196 | { | 193 | { |
197 | struct pca953x_platform_data *pdata; | 194 | struct pca953x_platform_data *pdata; |
198 | struct pca953x_chip *chip; | 195 | struct pca953x_chip *chip; |
199 | int ret, i; | 196 | int ret, i; |
200 | const struct pca953x_desc *id = NULL; | ||
201 | 197 | ||
202 | pdata = client->dev.platform_data; | 198 | pdata = client->dev.platform_data; |
203 | if (pdata == NULL) | 199 | if (pdata == NULL) |
204 | return -ENODEV; | 200 | return -ENODEV; |
205 | 201 | ||
206 | /* this loop vanishes when we get i2c_device_id */ | ||
207 | for (i = 0; i < ARRAY_SIZE(pca953x_descs); i++) | ||
208 | if (!strcmp(pca953x_descs[i].name, client->name)) { | ||
209 | id = pca953x_descs + i; | ||
210 | break; | ||
211 | } | ||
212 | if (!id) | ||
213 | return -ENODEV; | ||
214 | |||
215 | chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); | 202 | chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL); |
216 | if (chip == NULL) | 203 | if (chip == NULL) |
217 | return -ENOMEM; | 204 | return -ENOMEM; |
@@ -291,6 +278,7 @@ static struct i2c_driver pca953x_driver = { | |||
291 | }, | 278 | }, |
292 | .probe = pca953x_probe, | 279 | .probe = pca953x_probe, |
293 | .remove = pca953x_remove, | 280 | .remove = pca953x_remove, |
281 | .id_table = pca953x_id, | ||
294 | }; | 282 | }; |
295 | 283 | ||
296 | static int __init pca953x_init(void) | 284 | static int __init pca953x_init(void) |
diff --git a/drivers/gpio/pcf857x.c b/drivers/gpio/pcf857x.c index 1106aa15ac79..aa6cc8b2a2bc 100644 --- a/drivers/gpio/pcf857x.c +++ b/drivers/gpio/pcf857x.c | |||
@@ -26,6 +26,21 @@ | |||
26 | #include <asm/gpio.h> | 26 | #include <asm/gpio.h> |
27 | 27 | ||
28 | 28 | ||
29 | static const struct i2c_device_id pcf857x_id[] = { | ||
30 | { "pcf8574", 8 }, | ||
31 | { "pca8574", 8 }, | ||
32 | { "pca9670", 8 }, | ||
33 | { "pca9672", 8 }, | ||
34 | { "pca9674", 8 }, | ||
35 | { "pcf8575", 16 }, | ||
36 | { "pca8575", 16 }, | ||
37 | { "pca9671", 16 }, | ||
38 | { "pca9673", 16 }, | ||
39 | { "pca9675", 16 }, | ||
40 | { } | ||
41 | }; | ||
42 | MODULE_DEVICE_TABLE(i2c, pcf857x_id); | ||
43 | |||
29 | /* | 44 | /* |
30 | * The pcf857x, pca857x, and pca967x chips only expose one read and one | 45 | * The pcf857x, pca857x, and pca967x chips only expose one read and one |
31 | * write register. Writing a "one" bit (to match the reset state) lets | 46 | * write register. Writing a "one" bit (to match the reset state) lets |
@@ -142,7 +157,8 @@ static void pcf857x_set16(struct gpio_chip *chip, unsigned offset, int value) | |||
142 | 157 | ||
143 | /*-------------------------------------------------------------------------*/ | 158 | /*-------------------------------------------------------------------------*/ |
144 | 159 | ||
145 | static int pcf857x_probe(struct i2c_client *client) | 160 | static int pcf857x_probe(struct i2c_client *client, |
161 | const struct i2c_device_id *id) | ||
146 | { | 162 | { |
147 | struct pcf857x_platform_data *pdata; | 163 | struct pcf857x_platform_data *pdata; |
148 | struct pcf857x *gpio; | 164 | struct pcf857x *gpio; |
@@ -172,13 +188,8 @@ static int pcf857x_probe(struct i2c_client *client) | |||
172 | * | 188 | * |
173 | * NOTE: we don't distinguish here between *4 and *4a parts. | 189 | * NOTE: we don't distinguish here between *4 and *4a parts. |
174 | */ | 190 | */ |
175 | if (strcmp(client->name, "pcf8574") == 0 | 191 | gpio->chip.ngpio = id->driver_data; |
176 | || strcmp(client->name, "pca8574") == 0 | 192 | if (gpio->chip.ngpio == 8) { |
177 | || strcmp(client->name, "pca9670") == 0 | ||
178 | || strcmp(client->name, "pca9672") == 0 | ||
179 | || strcmp(client->name, "pca9674") == 0 | ||
180 | ) { | ||
181 | gpio->chip.ngpio = 8; | ||
182 | gpio->chip.direction_input = pcf857x_input8; | 193 | gpio->chip.direction_input = pcf857x_input8; |
183 | gpio->chip.get = pcf857x_get8; | 194 | gpio->chip.get = pcf857x_get8; |
184 | gpio->chip.direction_output = pcf857x_output8; | 195 | gpio->chip.direction_output = pcf857x_output8; |
@@ -198,13 +209,7 @@ static int pcf857x_probe(struct i2c_client *client) | |||
198 | * | 209 | * |
199 | * NOTE: we don't distinguish here between '75 and '75c parts. | 210 | * NOTE: we don't distinguish here between '75 and '75c parts. |
200 | */ | 211 | */ |
201 | } else if (strcmp(client->name, "pcf8575") == 0 | 212 | } else if (gpio->chip.ngpio == 16) { |
202 | || strcmp(client->name, "pca8575") == 0 | ||
203 | || strcmp(client->name, "pca9671") == 0 | ||
204 | || strcmp(client->name, "pca9673") == 0 | ||
205 | || strcmp(client->name, "pca9675") == 0 | ||
206 | ) { | ||
207 | gpio->chip.ngpio = 16; | ||
208 | gpio->chip.direction_input = pcf857x_input16; | 213 | gpio->chip.direction_input = pcf857x_input16; |
209 | gpio->chip.get = pcf857x_get16; | 214 | gpio->chip.get = pcf857x_get16; |
210 | gpio->chip.direction_output = pcf857x_output16; | 215 | gpio->chip.direction_output = pcf857x_output16; |
@@ -313,6 +318,7 @@ static struct i2c_driver pcf857x_driver = { | |||
313 | }, | 318 | }, |
314 | .probe = pcf857x_probe, | 319 | .probe = pcf857x_probe, |
315 | .remove = pcf857x_remove, | 320 | .remove = pcf857x_remove, |
321 | .id_table = pcf857x_id, | ||
316 | }; | 322 | }; |
317 | 323 | ||
318 | static int __init pcf857x_init(void) | 324 | static int __init pcf857x_init(void) |
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index 1464338e4e11..dc1f30e432ea 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c | |||
@@ -117,7 +117,8 @@ struct f75375_data { | |||
117 | static int f75375_attach_adapter(struct i2c_adapter *adapter); | 117 | static int f75375_attach_adapter(struct i2c_adapter *adapter); |
118 | static int f75375_detect(struct i2c_adapter *adapter, int address, int kind); | 118 | static int f75375_detect(struct i2c_adapter *adapter, int address, int kind); |
119 | static int f75375_detach_client(struct i2c_client *client); | 119 | static int f75375_detach_client(struct i2c_client *client); |
120 | static int f75375_probe(struct i2c_client *client); | 120 | static int f75375_probe(struct i2c_client *client, |
121 | const struct i2c_device_id *id); | ||
121 | static int f75375_remove(struct i2c_client *client); | 122 | static int f75375_remove(struct i2c_client *client); |
122 | 123 | ||
123 | static struct i2c_driver f75375_legacy_driver = { | 124 | static struct i2c_driver f75375_legacy_driver = { |
@@ -128,12 +129,20 @@ static struct i2c_driver f75375_legacy_driver = { | |||
128 | .detach_client = f75375_detach_client, | 129 | .detach_client = f75375_detach_client, |
129 | }; | 130 | }; |
130 | 131 | ||
132 | static const struct i2c_device_id f75375_id[] = { | ||
133 | { "f75373", f75373 }, | ||
134 | { "f75375", f75375 }, | ||
135 | { } | ||
136 | }; | ||
137 | MODULE_DEVICE_TABLE(i2c, f75375_id); | ||
138 | |||
131 | static struct i2c_driver f75375_driver = { | 139 | static struct i2c_driver f75375_driver = { |
132 | .driver = { | 140 | .driver = { |
133 | .name = "f75375", | 141 | .name = "f75375", |
134 | }, | 142 | }, |
135 | .probe = f75375_probe, | 143 | .probe = f75375_probe, |
136 | .remove = f75375_remove, | 144 | .remove = f75375_remove, |
145 | .id_table = f75375_id, | ||
137 | }; | 146 | }; |
138 | 147 | ||
139 | static inline int f75375_read8(struct i2c_client *client, u8 reg) | 148 | static inline int f75375_read8(struct i2c_client *client, u8 reg) |
@@ -628,7 +637,8 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data, | |||
628 | 637 | ||
629 | } | 638 | } |
630 | 639 | ||
631 | static int f75375_probe(struct i2c_client *client) | 640 | static int f75375_probe(struct i2c_client *client, |
641 | const struct i2c_device_id *id) | ||
632 | { | 642 | { |
633 | struct f75375_data *data = i2c_get_clientdata(client); | 643 | struct f75375_data *data = i2c_get_clientdata(client); |
634 | struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data; | 644 | struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data; |
@@ -643,15 +653,7 @@ static int f75375_probe(struct i2c_client *client) | |||
643 | i2c_set_clientdata(client, data); | 653 | i2c_set_clientdata(client, data); |
644 | data->client = client; | 654 | data->client = client; |
645 | mutex_init(&data->update_lock); | 655 | mutex_init(&data->update_lock); |
646 | 656 | data->kind = id->driver_data; | |
647 | if (strcmp(client->name, "f75375") == 0) | ||
648 | data->kind = f75375; | ||
649 | else if (strcmp(client->name, "f75373") == 0) | ||
650 | data->kind = f75373; | ||
651 | else { | ||
652 | dev_err(&client->dev, "Unsupported device: %s\n", client->name); | ||
653 | return -ENODEV; | ||
654 | } | ||
655 | 657 | ||
656 | if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group))) | 658 | if ((err = sysfs_create_group(&client->dev.kobj, &f75375_group))) |
657 | goto exit_free; | 659 | goto exit_free; |
@@ -712,6 +714,7 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind) | |||
712 | u8 version = 0; | 714 | u8 version = 0; |
713 | int err = 0; | 715 | int err = 0; |
714 | const char *name = ""; | 716 | const char *name = ""; |
717 | struct i2c_device_id id; | ||
715 | 718 | ||
716 | if (!(client = kzalloc(sizeof(*client), GFP_KERNEL))) { | 719 | if (!(client = kzalloc(sizeof(*client), GFP_KERNEL))) { |
717 | err = -ENOMEM; | 720 | err = -ENOMEM; |
@@ -748,7 +751,9 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind) | |||
748 | if ((err = i2c_attach_client(client))) | 751 | if ((err = i2c_attach_client(client))) |
749 | goto exit_free; | 752 | goto exit_free; |
750 | 753 | ||
751 | if ((err = f75375_probe(client)) < 0) | 754 | strlcpy(id.name, name, I2C_NAME_SIZE); |
755 | id.driver_data = kind; | ||
756 | if ((err = f75375_probe(client, &id)) < 0) | ||
752 | goto exit_detach; | 757 | goto exit_detach; |
753 | 758 | ||
754 | return 0; | 759 | return 0; |
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c index e5e96c817566..c38a0a112208 100644 --- a/drivers/i2c/busses/i2c-amd756-s4882.c +++ b/drivers/i2c/busses/i2c-amd756-s4882.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * i2c-amd756-s4882.c - i2c-amd756 extras for the Tyan S4882 motherboard | 2 | * i2c-amd756-s4882.c - i2c-amd756 extras for the Tyan S4882 motherboard |
3 | * | 3 | * |
4 | * Copyright (C) 2004 Jean Delvare <khali@linux-fr.org> | 4 | * Copyright (C) 2004, 2008 Jean Delvare <khali@linux-fr.org> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -231,7 +231,8 @@ ERROR2: | |||
231 | kfree(s4882_adapter); | 231 | kfree(s4882_adapter); |
232 | s4882_adapter = NULL; | 232 | s4882_adapter = NULL; |
233 | ERROR1: | 233 | ERROR1: |
234 | i2c_del_adapter(&amd756_smbus); | 234 | /* Restore physical bus */ |
235 | i2c_add_adapter(&amd756_smbus); | ||
235 | ERROR0: | 236 | ERROR0: |
236 | return error; | 237 | return error; |
237 | } | 238 | } |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 9bbe96cef719..fdc9ad805e35 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/ioport.h> | 38 | #include <linux/ioport.h> |
39 | #include <linux/i2c.h> | 39 | #include <linux/i2c.h> |
40 | #include <linux/init.h> | 40 | #include <linux/init.h> |
41 | #include <linux/apm_bios.h> | ||
42 | #include <linux/dmi.h> | 41 | #include <linux/dmi.h> |
43 | #include <asm/io.h> | 42 | #include <asm/io.h> |
44 | 43 | ||
@@ -223,7 +222,7 @@ static int piix4_transaction(void) | |||
223 | dev_err(&piix4_adapter.dev, "Failed! (%02x)\n", temp); | 222 | dev_err(&piix4_adapter.dev, "Failed! (%02x)\n", temp); |
224 | return -1; | 223 | return -1; |
225 | } else { | 224 | } else { |
226 | dev_dbg(&piix4_adapter.dev, "Successfull!\n"); | 225 | dev_dbg(&piix4_adapter.dev, "Successful!\n"); |
227 | } | 226 | } |
228 | } | 227 | } |
229 | 228 | ||
@@ -343,12 +342,7 @@ static s32 piix4_access(struct i2c_adapter * adap, u16 addr, | |||
343 | 342 | ||
344 | 343 | ||
345 | switch (size) { | 344 | switch (size) { |
346 | case PIIX4_BYTE: /* Where is the result put? I assume here it is in | 345 | case PIIX4_BYTE: |
347 | SMBHSTDAT0 but it might just as well be in the | ||
348 | SMBHSTCMD. No clue in the docs */ | ||
349 | |||
350 | data->byte = inb_p(SMBHSTDAT0); | ||
351 | break; | ||
352 | case PIIX4_BYTE_DATA: | 346 | case PIIX4_BYTE_DATA: |
353 | data->byte = inb_p(SMBHSTDAT0); | 347 | data->byte = inb_p(SMBHSTDAT0); |
354 | break; | 348 | break; |
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index 283769cecee2..9ca8f9155f95 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c | |||
@@ -238,7 +238,7 @@ static int sis5595_transaction(struct i2c_adapter *adap) | |||
238 | dev_dbg(&adap->dev, "Failed! (%02x)\n", temp); | 238 | dev_dbg(&adap->dev, "Failed! (%02x)\n", temp); |
239 | return -1; | 239 | return -1; |
240 | } else { | 240 | } else { |
241 | dev_dbg(&adap->dev, "Successfull!\n"); | 241 | dev_dbg(&adap->dev, "Successful!\n"); |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
@@ -316,14 +316,8 @@ static s32 sis5595_access(struct i2c_adapter *adap, u16 addr, | |||
316 | } | 316 | } |
317 | size = (size == I2C_SMBUS_PROC_CALL) ? SIS5595_PROC_CALL : SIS5595_WORD_DATA; | 317 | size = (size == I2C_SMBUS_PROC_CALL) ? SIS5595_PROC_CALL : SIS5595_WORD_DATA; |
318 | break; | 318 | break; |
319 | /* | ||
320 | case I2C_SMBUS_BLOCK_DATA: | ||
321 | printk(KERN_WARNING "sis5595.o: Block data not yet implemented!\n"); | ||
322 | return -1; | ||
323 | break; | ||
324 | */ | ||
325 | default: | 319 | default: |
326 | printk(KERN_WARNING "sis5595.o: Unsupported transaction %d\n", size); | 320 | dev_warn(&adap->dev, "Unsupported transaction %d\n", size); |
327 | return -1; | 321 | return -1; |
328 | } | 322 | } |
329 | 323 | ||
@@ -338,9 +332,7 @@ static s32 sis5595_access(struct i2c_adapter *adap, u16 addr, | |||
338 | 332 | ||
339 | 333 | ||
340 | switch (size) { | 334 | switch (size) { |
341 | case SIS5595_BYTE: /* Where is the result put? I assume here it is in | 335 | case SIS5595_BYTE: |
342 | SMB_DATA but it might just as well be in the | ||
343 | SMB_CMD. No clue in the docs */ | ||
344 | case SIS5595_BYTE_DATA: | 336 | case SIS5595_BYTE_DATA: |
345 | data->byte = sis5595_read(SMB_BYTE); | 337 | data->byte = sis5595_read(SMB_BYTE); |
346 | break; | 338 | break; |
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index 5fd734f99ee9..3765dd7f450f 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c | |||
@@ -136,7 +136,7 @@ static int sis630_transaction_start(struct i2c_adapter *adap, int size, u8 *oldc | |||
136 | dev_dbg(&adap->dev, "Failed! (%02x)\n", temp); | 136 | dev_dbg(&adap->dev, "Failed! (%02x)\n", temp); |
137 | return -1; | 137 | return -1; |
138 | } else { | 138 | } else { |
139 | dev_dbg(&adap->dev, "Successfull!\n"); | 139 | dev_dbg(&adap->dev, "Successful!\n"); |
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
diff --git a/drivers/i2c/busses/i2c-stub.c b/drivers/i2c/busses/i2c-stub.c index c2a9f8c94f5e..d08eeec53913 100644 --- a/drivers/i2c/busses/i2c-stub.c +++ b/drivers/i2c/busses/i2c-stub.c | |||
@@ -33,7 +33,7 @@ | |||
33 | static unsigned short chip_addr[MAX_CHIPS]; | 33 | static unsigned short chip_addr[MAX_CHIPS]; |
34 | module_param_array(chip_addr, ushort, NULL, S_IRUGO); | 34 | module_param_array(chip_addr, ushort, NULL, S_IRUGO); |
35 | MODULE_PARM_DESC(chip_addr, | 35 | MODULE_PARM_DESC(chip_addr, |
36 | "Chip addresses (up to 10, between 0x03 and 0x77)\n"); | 36 | "Chip addresses (up to 10, between 0x03 and 0x77)"); |
37 | 37 | ||
38 | struct stub_chip { | 38 | struct stub_chip { |
39 | u8 pointer; | 39 | u8 pointer; |
diff --git a/drivers/i2c/busses/i2c-taos-evm.c b/drivers/i2c/busses/i2c-taos-evm.c index 1b0cfd5472fd..de9db49e54d9 100644 --- a/drivers/i2c/busses/i2c-taos-evm.c +++ b/drivers/i2c/busses/i2c-taos-evm.c | |||
@@ -51,7 +51,6 @@ struct taos_data { | |||
51 | /* TAOS TSL2550 EVM */ | 51 | /* TAOS TSL2550 EVM */ |
52 | static struct i2c_board_info tsl2550_info = { | 52 | static struct i2c_board_info tsl2550_info = { |
53 | I2C_BOARD_INFO("tsl2550", 0x39), | 53 | I2C_BOARD_INFO("tsl2550", 0x39), |
54 | .type = "tsl2550", | ||
55 | }; | 54 | }; |
56 | 55 | ||
57 | /* Instantiate i2c devices based on the adapter name */ | 56 | /* Instantiate i2c devices based on the adapter name */ |
@@ -59,7 +58,7 @@ static struct i2c_client *taos_instantiate_device(struct i2c_adapter *adapter) | |||
59 | { | 58 | { |
60 | if (!strncmp(adapter->name, "TAOS TSL2550 EVM", 16)) { | 59 | if (!strncmp(adapter->name, "TAOS TSL2550 EVM", 16)) { |
61 | dev_info(&adapter->dev, "Instantiating device %s at 0x%02x\n", | 60 | dev_info(&adapter->dev, "Instantiating device %s at 0x%02x\n", |
62 | tsl2550_info.driver_name, tsl2550_info.addr); | 61 | tsl2550_info.type, tsl2550_info.addr); |
63 | return i2c_new_device(adapter, &tsl2550_info); | 62 | return i2c_new_device(adapter, &tsl2550_info); |
64 | } | 63 | } |
65 | 64 | ||
diff --git a/drivers/i2c/chips/ds1682.c b/drivers/i2c/chips/ds1682.c index 9e94542c18a2..23be4d42cb02 100644 --- a/drivers/i2c/chips/ds1682.c +++ b/drivers/i2c/chips/ds1682.c | |||
@@ -200,7 +200,8 @@ static struct bin_attribute ds1682_eeprom_attr = { | |||
200 | /* | 200 | /* |
201 | * Called when a ds1682 device is matched with this driver | 201 | * Called when a ds1682 device is matched with this driver |
202 | */ | 202 | */ |
203 | static int ds1682_probe(struct i2c_client *client) | 203 | static int ds1682_probe(struct i2c_client *client, |
204 | const struct i2c_device_id *id) | ||
204 | { | 205 | { |
205 | int rc; | 206 | int rc; |
206 | 207 | ||
@@ -234,12 +235,19 @@ static int ds1682_remove(struct i2c_client *client) | |||
234 | return 0; | 235 | return 0; |
235 | } | 236 | } |
236 | 237 | ||
238 | static const struct i2c_device_id ds1682_id[] = { | ||
239 | { "ds1682", 0 }, | ||
240 | { } | ||
241 | }; | ||
242 | MODULE_DEVICE_TABLE(i2c, ds1682_id); | ||
243 | |||
237 | static struct i2c_driver ds1682_driver = { | 244 | static struct i2c_driver ds1682_driver = { |
238 | .driver = { | 245 | .driver = { |
239 | .name = "ds1682", | 246 | .name = "ds1682", |
240 | }, | 247 | }, |
241 | .probe = ds1682_probe, | 248 | .probe = ds1682_probe, |
242 | .remove = ds1682_remove, | 249 | .remove = ds1682_remove, |
250 | .id_table = ds1682_id, | ||
243 | }; | 251 | }; |
244 | 252 | ||
245 | static int __init ds1682_init(void) | 253 | static int __init ds1682_init(void) |
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c index 2dea0123a958..b36db1797c11 100644 --- a/drivers/i2c/chips/menelaus.c +++ b/drivers/i2c/chips/menelaus.c | |||
@@ -1149,7 +1149,8 @@ static inline void menelaus_rtc_init(struct menelaus_chip *m) | |||
1149 | 1149 | ||
1150 | static struct i2c_driver menelaus_i2c_driver; | 1150 | static struct i2c_driver menelaus_i2c_driver; |
1151 | 1151 | ||
1152 | static int menelaus_probe(struct i2c_client *client) | 1152 | static int menelaus_probe(struct i2c_client *client, |
1153 | const struct i2c_device_id *id) | ||
1153 | { | 1154 | { |
1154 | struct menelaus_chip *menelaus; | 1155 | struct menelaus_chip *menelaus; |
1155 | int rev = 0, val; | 1156 | int rev = 0, val; |
@@ -1242,12 +1243,19 @@ static int __exit menelaus_remove(struct i2c_client *client) | |||
1242 | return 0; | 1243 | return 0; |
1243 | } | 1244 | } |
1244 | 1245 | ||
1246 | static const struct i2c_device_id menelaus_id[] = { | ||
1247 | { "menelaus", 0 }, | ||
1248 | { } | ||
1249 | }; | ||
1250 | MODULE_DEVICE_TABLE(i2c, menelaus_id); | ||
1251 | |||
1245 | static struct i2c_driver menelaus_i2c_driver = { | 1252 | static struct i2c_driver menelaus_i2c_driver = { |
1246 | .driver = { | 1253 | .driver = { |
1247 | .name = DRIVER_NAME, | 1254 | .name = DRIVER_NAME, |
1248 | }, | 1255 | }, |
1249 | .probe = menelaus_probe, | 1256 | .probe = menelaus_probe, |
1250 | .remove = __exit_p(menelaus_remove), | 1257 | .remove = __exit_p(menelaus_remove), |
1258 | .id_table = menelaus_id, | ||
1251 | }; | 1259 | }; |
1252 | 1260 | ||
1253 | static int __init menelaus_init(void) | 1261 | static int __init menelaus_init(void) |
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c index b67f69c2e7f3..85949685191b 100644 --- a/drivers/i2c/chips/tps65010.c +++ b/drivers/i2c/chips/tps65010.c | |||
@@ -64,7 +64,6 @@ static struct i2c_driver tps65010_driver; | |||
64 | * as part of board setup by a bootloader. | 64 | * as part of board setup by a bootloader. |
65 | */ | 65 | */ |
66 | enum tps_model { | 66 | enum tps_model { |
67 | TPS_UNKNOWN = 0, | ||
68 | TPS65010, | 67 | TPS65010, |
69 | TPS65011, | 68 | TPS65011, |
70 | TPS65012, | 69 | TPS65012, |
@@ -527,11 +526,13 @@ static int __exit tps65010_remove(struct i2c_client *client) | |||
527 | flush_scheduled_work(); | 526 | flush_scheduled_work(); |
528 | debugfs_remove(tps->file); | 527 | debugfs_remove(tps->file); |
529 | kfree(tps); | 528 | kfree(tps); |
529 | i2c_set_clientdata(client, NULL); | ||
530 | the_tps = NULL; | 530 | the_tps = NULL; |
531 | return 0; | 531 | return 0; |
532 | } | 532 | } |
533 | 533 | ||
534 | static int tps65010_probe(struct i2c_client *client) | 534 | static int tps65010_probe(struct i2c_client *client, |
535 | const struct i2c_device_id *id) | ||
535 | { | 536 | { |
536 | struct tps65010 *tps; | 537 | struct tps65010 *tps; |
537 | int status; | 538 | int status; |
@@ -552,20 +553,7 @@ static int tps65010_probe(struct i2c_client *client) | |||
552 | mutex_init(&tps->lock); | 553 | mutex_init(&tps->lock); |
553 | INIT_DELAYED_WORK(&tps->work, tps65010_work); | 554 | INIT_DELAYED_WORK(&tps->work, tps65010_work); |
554 | tps->client = client; | 555 | tps->client = client; |
555 | 556 | tps->model = id->driver_data; | |
556 | if (strcmp(client->name, "tps65010") == 0) | ||
557 | tps->model = TPS65010; | ||
558 | else if (strcmp(client->name, "tps65011") == 0) | ||
559 | tps->model = TPS65011; | ||
560 | else if (strcmp(client->name, "tps65012") == 0) | ||
561 | tps->model = TPS65012; | ||
562 | else if (strcmp(client->name, "tps65013") == 0) | ||
563 | tps->model = TPS65013; | ||
564 | else { | ||
565 | dev_warn(&client->dev, "unknown chip '%s'\n", client->name); | ||
566 | status = -ENODEV; | ||
567 | goto fail1; | ||
568 | } | ||
569 | 557 | ||
570 | /* the IRQ is active low, but many gpio lines can't support that | 558 | /* the IRQ is active low, but many gpio lines can't support that |
571 | * so this driver uses falling-edge triggers instead. | 559 | * so this driver uses falling-edge triggers instead. |
@@ -594,9 +582,6 @@ static int tps65010_probe(struct i2c_client *client) | |||
594 | case TPS65012: | 582 | case TPS65012: |
595 | tps->por = 1; | 583 | tps->por = 1; |
596 | break; | 584 | break; |
597 | case TPS_UNKNOWN: | ||
598 | printk(KERN_WARNING "%s: unknown TPS chip\n", DRIVER_NAME); | ||
599 | break; | ||
600 | /* else CHGCONFIG.POR is replaced by AUA, enabling a WAIT mode */ | 585 | /* else CHGCONFIG.POR is replaced by AUA, enabling a WAIT mode */ |
601 | } | 586 | } |
602 | tps->chgconf = i2c_smbus_read_byte_data(client, TPS_CHGCONFIG); | 587 | tps->chgconf = i2c_smbus_read_byte_data(client, TPS_CHGCONFIG); |
@@ -615,6 +600,7 @@ static int tps65010_probe(struct i2c_client *client) | |||
615 | i2c_smbus_read_byte_data(client, TPS_DEFGPIO), | 600 | i2c_smbus_read_byte_data(client, TPS_DEFGPIO), |
616 | i2c_smbus_read_byte_data(client, TPS_MASK3)); | 601 | i2c_smbus_read_byte_data(client, TPS_MASK3)); |
617 | 602 | ||
603 | i2c_set_clientdata(client, tps); | ||
618 | the_tps = tps; | 604 | the_tps = tps; |
619 | 605 | ||
620 | #if defined(CONFIG_USB_GADGET) && !defined(CONFIG_USB_OTG) | 606 | #if defined(CONFIG_USB_GADGET) && !defined(CONFIG_USB_OTG) |
@@ -682,12 +668,22 @@ fail1: | |||
682 | return status; | 668 | return status; |
683 | } | 669 | } |
684 | 670 | ||
671 | static const struct i2c_device_id tps65010_id[] = { | ||
672 | { "tps65010", TPS65010 }, | ||
673 | { "tps65011", TPS65011 }, | ||
674 | { "tps65012", TPS65012 }, | ||
675 | { "tps65013", TPS65013 }, | ||
676 | { } | ||
677 | }; | ||
678 | MODULE_DEVICE_TABLE(i2c, tps65010_id); | ||
679 | |||
685 | static struct i2c_driver tps65010_driver = { | 680 | static struct i2c_driver tps65010_driver = { |
686 | .driver = { | 681 | .driver = { |
687 | .name = "tps65010", | 682 | .name = "tps65010", |
688 | }, | 683 | }, |
689 | .probe = tps65010_probe, | 684 | .probe = tps65010_probe, |
690 | .remove = __exit_p(tps65010_remove), | 685 | .remove = __exit_p(tps65010_remove), |
686 | .id_table = tps65010_id, | ||
691 | }; | 687 | }; |
692 | 688 | ||
693 | /*-------------------------------------------------------------------------*/ | 689 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/i2c/chips/tsl2550.c b/drivers/i2c/chips/tsl2550.c index a10fd2791a69..1a9cc135219f 100644 --- a/drivers/i2c/chips/tsl2550.c +++ b/drivers/i2c/chips/tsl2550.c | |||
@@ -364,7 +364,8 @@ static int tsl2550_init_client(struct i2c_client *client) | |||
364 | */ | 364 | */ |
365 | 365 | ||
366 | static struct i2c_driver tsl2550_driver; | 366 | static struct i2c_driver tsl2550_driver; |
367 | static int __devinit tsl2550_probe(struct i2c_client *client) | 367 | static int __devinit tsl2550_probe(struct i2c_client *client, |
368 | const struct i2c_device_id *id) | ||
368 | { | 369 | { |
369 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 370 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
370 | struct tsl2550_data *data; | 371 | struct tsl2550_data *data; |
@@ -451,6 +452,12 @@ static int tsl2550_resume(struct i2c_client *client) | |||
451 | 452 | ||
452 | #endif /* CONFIG_PM */ | 453 | #endif /* CONFIG_PM */ |
453 | 454 | ||
455 | static const struct i2c_device_id tsl2550_id[] = { | ||
456 | { "tsl2550", 0 }, | ||
457 | { } | ||
458 | }; | ||
459 | MODULE_DEVICE_TABLE(i2c, tsl2550_id); | ||
460 | |||
454 | static struct i2c_driver tsl2550_driver = { | 461 | static struct i2c_driver tsl2550_driver = { |
455 | .driver = { | 462 | .driver = { |
456 | .name = TSL2550_DRV_NAME, | 463 | .name = TSL2550_DRV_NAME, |
@@ -460,6 +467,7 @@ static struct i2c_driver tsl2550_driver = { | |||
460 | .resume = tsl2550_resume, | 467 | .resume = tsl2550_resume, |
461 | .probe = tsl2550_probe, | 468 | .probe = tsl2550_probe, |
462 | .remove = __devexit_p(tsl2550_remove), | 469 | .remove = __devexit_p(tsl2550_remove), |
470 | .id_table = tsl2550_id, | ||
463 | }; | 471 | }; |
464 | 472 | ||
465 | static int __init tsl2550_init(void) | 473 | static int __init tsl2550_init(void) |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 6c7fa8d53c0e..26384daccb96 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -48,6 +48,17 @@ static DEFINE_IDR(i2c_adapter_idr); | |||
48 | 48 | ||
49 | /* ------------------------------------------------------------------------- */ | 49 | /* ------------------------------------------------------------------------- */ |
50 | 50 | ||
51 | static const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, | ||
52 | const struct i2c_client *client) | ||
53 | { | ||
54 | while (id->name[0]) { | ||
55 | if (strcmp(client->name, id->name) == 0) | ||
56 | return id; | ||
57 | id++; | ||
58 | } | ||
59 | return NULL; | ||
60 | } | ||
61 | |||
51 | static int i2c_device_match(struct device *dev, struct device_driver *drv) | 62 | static int i2c_device_match(struct device *dev, struct device_driver *drv) |
52 | { | 63 | { |
53 | struct i2c_client *client = to_i2c_client(dev); | 64 | struct i2c_client *client = to_i2c_client(dev); |
@@ -59,6 +70,10 @@ static int i2c_device_match(struct device *dev, struct device_driver *drv) | |||
59 | if (!is_newstyle_driver(driver)) | 70 | if (!is_newstyle_driver(driver)) |
60 | return 0; | 71 | return 0; |
61 | 72 | ||
73 | /* match on an id table if there is one */ | ||
74 | if (driver->id_table) | ||
75 | return i2c_match_id(driver->id_table, client) != NULL; | ||
76 | |||
62 | /* new style drivers use the same kind of driver matching policy | 77 | /* new style drivers use the same kind of driver matching policy |
63 | * as platform devices or SPI: compare device and driver IDs. | 78 | * as platform devices or SPI: compare device and driver IDs. |
64 | */ | 79 | */ |
@@ -73,11 +88,17 @@ static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
73 | struct i2c_client *client = to_i2c_client(dev); | 88 | struct i2c_client *client = to_i2c_client(dev); |
74 | 89 | ||
75 | /* by definition, legacy drivers can't hotplug */ | 90 | /* by definition, legacy drivers can't hotplug */ |
76 | if (dev->driver || !client->driver_name) | 91 | if (dev->driver) |
77 | return 0; | 92 | return 0; |
78 | 93 | ||
79 | if (add_uevent_var(env, "MODALIAS=%s", client->driver_name)) | 94 | if (client->driver_name[0]) { |
80 | return -ENOMEM; | 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 | } | ||
81 | dev_dbg(dev, "uevent\n"); | 102 | dev_dbg(dev, "uevent\n"); |
82 | return 0; | 103 | return 0; |
83 | } | 104 | } |
@@ -90,13 +111,19 @@ static int i2c_device_probe(struct device *dev) | |||
90 | { | 111 | { |
91 | struct i2c_client *client = to_i2c_client(dev); | 112 | struct i2c_client *client = to_i2c_client(dev); |
92 | struct i2c_driver *driver = to_i2c_driver(dev->driver); | 113 | struct i2c_driver *driver = to_i2c_driver(dev->driver); |
114 | const struct i2c_device_id *id; | ||
93 | int status; | 115 | int status; |
94 | 116 | ||
95 | if (!driver->probe) | 117 | if (!driver->probe) |
96 | return -ENODEV; | 118 | return -ENODEV; |
97 | client->driver = driver; | 119 | client->driver = driver; |
98 | dev_dbg(dev, "probe\n"); | 120 | dev_dbg(dev, "probe\n"); |
99 | status = driver->probe(client); | 121 | |
122 | if (driver->id_table) | ||
123 | id = i2c_match_id(driver->id_table, client); | ||
124 | else | ||
125 | id = NULL; | ||
126 | status = driver->probe(client, id); | ||
100 | if (status) | 127 | if (status) |
101 | client->driver = NULL; | 128 | client->driver = NULL; |
102 | return status; | 129 | return status; |
@@ -179,9 +206,9 @@ static ssize_t show_client_name(struct device *dev, struct device_attribute *att | |||
179 | static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf) | 206 | static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf) |
180 | { | 207 | { |
181 | struct i2c_client *client = to_i2c_client(dev); | 208 | struct i2c_client *client = to_i2c_client(dev); |
182 | return client->driver_name | 209 | return client->driver_name[0] |
183 | ? sprintf(buf, "%s\n", client->driver_name) | 210 | ? sprintf(buf, "%s\n", client->driver_name) |
184 | : 0; | 211 | : sprintf(buf, "%s%s\n", I2C_MODULE_PREFIX, client->name); |
185 | } | 212 | } |
186 | 213 | ||
187 | static struct device_attribute i2c_dev_attrs[] = { | 214 | static struct device_attribute i2c_dev_attrs[] = { |
@@ -300,15 +327,21 @@ void i2c_unregister_device(struct i2c_client *client) | |||
300 | EXPORT_SYMBOL_GPL(i2c_unregister_device); | 327 | EXPORT_SYMBOL_GPL(i2c_unregister_device); |
301 | 328 | ||
302 | 329 | ||
303 | static int dummy_nop(struct i2c_client *client) | 330 | static int dummy_probe(struct i2c_client *client, |
331 | const struct i2c_device_id *id) | ||
332 | { | ||
333 | return 0; | ||
334 | } | ||
335 | |||
336 | static int dummy_remove(struct i2c_client *client) | ||
304 | { | 337 | { |
305 | return 0; | 338 | return 0; |
306 | } | 339 | } |
307 | 340 | ||
308 | static struct i2c_driver dummy_driver = { | 341 | static struct i2c_driver dummy_driver = { |
309 | .driver.name = "dummy", | 342 | .driver.name = "dummy", |
310 | .probe = dummy_nop, | 343 | .probe = dummy_probe, |
311 | .remove = dummy_nop, | 344 | .remove = dummy_remove, |
312 | }; | 345 | }; |
313 | 346 | ||
314 | /** | 347 | /** |
diff --git a/drivers/media/video/cs5345.c b/drivers/media/video/cs5345.c index fae469ce16f5..2a429f9e32cd 100644 --- a/drivers/media/video/cs5345.c +++ b/drivers/media/video/cs5345.c | |||
@@ -142,7 +142,8 @@ static int cs5345_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
142 | 142 | ||
143 | /* ----------------------------------------------------------------------- */ | 143 | /* ----------------------------------------------------------------------- */ |
144 | 144 | ||
145 | static int cs5345_probe(struct i2c_client *client) | 145 | static int cs5345_probe(struct i2c_client *client, |
146 | const struct i2c_device_id *id) | ||
146 | { | 147 | { |
147 | /* Check if the adapter supports the needed features */ | 148 | /* Check if the adapter supports the needed features */ |
148 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | 149 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) |
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index f41bfde045fe..2dfd0afc62db 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c | |||
@@ -135,7 +135,8 @@ static int cs53l32a_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
135 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' | 135 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' |
136 | */ | 136 | */ |
137 | 137 | ||
138 | static int cs53l32a_probe(struct i2c_client *client) | 138 | static int cs53l32a_probe(struct i2c_client *client, |
139 | const struct i2c_device_id *id) | ||
139 | { | 140 | { |
140 | int i; | 141 | int i; |
141 | 142 | ||
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 7fde678b2c4a..88823810497c 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -1209,7 +1209,8 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
1209 | 1209 | ||
1210 | /* ----------------------------------------------------------------------- */ | 1210 | /* ----------------------------------------------------------------------- */ |
1211 | 1211 | ||
1212 | static int cx25840_probe(struct i2c_client *client) | 1212 | static int cx25840_probe(struct i2c_client *client, |
1213 | const struct i2c_device_id *did) | ||
1213 | { | 1214 | { |
1214 | struct cx25840_state *state; | 1215 | struct cx25840_state *state; |
1215 | u32 id; | 1216 | u32 id; |
diff --git a/drivers/media/video/m52790.c b/drivers/media/video/m52790.c index d4bf14c284ef..5b9dfa2c51b4 100644 --- a/drivers/media/video/m52790.c +++ b/drivers/media/video/m52790.c | |||
@@ -126,7 +126,8 @@ static int m52790_command(struct i2c_client *client, unsigned int cmd, | |||
126 | 126 | ||
127 | /* i2c implementation */ | 127 | /* i2c implementation */ |
128 | 128 | ||
129 | static int m52790_probe(struct i2c_client *client) | 129 | static int m52790_probe(struct i2c_client *client, |
130 | const struct i2c_device_id *id) | ||
130 | { | 131 | { |
131 | struct m52790_state *state; | 132 | struct m52790_state *state; |
132 | 133 | ||
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index b73c740f7fb2..e6273162e123 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -805,7 +805,7 @@ static int msp_resume(struct i2c_client *client) | |||
805 | 805 | ||
806 | /* ----------------------------------------------------------------------- */ | 806 | /* ----------------------------------------------------------------------- */ |
807 | 807 | ||
808 | static int msp_probe(struct i2c_client *client) | 808 | static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id) |
809 | { | 809 | { |
810 | struct msp_state *state; | 810 | struct msp_state *state; |
811 | int (*thread_func)(void *data) = NULL; | 811 | int (*thread_func)(void *data) = NULL; |
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c index 3fb5f63df1e6..ba09826ddf48 100644 --- a/drivers/media/video/mt9m001.c +++ b/drivers/media/video/mt9m001.c | |||
@@ -620,7 +620,8 @@ static void mt9m001_video_remove(struct soc_camera_device *icd) | |||
620 | soc_camera_video_stop(&mt9m001->icd); | 620 | soc_camera_video_stop(&mt9m001->icd); |
621 | } | 621 | } |
622 | 622 | ||
623 | static int mt9m001_probe(struct i2c_client *client) | 623 | static int mt9m001_probe(struct i2c_client *client, |
624 | const struct i2c_device_id *did) | ||
624 | { | 625 | { |
625 | struct mt9m001 *mt9m001; | 626 | struct mt9m001 *mt9m001; |
626 | struct soc_camera_device *icd; | 627 | struct soc_camera_device *icd; |
@@ -696,12 +697,19 @@ static int mt9m001_remove(struct i2c_client *client) | |||
696 | return 0; | 697 | return 0; |
697 | } | 698 | } |
698 | 699 | ||
700 | static const struct i2c_device_id mt9m001_id[] = { | ||
701 | { "mt9m001", 0 }, | ||
702 | { } | ||
703 | }; | ||
704 | MODULE_DEVICE_TABLE(i2c, mt9m001_id); | ||
705 | |||
699 | static struct i2c_driver mt9m001_i2c_driver = { | 706 | static struct i2c_driver mt9m001_i2c_driver = { |
700 | .driver = { | 707 | .driver = { |
701 | .name = "mt9m001", | 708 | .name = "mt9m001", |
702 | }, | 709 | }, |
703 | .probe = mt9m001_probe, | 710 | .probe = mt9m001_probe, |
704 | .remove = mt9m001_remove, | 711 | .remove = mt9m001_remove, |
712 | .id_table = mt9m001_id, | ||
705 | }; | 713 | }; |
706 | 714 | ||
707 | static int __init mt9m001_mod_init(void) | 715 | static int __init mt9m001_mod_init(void) |
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c index d4b9e2744343..7b223691ce96 100644 --- a/drivers/media/video/mt9v022.c +++ b/drivers/media/video/mt9v022.c | |||
@@ -745,7 +745,8 @@ static void mt9v022_video_remove(struct soc_camera_device *icd) | |||
745 | soc_camera_video_stop(&mt9v022->icd); | 745 | soc_camera_video_stop(&mt9v022->icd); |
746 | } | 746 | } |
747 | 747 | ||
748 | static int mt9v022_probe(struct i2c_client *client) | 748 | static int mt9v022_probe(struct i2c_client *client, |
749 | const struct i2c_device_id *did) | ||
749 | { | 750 | { |
750 | struct mt9v022 *mt9v022; | 751 | struct mt9v022 *mt9v022; |
751 | struct soc_camera_device *icd; | 752 | struct soc_camera_device *icd; |
@@ -818,12 +819,19 @@ static int mt9v022_remove(struct i2c_client *client) | |||
818 | return 0; | 819 | return 0; |
819 | } | 820 | } |
820 | 821 | ||
822 | static const struct i2c_device_id mt9v022_id[] = { | ||
823 | { "mt9v022", 0 }, | ||
824 | { } | ||
825 | }; | ||
826 | MODULE_DEVICE_TABLE(i2c, mt9v022_id); | ||
827 | |||
821 | static struct i2c_driver mt9v022_i2c_driver = { | 828 | static struct i2c_driver mt9v022_i2c_driver = { |
822 | .driver = { | 829 | .driver = { |
823 | .name = "mt9v022", | 830 | .name = "mt9v022", |
824 | }, | 831 | }, |
825 | .probe = mt9v022_probe, | 832 | .probe = mt9v022_probe, |
826 | .remove = mt9v022_remove, | 833 | .remove = mt9v022_remove, |
834 | .id_table = mt9v022_id, | ||
827 | }; | 835 | }; |
828 | 836 | ||
829 | static int __init mt9v022_mod_init(void) | 837 | static int __init mt9v022_mod_init(void) |
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index 416d05d4a969..e684108637ad 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -1450,7 +1450,8 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1450 | 1450 | ||
1451 | /* ----------------------------------------------------------------------- */ | 1451 | /* ----------------------------------------------------------------------- */ |
1452 | 1452 | ||
1453 | static int saa7115_probe(struct i2c_client *client) | 1453 | static int saa7115_probe(struct i2c_client *client, |
1454 | const struct i2c_device_id *id) | ||
1454 | { | 1455 | { |
1455 | struct saa711x_state *state; | 1456 | struct saa711x_state *state; |
1456 | int i; | 1457 | int i; |
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index 06c88db656b4..e750cd65c1c3 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c | |||
@@ -661,7 +661,8 @@ static int saa7127_command(struct i2c_client *client, | |||
661 | 661 | ||
662 | /* ----------------------------------------------------------------------- */ | 662 | /* ----------------------------------------------------------------------- */ |
663 | 663 | ||
664 | static int saa7127_probe(struct i2c_client *client) | 664 | static int saa7127_probe(struct i2c_client *client, |
665 | const struct i2c_device_id *id) | ||
665 | { | 666 | { |
666 | struct saa7127_state *state; | 667 | struct saa7127_state *state; |
667 | struct v4l2_sliced_vbi_data vbi = { 0, 0, 0, 0 }; /* set to disabled */ | 668 | struct v4l2_sliced_vbi_data vbi = { 0, 0, 0, 0 }; /* set to disabled */ |
diff --git a/drivers/media/video/saa717x.c b/drivers/media/video/saa717x.c index 53c5edbcf7ea..72c4081feff5 100644 --- a/drivers/media/video/saa717x.c +++ b/drivers/media/video/saa717x.c | |||
@@ -1418,7 +1418,8 @@ static int saa717x_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
1418 | /* i2c implementation */ | 1418 | /* i2c implementation */ |
1419 | 1419 | ||
1420 | /* ----------------------------------------------------------------------- */ | 1420 | /* ----------------------------------------------------------------------- */ |
1421 | static int saa717x_probe(struct i2c_client *client) | 1421 | static int saa717x_probe(struct i2c_client *client, |
1422 | const struct i2c_device_id *did) | ||
1422 | { | 1423 | { |
1423 | struct saa717x_state *decoder; | 1424 | struct saa717x_state *decoder; |
1424 | u8 id = 0; | 1425 | u8 id = 0; |
diff --git a/drivers/media/video/tcm825x.c b/drivers/media/video/tcm825x.c index 6943b447a1bd..e57a64605778 100644 --- a/drivers/media/video/tcm825x.c +++ b/drivers/media/video/tcm825x.c | |||
@@ -840,7 +840,8 @@ static struct v4l2_int_device tcm825x_int_device = { | |||
840 | }, | 840 | }, |
841 | }; | 841 | }; |
842 | 842 | ||
843 | static int tcm825x_probe(struct i2c_client *client) | 843 | static int tcm825x_probe(struct i2c_client *client, |
844 | const struct i2c_device_id *did) | ||
844 | { | 845 | { |
845 | struct tcm825x_sensor *sensor = &tcm825x; | 846 | struct tcm825x_sensor *sensor = &tcm825x; |
846 | int rval; | 847 | int rval; |
diff --git a/drivers/media/video/tlv320aic23b.c b/drivers/media/video/tlv320aic23b.c index dc7b9c220b90..f1db54202dea 100644 --- a/drivers/media/video/tlv320aic23b.c +++ b/drivers/media/video/tlv320aic23b.c | |||
@@ -125,7 +125,8 @@ static int tlv320aic23b_command(struct i2c_client *client, | |||
125 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' | 125 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' |
126 | */ | 126 | */ |
127 | 127 | ||
128 | static int tlv320aic23b_probe(struct i2c_client *client) | 128 | static int tlv320aic23b_probe(struct i2c_client *client, |
129 | const struct i2c_device_id *id) | ||
129 | { | 130 | { |
130 | struct tlv320aic23b_state *state; | 131 | struct tlv320aic23b_state *state; |
131 | 132 | ||
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 2b72e10e6b9f..2a2748238c78 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -1073,7 +1073,8 @@ static void tuner_lookup(struct i2c_adapter *adap, | |||
1073 | /* During client attach, set_type is called by adapter's attach_inform callback. | 1073 | /* During client attach, set_type is called by adapter's attach_inform callback. |
1074 | set_type must then be completed by tuner_probe. | 1074 | set_type must then be completed by tuner_probe. |
1075 | */ | 1075 | */ |
1076 | static int tuner_probe(struct i2c_client *client) | 1076 | static int tuner_probe(struct i2c_client *client, |
1077 | const struct i2c_device_id *id) | ||
1077 | { | 1078 | { |
1078 | struct tuner *t; | 1079 | struct tuner *t; |
1079 | struct tuner *radio; | 1080 | struct tuner *radio; |
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index f29a2cd0f2f2..6f9945b04e1f 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
@@ -1461,7 +1461,7 @@ static struct CHIPDESC chiplist[] = { | |||
1461 | /* ---------------------------------------------------------------------- */ | 1461 | /* ---------------------------------------------------------------------- */ |
1462 | /* i2c registration */ | 1462 | /* i2c registration */ |
1463 | 1463 | ||
1464 | static int chip_probe(struct i2c_client *client) | 1464 | static int chip_probe(struct i2c_client *client, const struct i2c_device_id *id) |
1465 | { | 1465 | { |
1466 | struct CHIPSTATE *chip; | 1466 | struct CHIPSTATE *chip; |
1467 | struct CHIPDESC *desc; | 1467 | struct CHIPDESC *desc; |
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c index bd201397a2ac..93bfd19dec7d 100644 --- a/drivers/media/video/upd64031a.c +++ b/drivers/media/video/upd64031a.c | |||
@@ -195,7 +195,8 @@ static int upd64031a_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
195 | 195 | ||
196 | /* i2c implementation */ | 196 | /* i2c implementation */ |
197 | 197 | ||
198 | static int upd64031a_probe(struct i2c_client *client) | 198 | static int upd64031a_probe(struct i2c_client *client, |
199 | const struct i2c_device_id *id) | ||
199 | { | 200 | { |
200 | struct upd64031a_state *state; | 201 | struct upd64031a_state *state; |
201 | int i; | 202 | int i; |
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c index 2d9a88f70c85..9ab712a56ce0 100644 --- a/drivers/media/video/upd64083.c +++ b/drivers/media/video/upd64083.c | |||
@@ -172,7 +172,8 @@ static int upd64083_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
172 | 172 | ||
173 | /* i2c implementation */ | 173 | /* i2c implementation */ |
174 | 174 | ||
175 | static int upd64083_probe(struct i2c_client *client) | 175 | static int upd64083_probe(struct i2c_client *client, |
176 | const struct i2c_device_id *id) | ||
176 | { | 177 | { |
177 | struct upd64083_state *state; | 178 | struct upd64083_state *state; |
178 | int i; | 179 | int i; |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 7cc42c1da457..e9dd996fd5df 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -710,7 +710,8 @@ EXPORT_SYMBOL(v4l2_chip_ident_i2c_client); | |||
710 | /* Helper function for I2C legacy drivers */ | 710 | /* Helper function for I2C legacy drivers */ |
711 | 711 | ||
712 | int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver, | 712 | int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver, |
713 | const char *name, int (*probe)(struct i2c_client *)) | 713 | const char *name, |
714 | int (*probe)(struct i2c_client *, const struct i2c_device_id *)) | ||
714 | { | 715 | { |
715 | struct i2c_client *client; | 716 | struct i2c_client *client; |
716 | int err; | 717 | int err; |
@@ -724,7 +725,7 @@ int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver | |||
724 | client->driver = driver; | 725 | client->driver = driver; |
725 | strlcpy(client->name, name, sizeof(client->name)); | 726 | strlcpy(client->name, name, sizeof(client->name)); |
726 | 727 | ||
727 | err = probe(client); | 728 | err = probe(client, NULL); |
728 | if (err == 0) { | 729 | if (err == 0) { |
729 | i2c_attach_client(client); | 730 | i2c_attach_client(client); |
730 | } else { | 731 | } else { |
diff --git a/drivers/media/video/vp27smpx.c b/drivers/media/video/vp27smpx.c index 282c81403c97..fac0deba24af 100644 --- a/drivers/media/video/vp27smpx.c +++ b/drivers/media/video/vp27smpx.c | |||
@@ -121,7 +121,8 @@ static int vp27smpx_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
121 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' | 121 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' |
122 | */ | 122 | */ |
123 | 123 | ||
124 | static int vp27smpx_probe(struct i2c_client *client) | 124 | static int vp27smpx_probe(struct i2c_client *client, |
125 | const struct i2c_device_id *id) | ||
125 | { | 126 | { |
126 | struct vp27smpx_state *state; | 127 | struct vp27smpx_state *state; |
127 | 128 | ||
diff --git a/drivers/media/video/wm8739.c b/drivers/media/video/wm8739.c index 31795b4f8b63..0f8ed8461fba 100644 --- a/drivers/media/video/wm8739.c +++ b/drivers/media/video/wm8739.c | |||
@@ -261,7 +261,8 @@ static int wm8739_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
261 | 261 | ||
262 | /* i2c implementation */ | 262 | /* i2c implementation */ |
263 | 263 | ||
264 | static int wm8739_probe(struct i2c_client *client) | 264 | static int wm8739_probe(struct i2c_client *client, |
265 | const struct i2c_device_id *id) | ||
265 | { | 266 | { |
266 | struct wm8739_state *state; | 267 | struct wm8739_state *state; |
267 | 268 | ||
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 869f9e7946b6..67a409e60c46 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c | |||
@@ -159,7 +159,8 @@ static int wm8775_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
159 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' | 159 | * concerning the addresses: i2c wants 7 bit (without the r/w bit), so '>>1' |
160 | */ | 160 | */ |
161 | 161 | ||
162 | static int wm8775_probe(struct i2c_client *client) | 162 | static int wm8775_probe(struct i2c_client *client, |
163 | const struct i2c_device_id *id) | ||
163 | { | 164 | { |
164 | struct wm8775_state *state; | 165 | struct wm8775_state *state; |
165 | 166 | ||
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index f389a28720d2..bbf97e65202a 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c | |||
@@ -99,45 +99,38 @@ struct ds1307 { | |||
99 | }; | 99 | }; |
100 | 100 | ||
101 | struct chip_desc { | 101 | struct chip_desc { |
102 | char name[9]; | ||
103 | unsigned nvram56:1; | 102 | unsigned nvram56:1; |
104 | unsigned alarm:1; | 103 | unsigned alarm:1; |
105 | enum ds_type type; | ||
106 | }; | 104 | }; |
107 | 105 | ||
108 | static const struct chip_desc chips[] = { { | 106 | static const struct chip_desc chips[] = { |
109 | .name = "ds1307", | 107 | [ds_1307] = { |
110 | .type = ds_1307, | ||
111 | .nvram56 = 1, | 108 | .nvram56 = 1, |
112 | }, { | 109 | }, |
113 | .name = "ds1337", | 110 | [ds_1337] = { |
114 | .type = ds_1337, | ||
115 | .alarm = 1, | 111 | .alarm = 1, |
116 | }, { | 112 | }, |
117 | .name = "ds1338", | 113 | [ds_1338] = { |
118 | .type = ds_1338, | ||
119 | .nvram56 = 1, | 114 | .nvram56 = 1, |
120 | }, { | 115 | }, |
121 | .name = "ds1339", | 116 | [ds_1339] = { |
122 | .type = ds_1339, | ||
123 | .alarm = 1, | 117 | .alarm = 1, |
124 | }, { | 118 | }, |
125 | .name = "ds1340", | 119 | [ds_1340] = { |
126 | .type = ds_1340, | 120 | }, |
127 | }, { | 121 | [m41t00] = { |
128 | .name = "m41t00", | ||
129 | .type = m41t00, | ||
130 | }, }; | 122 | }, }; |
131 | 123 | ||
132 | static inline const struct chip_desc *find_chip(const char *s) | 124 | static const struct i2c_device_id ds1307_id[] = { |
133 | { | 125 | { "ds1307", ds_1307 }, |
134 | unsigned i; | 126 | { "ds1337", ds_1337 }, |
135 | 127 | { "ds1338", ds_1338 }, | |
136 | for (i = 0; i < ARRAY_SIZE(chips); i++) | 128 | { "ds1339", ds_1339 }, |
137 | if (strnicmp(s, chips[i].name, sizeof chips[i].name) == 0) | 129 | { "ds1340", ds_1340 }, |
138 | return &chips[i]; | 130 | { "m41t00", m41t00 }, |
139 | return NULL; | 131 | { } |
140 | } | 132 | }; |
133 | MODULE_DEVICE_TABLE(i2c, ds1307_id); | ||
141 | 134 | ||
142 | static int ds1307_get_time(struct device *dev, struct rtc_time *t) | 135 | static int ds1307_get_time(struct device *dev, struct rtc_time *t) |
143 | { | 136 | { |
@@ -326,21 +319,15 @@ static struct bin_attribute nvram = { | |||
326 | 319 | ||
327 | static struct i2c_driver ds1307_driver; | 320 | static struct i2c_driver ds1307_driver; |
328 | 321 | ||
329 | static int __devinit ds1307_probe(struct i2c_client *client) | 322 | static int __devinit ds1307_probe(struct i2c_client *client, |
323 | const struct i2c_device_id *id) | ||
330 | { | 324 | { |
331 | struct ds1307 *ds1307; | 325 | struct ds1307 *ds1307; |
332 | int err = -ENODEV; | 326 | int err = -ENODEV; |
333 | int tmp; | 327 | int tmp; |
334 | const struct chip_desc *chip; | 328 | const struct chip_desc *chip = &chips[id->driver_data]; |
335 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 329 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
336 | 330 | ||
337 | chip = find_chip(client->name); | ||
338 | if (!chip) { | ||
339 | dev_err(&client->dev, "unknown chip type '%s'\n", | ||
340 | client->name); | ||
341 | return -ENODEV; | ||
342 | } | ||
343 | |||
344 | if (!i2c_check_functionality(adapter, | 331 | if (!i2c_check_functionality(adapter, |
345 | I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) | 332 | I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) |
346 | return -EIO; | 333 | return -EIO; |
@@ -361,7 +348,7 @@ static int __devinit ds1307_probe(struct i2c_client *client) | |||
361 | ds1307->msg[1].len = sizeof(ds1307->regs); | 348 | ds1307->msg[1].len = sizeof(ds1307->regs); |
362 | ds1307->msg[1].buf = ds1307->regs; | 349 | ds1307->msg[1].buf = ds1307->regs; |
363 | 350 | ||
364 | ds1307->type = chip->type; | 351 | ds1307->type = id->driver_data; |
365 | 352 | ||
366 | switch (ds1307->type) { | 353 | switch (ds1307->type) { |
367 | case ds_1337: | 354 | case ds_1337: |
@@ -550,6 +537,7 @@ static struct i2c_driver ds1307_driver = { | |||
550 | }, | 537 | }, |
551 | .probe = ds1307_probe, | 538 | .probe = ds1307_probe, |
552 | .remove = __devexit_p(ds1307_remove), | 539 | .remove = __devexit_p(ds1307_remove), |
540 | .id_table = ds1307_id, | ||
553 | }; | 541 | }; |
554 | 542 | ||
555 | static int __init ds1307_init(void) | 543 | static int __init ds1307_init(void) |
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index 45bda186befc..fa2d2f8b3f4d 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c | |||
@@ -41,6 +41,12 @@ | |||
41 | #define DS1374_REG_SR_AF 0x01 /* Alarm Flag */ | 41 | #define DS1374_REG_SR_AF 0x01 /* Alarm Flag */ |
42 | #define DS1374_REG_TCR 0x09 /* Trickle Charge */ | 42 | #define DS1374_REG_TCR 0x09 /* Trickle Charge */ |
43 | 43 | ||
44 | static const struct i2c_device_id ds1374_id[] = { | ||
45 | { "rtc-ds1374", 0 }, | ||
46 | { } | ||
47 | }; | ||
48 | MODULE_DEVICE_TABLE(i2c, ds1374_id); | ||
49 | |||
44 | struct ds1374 { | 50 | struct ds1374 { |
45 | struct i2c_client *client; | 51 | struct i2c_client *client; |
46 | struct rtc_device *rtc; | 52 | struct rtc_device *rtc; |
@@ -355,7 +361,8 @@ static const struct rtc_class_ops ds1374_rtc_ops = { | |||
355 | .ioctl = ds1374_ioctl, | 361 | .ioctl = ds1374_ioctl, |
356 | }; | 362 | }; |
357 | 363 | ||
358 | static int ds1374_probe(struct i2c_client *client) | 364 | static int ds1374_probe(struct i2c_client *client, |
365 | const struct i2c_device_id *id) | ||
359 | { | 366 | { |
360 | struct ds1374 *ds1374; | 367 | struct ds1374 *ds1374; |
361 | int ret; | 368 | int ret; |
@@ -429,6 +436,7 @@ static struct i2c_driver ds1374_driver = { | |||
429 | }, | 436 | }, |
430 | .probe = ds1374_probe, | 437 | .probe = ds1374_probe, |
431 | .remove = __devexit_p(ds1374_remove), | 438 | .remove = __devexit_p(ds1374_remove), |
439 | .id_table = ds1374_id, | ||
432 | }; | 440 | }; |
433 | 441 | ||
434 | static int __init ds1374_init(void) | 442 | static int __init ds1374_init(void) |
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index fb15e3fb4ce2..fbb90b1e4098 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c | |||
@@ -490,7 +490,7 @@ isl1208_sysfs_unregister(struct device *dev) | |||
490 | } | 490 | } |
491 | 491 | ||
492 | static int | 492 | static int |
493 | isl1208_probe(struct i2c_client *client) | 493 | isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id) |
494 | { | 494 | { |
495 | int rc = 0; | 495 | int rc = 0; |
496 | struct rtc_device *rtc; | 496 | struct rtc_device *rtc; |
@@ -545,12 +545,19 @@ isl1208_remove(struct i2c_client *client) | |||
545 | return 0; | 545 | return 0; |
546 | } | 546 | } |
547 | 547 | ||
548 | static const struct i2c_device_id isl1208_id[] = { | ||
549 | { "isl1208", 0 }, | ||
550 | { } | ||
551 | }; | ||
552 | MODULE_DEVICE_TABLE(i2c, isl1208_id); | ||
553 | |||
548 | static struct i2c_driver isl1208_driver = { | 554 | static struct i2c_driver isl1208_driver = { |
549 | .driver = { | 555 | .driver = { |
550 | .name = "rtc-isl1208", | 556 | .name = "rtc-isl1208", |
551 | }, | 557 | }, |
552 | .probe = isl1208_probe, | 558 | .probe = isl1208_probe, |
553 | .remove = isl1208_remove, | 559 | .remove = isl1208_remove, |
560 | .id_table = isl1208_id, | ||
554 | }; | 561 | }; |
555 | 562 | ||
556 | static int __init | 563 | static int __init |
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index 1cb33cac1237..316bfaa80872 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c | |||
@@ -60,48 +60,21 @@ | |||
60 | 60 | ||
61 | #define DRV_VERSION "0.05" | 61 | #define DRV_VERSION "0.05" |
62 | 62 | ||
63 | struct m41t80_chip_info { | 63 | static const struct i2c_device_id m41t80_id[] = { |
64 | const char *name; | 64 | { "m41t80", 0 }, |
65 | u8 features; | 65 | { "m41t81", M41T80_FEATURE_HT }, |
66 | }; | 66 | { "m41t81s", M41T80_FEATURE_HT | M41T80_FEATURE_BL }, |
67 | 67 | { "m41t82", M41T80_FEATURE_HT | M41T80_FEATURE_BL }, | |
68 | static const struct m41t80_chip_info m41t80_chip_info_tbl[] = { | 68 | { "m41t83", M41T80_FEATURE_HT | M41T80_FEATURE_BL }, |
69 | { | 69 | { "m41st84", M41T80_FEATURE_HT | M41T80_FEATURE_BL }, |
70 | .name = "m41t80", | 70 | { "m41st85", M41T80_FEATURE_HT | M41T80_FEATURE_BL }, |
71 | .features = 0, | 71 | { "m41st87", M41T80_FEATURE_HT | M41T80_FEATURE_BL }, |
72 | }, | 72 | { } |
73 | { | ||
74 | .name = "m41t81", | ||
75 | .features = M41T80_FEATURE_HT, | ||
76 | }, | ||
77 | { | ||
78 | .name = "m41t81s", | ||
79 | .features = M41T80_FEATURE_HT | M41T80_FEATURE_BL, | ||
80 | }, | ||
81 | { | ||
82 | .name = "m41t82", | ||
83 | .features = M41T80_FEATURE_HT | M41T80_FEATURE_BL, | ||
84 | }, | ||
85 | { | ||
86 | .name = "m41t83", | ||
87 | .features = M41T80_FEATURE_HT | M41T80_FEATURE_BL, | ||
88 | }, | ||
89 | { | ||
90 | .name = "m41st84", | ||
91 | .features = M41T80_FEATURE_HT | M41T80_FEATURE_BL, | ||
92 | }, | ||
93 | { | ||
94 | .name = "m41st85", | ||
95 | .features = M41T80_FEATURE_HT | M41T80_FEATURE_BL, | ||
96 | }, | ||
97 | { | ||
98 | .name = "m41st87", | ||
99 | .features = M41T80_FEATURE_HT | M41T80_FEATURE_BL, | ||
100 | }, | ||
101 | }; | 73 | }; |
74 | MODULE_DEVICE_TABLE(i2c, m41t80_id); | ||
102 | 75 | ||
103 | struct m41t80_data { | 76 | struct m41t80_data { |
104 | const struct m41t80_chip_info *chip; | 77 | u8 features; |
105 | struct rtc_device *rtc; | 78 | struct rtc_device *rtc; |
106 | }; | 79 | }; |
107 | 80 | ||
@@ -208,7 +181,7 @@ static int m41t80_rtc_proc(struct device *dev, struct seq_file *seq) | |||
208 | struct m41t80_data *clientdata = i2c_get_clientdata(client); | 181 | struct m41t80_data *clientdata = i2c_get_clientdata(client); |
209 | u8 reg; | 182 | u8 reg; |
210 | 183 | ||
211 | if (clientdata->chip->features & M41T80_FEATURE_BL) { | 184 | if (clientdata->features & M41T80_FEATURE_BL) { |
212 | reg = i2c_smbus_read_byte_data(client, M41T80_REG_FLAGS); | 185 | reg = i2c_smbus_read_byte_data(client, M41T80_REG_FLAGS); |
213 | seq_printf(seq, "battery\t\t: %s\n", | 186 | seq_printf(seq, "battery\t\t: %s\n", |
214 | (reg & M41T80_FLAGS_BATT_LOW) ? "exhausted" : "ok"); | 187 | (reg & M41T80_FLAGS_BATT_LOW) ? "exhausted" : "ok"); |
@@ -756,12 +729,12 @@ static struct notifier_block wdt_notifier = { | |||
756 | * | 729 | * |
757 | ***************************************************************************** | 730 | ***************************************************************************** |
758 | */ | 731 | */ |
759 | static int m41t80_probe(struct i2c_client *client) | 732 | static int m41t80_probe(struct i2c_client *client, |
733 | const struct i2c_device_id *id) | ||
760 | { | 734 | { |
761 | int i, rc = 0; | 735 | int rc = 0; |
762 | struct rtc_device *rtc = NULL; | 736 | struct rtc_device *rtc = NULL; |
763 | struct rtc_time tm; | 737 | struct rtc_time tm; |
764 | const struct m41t80_chip_info *chip; | ||
765 | struct m41t80_data *clientdata = NULL; | 738 | struct m41t80_data *clientdata = NULL; |
766 | 739 | ||
767 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C | 740 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C |
@@ -773,19 +746,6 @@ static int m41t80_probe(struct i2c_client *client) | |||
773 | dev_info(&client->dev, | 746 | dev_info(&client->dev, |
774 | "chip found, driver version " DRV_VERSION "\n"); | 747 | "chip found, driver version " DRV_VERSION "\n"); |
775 | 748 | ||
776 | chip = NULL; | ||
777 | for (i = 0; i < ARRAY_SIZE(m41t80_chip_info_tbl); i++) { | ||
778 | if (!strcmp(m41t80_chip_info_tbl[i].name, client->name)) { | ||
779 | chip = &m41t80_chip_info_tbl[i]; | ||
780 | break; | ||
781 | } | ||
782 | } | ||
783 | if (!chip) { | ||
784 | dev_err(&client->dev, "%s is not supported\n", client->name); | ||
785 | rc = -ENODEV; | ||
786 | goto exit; | ||
787 | } | ||
788 | |||
789 | clientdata = kzalloc(sizeof(*clientdata), GFP_KERNEL); | 749 | clientdata = kzalloc(sizeof(*clientdata), GFP_KERNEL); |
790 | if (!clientdata) { | 750 | if (!clientdata) { |
791 | rc = -ENOMEM; | 751 | rc = -ENOMEM; |
@@ -801,7 +761,7 @@ static int m41t80_probe(struct i2c_client *client) | |||
801 | } | 761 | } |
802 | 762 | ||
803 | clientdata->rtc = rtc; | 763 | clientdata->rtc = rtc; |
804 | clientdata->chip = chip; | 764 | clientdata->features = id->driver_data; |
805 | i2c_set_clientdata(client, clientdata); | 765 | i2c_set_clientdata(client, clientdata); |
806 | 766 | ||
807 | /* Make sure HT (Halt Update) bit is cleared */ | 767 | /* Make sure HT (Halt Update) bit is cleared */ |
@@ -810,7 +770,7 @@ static int m41t80_probe(struct i2c_client *client) | |||
810 | goto ht_err; | 770 | goto ht_err; |
811 | 771 | ||
812 | if (rc & M41T80_ALHOUR_HT) { | 772 | if (rc & M41T80_ALHOUR_HT) { |
813 | if (chip->features & M41T80_FEATURE_HT) { | 773 | if (clientdata->features & M41T80_FEATURE_HT) { |
814 | m41t80_get_datetime(client, &tm); | 774 | m41t80_get_datetime(client, &tm); |
815 | dev_info(&client->dev, "HT bit was set!\n"); | 775 | dev_info(&client->dev, "HT bit was set!\n"); |
816 | dev_info(&client->dev, | 776 | dev_info(&client->dev, |
@@ -842,7 +802,7 @@ static int m41t80_probe(struct i2c_client *client) | |||
842 | goto exit; | 802 | goto exit; |
843 | 803 | ||
844 | #ifdef CONFIG_RTC_DRV_M41T80_WDT | 804 | #ifdef CONFIG_RTC_DRV_M41T80_WDT |
845 | if (chip->features & M41T80_FEATURE_HT) { | 805 | if (clientdata->features & M41T80_FEATURE_HT) { |
846 | rc = misc_register(&wdt_dev); | 806 | rc = misc_register(&wdt_dev); |
847 | if (rc) | 807 | if (rc) |
848 | goto exit; | 808 | goto exit; |
@@ -878,7 +838,7 @@ static int m41t80_remove(struct i2c_client *client) | |||
878 | struct rtc_device *rtc = clientdata->rtc; | 838 | struct rtc_device *rtc = clientdata->rtc; |
879 | 839 | ||
880 | #ifdef CONFIG_RTC_DRV_M41T80_WDT | 840 | #ifdef CONFIG_RTC_DRV_M41T80_WDT |
881 | if (clientdata->chip->features & M41T80_FEATURE_HT) { | 841 | if (clientdata->features & M41T80_FEATURE_HT) { |
882 | misc_deregister(&wdt_dev); | 842 | misc_deregister(&wdt_dev); |
883 | unregister_reboot_notifier(&wdt_notifier); | 843 | unregister_reboot_notifier(&wdt_notifier); |
884 | } | 844 | } |
@@ -896,6 +856,7 @@ static struct i2c_driver m41t80_driver = { | |||
896 | }, | 856 | }, |
897 | .probe = m41t80_probe, | 857 | .probe = m41t80_probe, |
898 | .remove = m41t80_remove, | 858 | .remove = m41t80_remove, |
859 | .id_table = m41t80_id, | ||
899 | }; | 860 | }; |
900 | 861 | ||
901 | static int __init m41t80_rtc_init(void) | 862 | static int __init m41t80_rtc_init(void) |
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index a41681d26eba..0fc4c3630780 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c | |||
@@ -246,7 +246,8 @@ static const struct rtc_class_ops pcf8563_rtc_ops = { | |||
246 | .set_time = pcf8563_rtc_set_time, | 246 | .set_time = pcf8563_rtc_set_time, |
247 | }; | 247 | }; |
248 | 248 | ||
249 | static int pcf8563_probe(struct i2c_client *client) | 249 | static int pcf8563_probe(struct i2c_client *client, |
250 | const struct i2c_device_id *id) | ||
250 | { | 251 | { |
251 | struct pcf8563 *pcf8563; | 252 | struct pcf8563 *pcf8563; |
252 | 253 | ||
@@ -299,12 +300,19 @@ static int pcf8563_remove(struct i2c_client *client) | |||
299 | return 0; | 300 | return 0; |
300 | } | 301 | } |
301 | 302 | ||
303 | static const struct i2c_device_id pcf8563_id[] = { | ||
304 | { "pcf8563", 0 }, | ||
305 | { } | ||
306 | }; | ||
307 | MODULE_DEVICE_TABLE(i2c, pcf8563_id); | ||
308 | |||
302 | static struct i2c_driver pcf8563_driver = { | 309 | static struct i2c_driver pcf8563_driver = { |
303 | .driver = { | 310 | .driver = { |
304 | .name = "rtc-pcf8563", | 311 | .name = "rtc-pcf8563", |
305 | }, | 312 | }, |
306 | .probe = pcf8563_probe, | 313 | .probe = pcf8563_probe, |
307 | .remove = pcf8563_remove, | 314 | .remove = pcf8563_remove, |
315 | .id_table = pcf8563_id, | ||
308 | }; | 316 | }; |
309 | 317 | ||
310 | static int __init pcf8563_init(void) | 318 | static int __init pcf8563_init(void) |
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index 7e63074708eb..56caf6b2c3e5 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c | |||
@@ -69,6 +69,15 @@ enum rtc_type { | |||
69 | rtc_rv5c387a, | 69 | rtc_rv5c387a, |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static const struct i2c_device_id rs5c372_id[] = { | ||
73 | { "rs5c372a", rtc_rs5c372a }, | ||
74 | { "rs5c372b", rtc_rs5c372b }, | ||
75 | { "rv5c386", rtc_rv5c386 }, | ||
76 | { "rv5c387a", rtc_rv5c387a }, | ||
77 | { } | ||
78 | }; | ||
79 | MODULE_DEVICE_TABLE(i2c, rs5c372_id); | ||
80 | |||
72 | /* REVISIT: this assumes that: | 81 | /* REVISIT: this assumes that: |
73 | * - we're in the 21st century, so it's safe to ignore the century | 82 | * - we're in the 21st century, so it's safe to ignore the century |
74 | * bit for rv5c38[67] (REG_MONTH bit 7); | 83 | * bit for rv5c38[67] (REG_MONTH bit 7); |
@@ -494,7 +503,8 @@ static void rs5c_sysfs_unregister(struct device *dev) | |||
494 | 503 | ||
495 | static struct i2c_driver rs5c372_driver; | 504 | static struct i2c_driver rs5c372_driver; |
496 | 505 | ||
497 | static int rs5c372_probe(struct i2c_client *client) | 506 | static int rs5c372_probe(struct i2c_client *client, |
507 | const struct i2c_device_id *id) | ||
498 | { | 508 | { |
499 | int err = 0; | 509 | int err = 0; |
500 | struct rs5c372 *rs5c372; | 510 | struct rs5c372 *rs5c372; |
@@ -514,6 +524,7 @@ static int rs5c372_probe(struct i2c_client *client) | |||
514 | 524 | ||
515 | rs5c372->client = client; | 525 | rs5c372->client = client; |
516 | i2c_set_clientdata(client, rs5c372); | 526 | i2c_set_clientdata(client, rs5c372); |
527 | rs5c372->type = id->driver_data; | ||
517 | 528 | ||
518 | /* we read registers 0x0f then 0x00-0x0f; skip the first one */ | 529 | /* we read registers 0x0f then 0x00-0x0f; skip the first one */ |
519 | rs5c372->regs = &rs5c372->buf[1]; | 530 | rs5c372->regs = &rs5c372->buf[1]; |
@@ -522,19 +533,6 @@ static int rs5c372_probe(struct i2c_client *client) | |||
522 | if (err < 0) | 533 | if (err < 0) |
523 | goto exit_kfree; | 534 | goto exit_kfree; |
524 | 535 | ||
525 | if (strcmp(client->name, "rs5c372a") == 0) | ||
526 | rs5c372->type = rtc_rs5c372a; | ||
527 | else if (strcmp(client->name, "rs5c372b") == 0) | ||
528 | rs5c372->type = rtc_rs5c372b; | ||
529 | else if (strcmp(client->name, "rv5c386") == 0) | ||
530 | rs5c372->type = rtc_rv5c386; | ||
531 | else if (strcmp(client->name, "rv5c387a") == 0) | ||
532 | rs5c372->type = rtc_rv5c387a; | ||
533 | else { | ||
534 | rs5c372->type = rtc_rs5c372b; | ||
535 | dev_warn(&client->dev, "assuming rs5c372b\n"); | ||
536 | } | ||
537 | |||
538 | /* clock may be set for am/pm or 24 hr time */ | 536 | /* clock may be set for am/pm or 24 hr time */ |
539 | switch (rs5c372->type) { | 537 | switch (rs5c372->type) { |
540 | case rtc_rs5c372a: | 538 | case rtc_rs5c372a: |
@@ -651,6 +649,7 @@ static struct i2c_driver rs5c372_driver = { | |||
651 | }, | 649 | }, |
652 | .probe = rs5c372_probe, | 650 | .probe = rs5c372_probe, |
653 | .remove = rs5c372_remove, | 651 | .remove = rs5c372_remove, |
652 | .id_table = rs5c372_id, | ||
654 | }; | 653 | }; |
655 | 654 | ||
656 | static __init int rs5c372_init(void) | 655 | static __init int rs5c372_init(void) |
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c index e8abc90c32c5..29f47bacfc77 100644 --- a/drivers/rtc/rtc-s35390a.c +++ b/drivers/rtc/rtc-s35390a.c | |||
@@ -34,6 +34,12 @@ | |||
34 | #define S35390A_FLAG_RESET 0x80 | 34 | #define S35390A_FLAG_RESET 0x80 |
35 | #define S35390A_FLAG_TEST 0x01 | 35 | #define S35390A_FLAG_TEST 0x01 |
36 | 36 | ||
37 | static const struct i2c_device_id s35390a_id[] = { | ||
38 | { "s35390a", 0 }, | ||
39 | { } | ||
40 | }; | ||
41 | MODULE_DEVICE_TABLE(i2c, s35390a_id); | ||
42 | |||
37 | struct s35390a { | 43 | struct s35390a { |
38 | struct i2c_client *client[8]; | 44 | struct i2c_client *client[8]; |
39 | struct rtc_device *rtc; | 45 | struct rtc_device *rtc; |
@@ -195,7 +201,8 @@ static const struct rtc_class_ops s35390a_rtc_ops = { | |||
195 | 201 | ||
196 | static struct i2c_driver s35390a_driver; | 202 | static struct i2c_driver s35390a_driver; |
197 | 203 | ||
198 | static int s35390a_probe(struct i2c_client *client) | 204 | static int s35390a_probe(struct i2c_client *client, |
205 | const struct i2c_device_id *id) | ||
199 | { | 206 | { |
200 | int err; | 207 | int err; |
201 | unsigned int i; | 208 | unsigned int i; |
@@ -296,6 +303,7 @@ static struct i2c_driver s35390a_driver = { | |||
296 | }, | 303 | }, |
297 | .probe = s35390a_probe, | 304 | .probe = s35390a_probe, |
298 | .remove = s35390a_remove, | 305 | .remove = s35390a_remove, |
306 | .id_table = s35390a_id, | ||
299 | }; | 307 | }; |
300 | 308 | ||
301 | static int __init s35390a_rtc_init(void) | 309 | static int __init s35390a_rtc_init(void) |
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c index 095282f63523..eaf55945f21b 100644 --- a/drivers/rtc/rtc-x1205.c +++ b/drivers/rtc/rtc-x1205.c | |||
@@ -494,7 +494,8 @@ static void x1205_sysfs_unregister(struct device *dev) | |||
494 | } | 494 | } |
495 | 495 | ||
496 | 496 | ||
497 | static int x1205_probe(struct i2c_client *client) | 497 | static int x1205_probe(struct i2c_client *client, |
498 | const struct i2c_device_id *id) | ||
498 | { | 499 | { |
499 | int err = 0; | 500 | int err = 0; |
500 | unsigned char sr; | 501 | unsigned char sr; |
@@ -552,12 +553,19 @@ static int x1205_remove(struct i2c_client *client) | |||
552 | return 0; | 553 | return 0; |
553 | } | 554 | } |
554 | 555 | ||
556 | static const struct i2c_device_id x1205_id[] = { | ||
557 | { "x1205", 0 }, | ||
558 | { } | ||
559 | }; | ||
560 | MODULE_DEVICE_TABLE(i2c, x1205_id); | ||
561 | |||
555 | static struct i2c_driver x1205_driver = { | 562 | static struct i2c_driver x1205_driver = { |
556 | .driver = { | 563 | .driver = { |
557 | .name = "rtc-x1205", | 564 | .name = "rtc-x1205", |
558 | }, | 565 | }, |
559 | .probe = x1205_probe, | 566 | .probe = x1205_probe, |
560 | .remove = x1205_remove, | 567 | .remove = x1205_remove, |
568 | .id_table = x1205_id, | ||
561 | }; | 569 | }; |
562 | 570 | ||
563 | static int __init x1205_init(void) | 571 | static int __init x1205_init(void) |
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 32eb8bbe4831..580acc93903e 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
@@ -79,12 +79,9 @@ | |||
79 | #define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */ | 79 | #define I2C_DRIVERID_UPD64031A 79 /* upd64031a video processor */ |
80 | #define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */ | 80 | #define I2C_DRIVERID_SAA717X 80 /* saa717x video encoder */ |
81 | #define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */ | 81 | #define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */ |
82 | #define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */ | ||
83 | #define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */ | ||
84 | #define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */ | 82 | #define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */ |
85 | #define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */ | 83 | #define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */ |
86 | #define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */ | 84 | #define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */ |
87 | #define I2C_DRIVERID_ISL1208 88 /* Intersil ISL1208 RTC */ | ||
88 | #define I2C_DRIVERID_WM8731 89 /* Wolfson WM8731 audio codec */ | 85 | #define I2C_DRIVERID_WM8731 89 /* Wolfson WM8731 audio codec */ |
89 | #define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */ | 86 | #define I2C_DRIVERID_WM8750 90 /* Wolfson WM8750 audio codec */ |
90 | #define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */ | 87 | #define I2C_DRIVERID_WM8753 91 /* Wolfson WM8753 audio codec */ |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 365e0df3646b..cb63da5c2139 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -126,7 +126,7 @@ struct i2c_driver { | |||
126 | * With the driver model, device enumeration is NEVER done by drivers; | 126 | * With the driver model, device enumeration is NEVER done by drivers; |
127 | * it's done by infrastructure. (NEW STYLE DRIVERS ONLY) | 127 | * it's done by infrastructure. (NEW STYLE DRIVERS ONLY) |
128 | */ | 128 | */ |
129 | int (*probe)(struct i2c_client *); | 129 | int (*probe)(struct i2c_client *, const struct i2c_device_id *); |
130 | int (*remove)(struct i2c_client *); | 130 | int (*remove)(struct i2c_client *); |
131 | 131 | ||
132 | /* driver model interfaces that don't relate to enumeration */ | 132 | /* driver model interfaces that don't relate to enumeration */ |
@@ -140,11 +140,10 @@ struct i2c_driver { | |||
140 | int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); | 140 | int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); |
141 | 141 | ||
142 | struct device_driver driver; | 142 | struct device_driver driver; |
143 | const struct i2c_device_id *id_table; | ||
143 | }; | 144 | }; |
144 | #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) | 145 | #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) |
145 | 146 | ||
146 | #define I2C_NAME_SIZE 20 | ||
147 | |||
148 | /** | 147 | /** |
149 | * struct i2c_client - represent an I2C slave device | 148 | * struct i2c_client - represent an I2C slave device |
150 | * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address; | 149 | * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address; |
@@ -230,17 +229,17 @@ struct i2c_board_info { | |||
230 | }; | 229 | }; |
231 | 230 | ||
232 | /** | 231 | /** |
233 | * I2C_BOARD_INFO - macro used to list an i2c device and its driver | 232 | * I2C_BOARD_INFO - macro used to list an i2c device and its address |
234 | * @driver: identifies the driver to use with the device | 233 | * @dev_type: identifies the device type |
235 | * @dev_addr: the device's address on the bus. | 234 | * @dev_addr: the device's address on the bus. |
236 | * | 235 | * |
237 | * This macro initializes essential fields of a struct i2c_board_info, | 236 | * This macro initializes essential fields of a struct i2c_board_info, |
238 | * declaring what has been provided on a particular board. Optional | 237 | * declaring what has been provided on a particular board. Optional |
239 | * fields (such as the chip type, its associated irq, or device-specific | 238 | * fields (such as associated irq, or device-specific platform_data) |
240 | * platform_data) are provided using conventional syntax. | 239 | * are provided using conventional syntax. |
241 | */ | 240 | */ |
242 | #define I2C_BOARD_INFO(driver,dev_addr) \ | 241 | #define I2C_BOARD_INFO(dev_type,dev_addr) \ |
243 | .driver_name = (driver), .addr = (dev_addr) | 242 | .type = (dev_type), .addr = (dev_addr) |
244 | 243 | ||
245 | 244 | ||
246 | /* Add-on boards should register/unregister their devices; e.g. a board | 245 | /* Add-on boards should register/unregister their devices; e.g. a board |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 139d49d2f078..d73eceaa7afb 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -368,4 +368,15 @@ struct virtio_device_id { | |||
368 | }; | 368 | }; |
369 | #define VIRTIO_DEV_ANY_ID 0xffffffff | 369 | #define VIRTIO_DEV_ANY_ID 0xffffffff |
370 | 370 | ||
371 | /* i2c */ | ||
372 | |||
373 | #define I2C_NAME_SIZE 20 | ||
374 | #define I2C_MODULE_PREFIX "i2c:" | ||
375 | |||
376 | struct i2c_device_id { | ||
377 | char name[I2C_NAME_SIZE]; | ||
378 | kernel_ulong_t driver_data; /* Data private to the driver */ | ||
379 | }; | ||
380 | |||
381 | |||
371 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 382 | #endif /* LINUX_MOD_DEVICETABLE_H */ |
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 316a58453134..020d05758bd8 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
@@ -107,9 +107,11 @@ int v4l2_chip_match_host(u32 id_type, u32 chip_id); | |||
107 | struct i2c_driver; | 107 | struct i2c_driver; |
108 | struct i2c_adapter; | 108 | struct i2c_adapter; |
109 | struct i2c_client; | 109 | struct i2c_client; |
110 | struct i2c_device_id; | ||
110 | 111 | ||
111 | int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver, | 112 | int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver, |
112 | const char *name, int (*probe)(struct i2c_client *)); | 113 | const char *name, |
114 | int (*probe)(struct i2c_client *, const struct i2c_device_id *)); | ||
113 | 115 | ||
114 | /* ------------------------------------------------------------------------- */ | 116 | /* ------------------------------------------------------------------------- */ |
115 | 117 | ||
diff --git a/include/media/v4l2-i2c-drv-legacy.h b/include/media/v4l2-i2c-drv-legacy.h index e7645578fc22..347b6f8beb23 100644 --- a/include/media/v4l2-i2c-drv-legacy.h +++ b/include/media/v4l2-i2c-drv-legacy.h | |||
@@ -25,7 +25,7 @@ struct v4l2_i2c_driver_data { | |||
25 | const char * const name; | 25 | const char * const name; |
26 | int driverid; | 26 | int driverid; |
27 | int (*command)(struct i2c_client *client, unsigned int cmd, void *arg); | 27 | int (*command)(struct i2c_client *client, unsigned int cmd, void *arg); |
28 | int (*probe)(struct i2c_client *client); | 28 | int (*probe)(struct i2c_client *client, const struct i2c_device_id *id); |
29 | int (*remove)(struct i2c_client *client); | 29 | int (*remove)(struct i2c_client *client); |
30 | int (*suspend)(struct i2c_client *client, pm_message_t state); | 30 | int (*suspend)(struct i2c_client *client, pm_message_t state); |
31 | int (*resume)(struct i2c_client *client); | 31 | int (*resume)(struct i2c_client *client); |
diff --git a/include/media/v4l2-i2c-drv.h b/include/media/v4l2-i2c-drv.h index 9e4bab276915..7b6f06be7950 100644 --- a/include/media/v4l2-i2c-drv.h +++ b/include/media/v4l2-i2c-drv.h | |||
@@ -30,7 +30,7 @@ struct v4l2_i2c_driver_data { | |||
30 | const char * const name; | 30 | const char * const name; |
31 | int driverid; | 31 | int driverid; |
32 | int (*command)(struct i2c_client *client, unsigned int cmd, void *arg); | 32 | int (*command)(struct i2c_client *client, unsigned int cmd, void *arg); |
33 | int (*probe)(struct i2c_client *client); | 33 | int (*probe)(struct i2c_client *client, const struct i2c_device_id *id); |
34 | int (*remove)(struct i2c_client *client); | 34 | int (*remove)(struct i2c_client *client); |
35 | int (*suspend)(struct i2c_client *client, pm_message_t state); | 35 | int (*suspend)(struct i2c_client *client, pm_message_t state); |
36 | int (*resume)(struct i2c_client *client); | 36 | int (*resume)(struct i2c_client *client); |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 769b69db89c1..e04c4218cb52 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -576,6 +576,15 @@ static int do_virtio_entry(const char *filename, struct virtio_device_id *id, | |||
576 | return 1; | 576 | return 1; |
577 | } | 577 | } |
578 | 578 | ||
579 | /* Looks like: i2c:S */ | ||
580 | static int do_i2c_entry(const char *filename, struct i2c_device_id *id, | ||
581 | char *alias) | ||
582 | { | ||
583 | sprintf(alias, I2C_MODULE_PREFIX "%s", id->name); | ||
584 | |||
585 | return 1; | ||
586 | } | ||
587 | |||
579 | /* Ignore any prefix, eg. v850 prepends _ */ | 588 | /* Ignore any prefix, eg. v850 prepends _ */ |
580 | static inline int sym_is(const char *symbol, const char *name) | 589 | static inline int sym_is(const char *symbol, const char *name) |
581 | { | 590 | { |
@@ -704,6 +713,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
704 | do_table(symval, sym->st_size, | 713 | do_table(symval, sym->st_size, |
705 | sizeof(struct virtio_device_id), "virtio", | 714 | sizeof(struct virtio_device_id), "virtio", |
706 | do_virtio_entry, mod); | 715 | do_virtio_entry, mod); |
716 | else if (sym_is(symname, "__mod_i2c_device_table")) | ||
717 | do_table(symval, sym->st_size, | ||
718 | sizeof(struct i2c_device_id), "i2c", | ||
719 | do_i2c_entry, mod); | ||
707 | free(zeros); | 720 | free(zeros); |
708 | } | 721 | } |
709 | 722 | ||