summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-11-03 21:53:09 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-11-15 08:34:54 +0100
commitbcf272af8bd11e4742c527d6e29c2687864f9988 (patch)
tree14c1e93e7de245fa07c9affcd181a47997727f91 /drivers/i2c
parent47e176461fbbff0b6f3ad863ef7f1fd3bc2d3c02 (diff)
downloadbarebox-bcf272af8bd11e4742c527d6e29c2687864f9988.tar.gz
barebox-bcf272af8bd11e4742c527d6e29c2687864f9988.tar.xz
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>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/i2c.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
index 92d9442f25..94f23dd854 100644
--- a/drivers/i2c/i2c.c
+++ b/drivers/i2c/i2c.c
@@ -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)