diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 48e31ed69dbf..93fc5bfdb9b4 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -240,7 +240,7 @@ static int i2c_device_probe(struct device *dev) | |||
240 | return 0; | 240 | return 0; |
241 | 241 | ||
242 | driver = to_i2c_driver(dev->driver); | 242 | driver = to_i2c_driver(dev->driver); |
243 | if (!driver->probe || !driver->id_table) | 243 | if (!driver->probe || (!driver->id_table && !dev->driver->of_match_table)) |
244 | return -ENODEV; | 244 | return -ENODEV; |
245 | client->driver = driver; | 245 | client->driver = driver; |
246 | if (!device_can_wakeup(&client->dev)) | 246 | if (!device_can_wakeup(&client->dev)) |
@@ -248,7 +248,12 @@ static int i2c_device_probe(struct device *dev) | |||
248 | client->flags & I2C_CLIENT_WAKE); | 248 | client->flags & I2C_CLIENT_WAKE); |
249 | dev_dbg(dev, "probe\n"); | 249 | dev_dbg(dev, "probe\n"); |
250 | 250 | ||
251 | status = driver->probe(client, i2c_match_id(driver->id_table, client)); | 251 | if (of_match_device(dev->driver->of_match_table, dev)) |
252 | /* Device tree matching */ | ||
253 | status = driver->probe(client, NULL); | ||
254 | else | ||
255 | /* Fall back to matching the id_table */ | ||
256 | status = driver->probe(client, i2c_match_id(driver->id_table, client)); | ||
252 | if (status) { | 257 | if (status) { |
253 | client->driver = NULL; | 258 | client->driver = NULL; |
254 | i2c_set_clientdata(client, NULL); | 259 | i2c_set_clientdata(client, NULL); |