From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
To: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
Grant Likely
<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH v2] i2c: core: make it possible to match a pure device tree driver
Date: Wed, 12 Jun 2013 19:09:16 +0200 [thread overview]
Message-ID: <20130612170915.GA3018@katana> (raw)
In-Reply-To: <1368476301-10495-1-git-send-email-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2523 bytes --]
On Mon, May 13, 2013 at 10:18:21PM +0200, Linus Walleij wrote:
> This tries to address an issue found when writing an MFD driver
> for the Nomadik STw481x PMICs: as the platform is using device
> tree exclusively I want to specify the driver matching like
> this:
>
> static const struct of_device_id stw481x_match[] = {
> { .compatible = "st,stw4810", },
> { .compatible = "st,stw4811", },
> {},
> };
>
> static struct i2c_driver stw481x_driver = {
> .driver = {
> .name = "stw481x",
> .of_match_table = stw481x_match,
> },
> .probe = stw481x_probe,
> .remove = stw481x_remove,
> };
>
> However that turns out not to be possible: the I2C probe code
> is written so that the probe() call is always passed a match
> from i2c_match_id() using non-devicetree matches.
>
> This is probably why most devices using device tree for I2C
> clients currently will pass no .of_match_table *at all* but
> instead just use .id_table from struct i2c_driver to match
> the device. As you realize that means that the whole idea with
> compatible strings is discarded, and that is why we find strange
> device tree I2C device compatible strings like "product" instead
> of "vendor,product" as you could expect.
>
> Let's figure out how to fix this before the mess spreads. This
> patch will allow probeing devices with only an of_match_table
> as per above, and will pass NULL as the second argument to the
> probe() function. If the driver wants to deduce secondary info
> from the struct of_device_id .data field, it has to call
> of_match_device() on its own match table in the probe function
> device tree probe path.
>
> If drivers define both an .of_match_table *AND* a i2c_driver
> .id_table, the .of_match_table will take precedence, just
> as is done in the i2c_device_match() function in i2c-core.c.
>
> I2C devices probed from device tree should subsequently be
> fixed to handle the case where of_match_table() is
> used (I think none of them do that today), and platforms should
> fix their device trees to use compatible strings for I2C devices
> instead of setting the name to Linux device driver names as is
> done in multiple cases today.
>
> Cc: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
> Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Signed-off-by: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Applied to for-next, thanks!
Thanks also to Grant for the insight.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2013-06-12 17:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-13 20:18 [PATCH v2] i2c: core: make it possible to match a pure device tree driver Linus Walleij
[not found] ` <1368476301-10495-1-git-send-email-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-05-22 7:56 ` Linus Walleij
[not found] ` <CACRpkdae1chj9ZKuQV5MuiaicLUTKr4hZqr8rtjbB3Yjt+U_fg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-30 8:00 ` Linus Walleij
2013-06-17 15:48 ` Stephen Warren
[not found] ` <51BF2FC5.40207-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-06-17 16:33 ` Linus Walleij
[not found] ` <CACRpkdbjy+PcpNkSg4PuuP2Z9RyrnqSW0uchHFHVZ8VYPeoDyA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-17 16:49 ` Stephen Warren
2013-06-17 22:15 ` Grant Likely
[not found] ` <CACxGe6sTq=h9jjqesjvUA4Bweh7zgE4VOLoOTgGPC_D_v+8NtA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-17 23:25 ` Stephen Warren
2013-06-18 7:33 ` Wolfram Sang
2013-06-18 7:44 ` Linus Walleij
[not found] ` <CACRpkdakdUVzHM4L5qOJ5Ls8NwOimy197NCUDSP=X28d2fzHPg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-18 15:55 ` Wolfram Sang
2013-06-07 21:32 ` Wolfram Sang
2013-06-10 12:18 ` Linus Walleij
[not found] ` <CACRpkdbBsXB+9wN0oshfZB8Xady9G_wu9d8UkgA-bYqQe=8Mpw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-10 13:40 ` Wolfram Sang
2013-06-12 13:22 ` Grant Likely
2013-06-12 13:20 ` Grant Likely
2013-06-13 9:02 ` Linus Walleij
2013-06-12 17:09 ` Wolfram Sang [this message]
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=20130612170915.GA3018@katana \
--to=wsa-z923lk4zbo2bacvfa/9k2g@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@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).