mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 3/3] i2c: add id_table support
Date: Sat,  3 Nov 2012 21:53:09 +0100	[thread overview]
Message-ID: <1351975989-8218-3-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1351975989-8218-1-git-send-email-plagnioj@jcrosoft.com>

this will be use by at24 driver

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/i2c/i2c.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
index 92d9442..94f23dd 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)
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-11-03 20:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-03 20:46 [PATCH 0/3] i2c fix + prepare for at24 support Jean-Christophe PLAGNIOL-VILLARD
2012-11-03 20:53 ` [PATCH 1/3] i2c: algo-bit add missing acknak Jean-Christophe PLAGNIOL-VILLARD
2012-11-03 20:53   ` [PATCH 2/3] i2c: introduce i2c_new_dummy Jean-Christophe PLAGNIOL-VILLARD
2012-11-03 20:53   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-11-12  7:40 ` [PATCH 0/3] i2c fix + prepare for at24 support Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1351975989-8218-3-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox