From: Ben Dooks <ben.dooks@codethink.co.uk>
To: linux-i2c@vger.kernel.org, wsa@the-dreams.de
Cc: linux-kernel@lists.codethink.co.uk,
Ben Dooks <ben.dooks@codethink.co.uk>
Subject: [PATCH] i2c-core: allow either old or of_matching of devices
Date: Wed, 23 Sep 2015 15:41:15 +0100 [thread overview]
Message-ID: <1443019275-12753-1-git-send-email-ben.dooks@codethink.co.uk> (raw)
If an i2c-driver does not have an Linux specific id_table, but does
have an of_match_table available then allow that to be probed by
the i2c core code.
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
drivers/i2c/i2c-core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 5f89f1e..073c130 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -455,6 +455,9 @@ static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
static const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id,
const struct i2c_client *client)
{
+ if (!id)
+ return NULL;
+
while (id->name[0]) {
if (strcmp(client->name, id->name) == 0)
return id;
@@ -662,7 +665,7 @@ static int i2c_device_probe(struct device *dev)
}
driver = to_i2c_driver(dev->driver);
- if (!driver->probe || !driver->id_table)
+ if (!driver->probe || !(driver->id_table || dev->driver->of_match_table))
return -ENODEV;
if (client->flags & I2C_CLIENT_WAKE) {
--
2.5.1
reply other threads:[~2015-09-23 14:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1443019275-12753-1-git-send-email-ben.dooks@codethink.co.uk \
--to=ben.dooks@codethink.co.uk \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@lists.codethink.co.uk \
--cc=wsa@the-dreams.de \
/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;
as well as URLs for NNTP newsgroup(s).