Commit e0457442 authored by Jean Delvare's avatar Jean Delvare Committed by Jean Delvare

i2c: Simplify i2c_device_probe

i2c_driver.id_table is mandatory now, so we can simplify
i2c_device_probe() a bit.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 1b4dff9c
...@@ -101,19 +101,14 @@ static int i2c_device_probe(struct device *dev) ...@@ -101,19 +101,14 @@ static int i2c_device_probe(struct device *dev)
{ {
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct i2c_driver *driver = to_i2c_driver(dev->driver); struct i2c_driver *driver = to_i2c_driver(dev->driver);
const struct i2c_device_id *id;
int status; int status;
if (!driver->probe) if (!driver->probe || !driver->id_table)
return -ENODEV; return -ENODEV;
client->driver = driver; client->driver = driver;
dev_dbg(dev, "probe\n"); dev_dbg(dev, "probe\n");
if (driver->id_table) status = driver->probe(client, i2c_match_id(driver->id_table, client));
id = i2c_match_id(driver->id_table, client);
else
id = NULL;
status = driver->probe(client, id);
if (status) if (status)
client->driver = NULL; client->driver = NULL;
return status; return status;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment