aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-07-14 16:38:30 -0400
committerJean Delvare <khali@mahadeva.delvare>2008-07-14 16:38:30 -0400
commite0457442fd522107204da14a2dc2cbbb5dcac5f6 (patch)
treec489c15479cab107cb435a875e8119d10be5fc04 /drivers/i2c
parent1b4dff9cd37d430bc76112396e92bb3552f37ccd (diff)
i2c: Simplify i2c_device_probe
i2c_driver.id_table is mandatory now, so we can simplify i2c_device_probe() a bit. Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/i2c-core.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index e06067ebd205..d6cc58abf3ff 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -101,19 +101,14 @@ static int i2c_device_probe(struct device *dev)
101{ 101{
102 struct i2c_client *client = to_i2c_client(dev); 102 struct i2c_client *client = to_i2c_client(dev);
103 struct i2c_driver *driver = to_i2c_driver(dev->driver); 103 struct i2c_driver *driver = to_i2c_driver(dev->driver);
104 const struct i2c_device_id *id;
105 int status; 104 int status;
106 105
107 if (!driver->probe) 106 if (!driver->probe || !driver->id_table)
108 return -ENODEV; 107 return -ENODEV;
109 client->driver = driver; 108 client->driver = driver;
110 dev_dbg(dev, "probe\n"); 109 dev_dbg(dev, "probe\n");
111 110
112 if (driver->id_table) 111 status = driver->probe(client, i2c_match_id(driver->id_table, client));
113 id = i2c_match_id(driver->id_table, client);
114 else
115 id = NULL;
116 status = driver->probe(client, id);
117 if (status) 112 if (status)
118 client->driver = NULL; 113 client->driver = NULL;
119 return status; 114 return status;