i2c: Simplify i2c_device_probe
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- drivers/i2c/i2c-core.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/i2c/i2c-core.c +2 -7
@@ -101,19 +101,14 @@ static int i2c_device_probe(struct devic {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;
Signature · 6 lines
Jean Delvare _______________________________________________ i2c mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/i2c
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 22 lines · Jean Delvare
i2c_driver.id_table is mandatory now, so we can simplify
i2c_device_probe()a bit.Signed-off-by Jean Delvare <[email protected]>--- drivers/i2c/i2c-core.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)drivers/i2c/i2c-core.c +1
-2@@ -101,19 +101,14 @@ static int i2c_device_probe(struct devic {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" );
drivers/i2c/i2c-core.c static int i2c_device_probe(struct devic · line 114
Quoted 10 lines
drivers/i2c/i2c-core.c +1
-5-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;
Looks ok, will give it a test tommorow if possible.
Quoted 3 lines
Signature · 2 lines
-- Jean Delvare
Signature · 11 lines
-- Ben Q: What's a light-year? A: One-third less calories than a regular year. _______________________________________________ i2c mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/i2c