9
0
Fork 0

i2c: add id_table support

this will be use by at24 driver

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2012-11-03 21:53:09 +01:00 committed by Sascha Hauer
parent 47e176461f
commit bcf272af8b
1 changed files with 16 additions and 1 deletions

View File

@ -420,7 +420,22 @@ EXPORT_SYMBOL(i2c_add_numbered_adapter);
static int i2c_match(struct device_d *dev, struct driver_d *drv)
{
return strcmp(dev->name, drv->name) ? -1 : 0;
if (!strcmp(dev->name, drv->name))
return 0;
if (drv->id_table) {
struct platform_device_id *id = drv->id_table;
while (id->name) {
if (!strcmp(id->name, dev->name)) {
dev->id_entry = id;
return 0;
}
id++;
}
}
return -1;
}
static int i2c_probe(struct device_d *dev)