]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
i2c: Simplify i2c_device_probe
authorJean Delvare <khali@linux-fr.org>
Mon, 14 Jul 2008 20:38:30 +0000 (22:38 +0200)
committerJean Delvare <khali@mahadeva.delvare>
Mon, 14 Jul 2008 20:38:30 +0000 (22:38 +0200)
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>
drivers/i2c/i2c-core.c

index e06067ebd2050c83a6bb5355d9c4a004a7985edf..d6cc58abf3ff0b648b4e188a1e0797549c1d1eb0 100644 (file)
@@ -101,19 +101,14 @@ static int i2c_device_probe(struct device *dev)
 {
        struct i2c_client       *client = to_i2c_client(dev);
        struct i2c_driver       *driver = to_i2c_driver(dev->driver);
-       const struct i2c_device_id *id;
        int status;
 
-       if (!driver->probe)
+       if (!driver->probe || !driver->id_table)
                return -ENODEV;
        client->driver = driver;
        dev_dbg(dev, "probe\n");
 
-       if (driver->id_table)
-               id = i2c_match_id(driver->id_table, client);
-       else
-               id = NULL;
-       status = driver->probe(client, id);
+       status = driver->probe(client, i2c_match_id(driver->id_table, client));
        if (status)
                client->driver = NULL;
        return status;