From: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org
Cc: linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: [PATCH 3/3] i2c: Make I2C ID tables non-mandatory for DT'ed and/or ACPI'ed devices
Date: Mon, 2 Jun 2014 14:41:03 +0100 [thread overview]
Message-ID: <1401716463-23457-4-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1401716463-23457-1-git-send-email-lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Currently the I2C framework insists on devices supplying an I2C ID
table. Many of the devices which do so unnecessarily adding quite a
few wasted lines to kernel code. This patch allows drivers a means
to 'not' supply the aforementioned table and match on either DT
and/or ACPI match tables instead.
Signed-off-by: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
drivers/i2c/i2c-core.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index d0c7180..811b78f 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -271,7 +271,18 @@ static int i2c_device_probe(struct device *dev)
return 0;
driver = to_i2c_driver(dev->driver);
- if (!driver->probe || !driver->id_table)
+ if (!driver->probe)
+ return -EINVAL;
+
+ /*
+ * An I2C ID table is not madatory, if and only if, a suitable Device
+ * Tree and/or ACPI match table entry is supplied for the probing
+ * device.
+ *
+ * TODO: Provide 'device type' to 'ACPI node' call and match here.
+ */
+ if (!driver->id_table &&
+ !of_match_device(dev->driver->of_match_table, dev))
return -ENODEV;
if (!device_can_wakeup(&client->dev))
--
1.8.3.2
next prev parent reply other threads:[~2014-06-02 13:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-02 13:41 [PATCH 0/3] i2c: Relax requirement for I2C Device ID tables Lee Jones
2014-06-02 13:41 ` [PATCH 1/3] i2c: Provide 'device type' to 'OF device node' look-up Lee Jones
[not found] ` <1401716463-23457-2-git-send-email-lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-06-02 13:57 ` Lee Jones
2014-06-02 16:06 ` Grant Likely
[not found] ` <20140602160631.F2F6DC40476-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2014-06-02 16:19 ` Lee Jones
2014-06-02 13:41 ` [PATCH 2/3] i2c: Add pointer dereference protection to i2c_match_id() Lee Jones
2014-06-02 16:07 ` Grant Likely
[not found] ` <1401716463-23457-1-git-send-email-lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-06-02 13:41 ` Lee Jones [this message]
[not found] ` <1401716463-23457-4-git-send-email-lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-06-02 14:34 ` [PATCH 3/3] i2c: Make I2C ID tables non-mandatory for DT'ed and/or ACPI'ed devices One Thousand Gnomes
[not found] ` <20140602153417.2065c1a5-mUKnrFFms3BCCTY1wZZT65JpZx93mCW/@public.gmane.org>
2014-06-03 8:11 ` Lee Jones
2014-06-02 16:08 ` Grant Likely
[not found] ` <20140602160829.F3519C40476-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2014-06-03 8:11 ` Lee Jones
2014-06-03 9:18 ` Grant Likely
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=1401716463-23457-4-git-send-email-lee.jones@linaro.org \
--to=lee.jones-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.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;
as well as URLs for NNTP newsgroup(s).