aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/i2c/writing-clients3
-rw-r--r--drivers/gpio/pca953x.c3
-rw-r--r--drivers/gpio/pcf857x.c3
-rw-r--r--drivers/hwmon/f75375s.c8
-rw-r--r--drivers/i2c/chips/ds1682.c3
-rw-r--r--drivers/i2c/chips/menelaus.c3
-rw-r--r--drivers/i2c/chips/tps65010.c3
-rw-r--r--drivers/i2c/chips/tsl2550.c3
-rw-r--r--drivers/i2c/i2c-core.c51
-rw-r--r--drivers/media/video/cs5345.c3
-rw-r--r--drivers/media/video/cs53l32a.c3
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c3
-rw-r--r--drivers/media/video/m52790.c3
-rw-r--r--drivers/media/video/msp3400-driver.c2
-rw-r--r--drivers/media/video/mt9m001.c3
-rw-r--r--drivers/media/video/mt9v022.c3
-rw-r--r--drivers/media/video/saa7115.c3
-rw-r--r--drivers/media/video/saa7127.c3
-rw-r--r--drivers/media/video/saa717x.c3
-rw-r--r--drivers/media/video/tcm825x.c3
-rw-r--r--drivers/media/video/tlv320aic23b.c3
-rw-r--r--drivers/media/video/tuner-core.c3
-rw-r--r--drivers/media/video/tvaudio.c2
-rw-r--r--drivers/media/video/upd64031a.c3
-rw-r--r--drivers/media/video/upd64083.c3
-rw-r--r--drivers/media/video/v4l2-common.c5
-rw-r--r--drivers/media/video/vp27smpx.c3
-rw-r--r--drivers/media/video/wm8739.c3
-rw-r--r--drivers/media/video/wm8775.c3
-rw-r--r--drivers/rtc/rtc-ds1307.c3
-rw-r--r--drivers/rtc/rtc-ds1374.c3
-rw-r--r--drivers/rtc/rtc-isl1208.c2
-rw-r--r--drivers/rtc/rtc-m41t80.c3
-rw-r--r--drivers/rtc/rtc-pcf8563.c3
-rw-r--r--drivers/rtc/rtc-rs5c372.c3
-rw-r--r--drivers/rtc/rtc-s35390a.c3
-rw-r--r--drivers/rtc/rtc-x1205.c3
-rw-r--r--include/linux/i2c.h5
-rw-r--r--include/linux/mod_devicetable.h11
-rw-r--r--include/media/v4l2-common.h4
-rw-r--r--include/media/v4l2-i2c-drv-legacy.h2
-rw-r--r--include/media/v4l2-i2c-drv.h2
-rw-r--r--scripts/mod/file2alias.c13
43 files changed, 146 insertions, 54 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
164kind of driver in Linux: they provide a probe() method to bind to 164kind of driver in Linux: they provide a probe() method to bind to
165those devices, and a remove() method to unbind. 165those 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
170Remember that the i2c_driver does not create those client handles. The 171Remember that the i2c_driver does not create those client handles. The
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index e0e0af536108..2670519236e5 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -192,7 +192,8 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios)
192 gc->owner = THIS_MODULE; 192 gc->owner = THIS_MODULE;
193} 193}
194 194
195static int __devinit pca953x_probe(struct i2c_client *client) 195static int __devinit pca953x_probe(struct i2c_client *client,
196 const struct i2c_device_id *did)
196{ 197{
197 struct pca953x_platform_data *pdata; 198 struct pca953x_platform_data *pdata;
198 struct pca953x_chip *chip; 199 struct pca953x_chip *chip;
diff --git a/drivers/gpio/pcf857x.c b/drivers/gpio/pcf857x.c
index 1106aa15ac79..8856870dd738 100644
--- a/drivers/gpio/pcf857x.c
+++ b/drivers/gpio/pcf857x.c
@@ -142,7 +142,8 @@ static void pcf857x_set16(struct gpio_chip *chip, unsigned offset, int value)
142 142
143/*-------------------------------------------------------------------------*/ 143/*-------------------------------------------------------------------------*/
144 144
145static int pcf857x_probe(struct i2c_client *client) 145static int pcf857x_probe(struct i2c_client *client,
146 const struct i2c_device_id *id)
146{ 147{
147 struct pcf857x_platform_data *pdata; 148 struct pcf857x_platform_data *pdata;
148 struct pcf857x *gpio; 149 struct pcf857x *gpio;
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index 1464338e4e11..1f63bab05522 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -117,7 +117,8 @@ struct f75375_data {
117static int f75375_attach_adapter(struct i2c_adapter *adapter); 117static int f75375_attach_adapter(struct i2c_adapter *adapter);
118static int f75375_detect(struct i2c_adapter *adapter, int address, int kind); 118static int f75375_detect(struct i2c_adapter *adapter, int address, int kind);
119static int f75375_detach_client(struct i2c_client *client); 119static int f75375_detach_client(struct i2c_client *client);
120static int f75375_probe(struct i2c_client *client); 120static int f75375_probe(struct i2c_client *client,
121 const struct i2c_device_id *id);
121static int f75375_remove(struct i2c_client *client); 122static int f75375_remove(struct i2c_client *client);
122 123
123static struct i2c_driver f75375_legacy_driver = { 124static struct i2c_driver f75375_legacy_driver = {
@@ -628,7 +629,8 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data,
628 629
629} 630}
630 631
631static int f75375_probe(struct i2c_client *client) 632static int f75375_probe(struct i2c_client *client,
633 const struct i2c_device_id *id)
632{ 634{
633 struct f75375_data *data = i2c_get_clientdata(client); 635 struct f75375_data *data = i2c_get_clientdata(client);
634 struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data; 636 struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data;
@@ -748,7 +750,7 @@ static int f75375_detect(struct i2c_adapter *adapter, int address, int kind)
748 if ((err = i2c_attach_client(client))) 750 if ((err = i2c_attach_client(client)))
749 goto exit_free; 751 goto exit_free;
750 752
751 if ((err = f75375_probe(client)) < 0) 753 if ((err = f75375_probe(client, NULL)) < 0)
752 goto exit_detach; 754 goto exit_detach;
753 755
754 return 0; 756 return 0;
diff --git a/drivers/i2c/chips/ds1682.c b/drivers/i2c/chips/ds1682.c
index 9e94542c18a2..3070821030e4 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 */
203static int ds1682_probe(struct i2c_client *client) 203static int ds1682_probe(struct i2c_client *client,
204 const struct i2c_device_id *id)
204{ 205{
205 int rc; 206 int rc;
206 207
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c
index 2dea0123a958..3b8ba7e75843 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
1150static struct i2c_driver menelaus_i2c_driver; 1150static struct i2c_driver menelaus_i2c_driver;
1151 1151
1152static int menelaus_probe(struct i2c_client *client) 1152static 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;
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c
index feabd12c081c..6ab3619a49de 100644
--- a/drivers/i2c/chips/tps65010.c
+++ b/drivers/i2c/chips/tps65010.c
@@ -532,7 +532,8 @@ static int __exit tps65010_remove(struct i2c_client *client)
532 return 0; 532 return 0;
533} 533}
534 534
535static int tps65010_probe(struct i2c_client *client) 535static int tps65010_probe(struct i2c_client *client,
536 const struct i2c_device_id *id)
536{ 537{
537 struct tps65010 *tps; 538 struct tps65010 *tps;
538 int status; 539 int status;
diff --git a/drivers/i2c/chips/tsl2550.c b/drivers/i2c/chips/tsl2550.c
index a10fd2791a69..59c2c662cc45 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
366static struct i2c_driver tsl2550_driver; 366static struct i2c_driver tsl2550_driver;
367static int __devinit tsl2550_probe(struct i2c_client *client) 367static 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;
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
51static 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
51static int i2c_device_match(struct device *dev, struct device_driver *drv) 62static 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
179static ssize_t show_modalias(struct device *dev, struct device_attribute *attr, char *buf) 206static 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
187static struct device_attribute i2c_dev_attrs[] = { 214static struct device_attribute i2c_dev_attrs[] = {
@@ -300,15 +327,21 @@ void i2c_unregister_device(struct i2c_client *client)
300EXPORT_SYMBOL_GPL(i2c_unregister_device); 327EXPORT_SYMBOL_GPL(i2c_unregister_device);
301 328
302 329
303static int dummy_nop(struct i2c_client *client) 330static int dummy_probe(struct i2c_client *client,
331 const struct i2c_device_id *id)
332{
333 return 0;
334}
335
336static int dummy_remove(struct i2c_client *client)
304{ 337{
305 return 0; 338 return 0;
306} 339}
307 340
308static struct i2c_driver dummy_driver = { 341static 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
145static int cs5345_probe(struct i2c_client *client) 145static 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
138static int cs53l32a_probe(struct i2c_client *client) 138static 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
1212static int cx25840_probe(struct i2c_client *client) 1212static 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
129static int m52790_probe(struct i2c_client *client) 129static 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
808static int msp_probe(struct i2c_client *client) 808static 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..26cb27604e04 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
623static int mt9m001_probe(struct i2c_client *client) 623static 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;
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c
index d4b9e2744343..7b1dd7ede9d0 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
748static int mt9v022_probe(struct i2c_client *client) 748static 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;
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
1453static int saa7115_probe(struct i2c_client *client) 1453static 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
664static int saa7127_probe(struct i2c_client *client) 664static 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/* ----------------------------------------------------------------------- */
1421static int saa717x_probe(struct i2c_client *client) 1421static 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
843static int tcm825x_probe(struct i2c_client *client) 843static 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
128static int tlv320aic23b_probe(struct i2c_client *client) 128static 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 */
1076static int tuner_probe(struct i2c_client *client) 1076static 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
1464static int chip_probe(struct i2c_client *client) 1464static 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
198static int upd64031a_probe(struct i2c_client *client) 198static 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
175static int upd64083_probe(struct i2c_client *client) 175static 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
712int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver, 712int 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
124static int vp27smpx_probe(struct i2c_client *client) 124static 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
264static int wm8739_probe(struct i2c_client *client) 264static 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
162static int wm8775_probe(struct i2c_client *client) 162static 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..67ba8ae3217c 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -326,7 +326,8 @@ static struct bin_attribute nvram = {
326 326
327static struct i2c_driver ds1307_driver; 327static struct i2c_driver ds1307_driver;
328 328
329static int __devinit ds1307_probe(struct i2c_client *client) 329static int __devinit ds1307_probe(struct i2c_client *client,
330 const struct i2c_device_id *id)
330{ 331{
331 struct ds1307 *ds1307; 332 struct ds1307 *ds1307;
332 int err = -ENODEV; 333 int err = -ENODEV;
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index 45bda186befc..104dcfd5d9a8 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -355,7 +355,8 @@ static const struct rtc_class_ops ds1374_rtc_ops = {
355 .ioctl = ds1374_ioctl, 355 .ioctl = ds1374_ioctl,
356}; 356};
357 357
358static int ds1374_probe(struct i2c_client *client) 358static int ds1374_probe(struct i2c_client *client,
359 const struct i2c_device_id *id)
359{ 360{
360 struct ds1374 *ds1374; 361 struct ds1374 *ds1374;
361 int ret; 362 int ret;
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index fb15e3fb4ce2..d75d8faeead0 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
492static int 492static int
493isl1208_probe(struct i2c_client *client) 493isl1208_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;
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index 1cb33cac1237..2ee0d070095a 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -756,7 +756,8 @@ static struct notifier_block wdt_notifier = {
756 * 756 *
757 ***************************************************************************** 757 *****************************************************************************
758 */ 758 */
759static int m41t80_probe(struct i2c_client *client) 759static int m41t80_probe(struct i2c_client *client,
760 const struct i2c_device_id *id)
760{ 761{
761 int i, rc = 0; 762 int i, rc = 0;
762 struct rtc_device *rtc = NULL; 763 struct rtc_device *rtc = NULL;
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index a41681d26eba..7b3c31db0fc0 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
249static int pcf8563_probe(struct i2c_client *client) 249static 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
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index 7e63074708eb..47db289bb0a3 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -494,7 +494,8 @@ static void rs5c_sysfs_unregister(struct device *dev)
494 494
495static struct i2c_driver rs5c372_driver; 495static struct i2c_driver rs5c372_driver;
496 496
497static int rs5c372_probe(struct i2c_client *client) 497static int rs5c372_probe(struct i2c_client *client,
498 const struct i2c_device_id *id)
498{ 499{
499 int err = 0; 500 int err = 0;
500 struct rs5c372 *rs5c372; 501 struct rs5c372 *rs5c372;
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index e8abc90c32c5..ab0c6d221404 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -195,7 +195,8 @@ static const struct rtc_class_ops s35390a_rtc_ops = {
195 195
196static struct i2c_driver s35390a_driver; 196static struct i2c_driver s35390a_driver;
197 197
198static int s35390a_probe(struct i2c_client *client) 198static int s35390a_probe(struct i2c_client *client,
199 const struct i2c_device_id *id)
199{ 200{
200 int err; 201 int err;
201 unsigned int i; 202 unsigned int i;
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c
index 095282f63523..b792ad4dcaa9 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
497static int x1205_probe(struct i2c_client *client) 497static 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;
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 365e0df3646b..89cb34d5b0ba 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;
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
376struct 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);
107struct i2c_driver; 107struct i2c_driver;
108struct i2c_adapter; 108struct i2c_adapter;
109struct i2c_client; 109struct i2c_client;
110struct i2c_device_id;
110 111
111int v4l2_i2c_attach(struct i2c_adapter *adapter, int address, struct i2c_driver *driver, 112int 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 */
580static 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 _ */
580static inline int sym_is(const char *symbol, const char *name) 589static 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