devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>,
	Samuel Ortiz <sameo@linux.intel.com>,
	rabin.vincent@stericsson.com, shiraz.hashim@st.com,
	devicetree-discuss@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, spear-devel@list.st.com,
	linus.walleij@linaro.org,
	Vipul Kumar Samar <vipulkumar.samar@st.com>
Subject: Re: [PATCH V5 2/2] mfd: stmpe: Update DT support in stmpe driver
Date: Fri, 07 Dec 2012 13:44:22 +0000	[thread overview]
Message-ID: <20121207134422.738A23E0B87@localhost> (raw)
In-Reply-To: <CAKohponBkA+bg7B4TKaU6WbcVBNDHPe4AWqAEE6JGD7zctoULw@mail.gmail.com>

On Thu, 6 Dec 2012 08:06:20 +0530, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 6 December 2012 04:12, Grant Likely <grant.likely@secretlab.ca> wrote:
> > On Sat, 1 Dec 2012 00:33:46 +0530, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> >> This first tries to match the table my patch added, _BUT_ the string will
> >> never match as we had "st,stmpe810" in table and "stmpe810" in dev.
> >
> > of_driver_match_device() matches against the compatible list in
> > dev->of_node, not against the device name. So, if the compatible
> > property has a string that is in the table, then it really should match
> > against it.
> 
> Grant, but isn't it true that the final device's name would not be the DT
> way of names? It would simply be "stmpe810" for us and so if we have
> multiple instances of stmpe on a board, we need to distinguish them
> ourselves? One way for that was passing id for these instances, which
> would finally be used, when we create platform devices for sub-modules
> of stmpe (gpio, keypad, ts, etc).

of_modalias_node() is based on a *heruistic*. It is a best-effort
attempt to convert the node's compatible lists into a string that will
match against an existing driver. In the simple case it works because
historically i2c has used the chip name for the driver name. We get
lucky and a lot of drivers will work with DT without changes.

However, it is in no way guaranteed. Sometimes the strings won't line up
or a certain silicon vendor will have an extra errata or feature. In
that case it makes sense to use a DT match table that can parse the
entries in the compatible list. Or a driver can call of_ helper
functions. For example, it might call of_alias_get_id() to figure out
which device id it needs. That's why the full DT parsing exists. It's
the fallback when the simple heuristic fails. Only use it when you need
to.

g.

  reply	other threads:[~2012-12-07 13:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29 14:40 [PATCH V5 1/2] mfd: stmpe: Get rid of irq_invert_polarity Viresh Kumar
     [not found] ` <2dcd7cb4c4022fa24b5328974e4226f5aaf89419.1354199865.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-29 14:40   ` [PATCH V5 2/2] mfd: stmpe: Update DT support in stmpe driver Viresh Kumar
     [not found]     ` <121653def4e985b0c1b59045637dd4518f97e73a.1354199865.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-30 10:57       ` Samuel Ortiz
2012-11-30 12:45         ` Lee Jones
2012-11-30 13:11           ` Viresh Kumar
2012-11-30 13:20             ` Lee Jones
     [not found]               ` <20121130132036.GA23648-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-11-30 13:44                 ` Viresh Kumar
2012-11-30 15:45         ` Lee Jones
2012-11-30 19:03           ` Viresh Kumar
2012-12-05 13:03             ` Viresh Kumar
2012-12-05 13:19               ` Lee Jones
2012-12-05 13:24                 ` Viresh Kumar
2012-12-05 22:42             ` Grant Likely
2012-12-06  1:58               ` Viresh Kumar
2012-12-06  9:50                 ` Lee Jones
     [not found]                   ` <20121206095019.GN2718-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-12-06  9:56                     ` Viresh Kumar
     [not found]                       ` <CAKohpokNQB6L2vvjmvA7_3KomFXnV9wZ-uBjrfRVuBL=QWgr_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-06 10:11                         ` Lee Jones
2012-12-06 10:19                           ` Viresh Kumar
2012-12-06 10:35                             ` Lee Jones
2012-12-06 10:42                               ` Viresh Kumar
2012-12-06 11:12                                 ` Lee Jones
2012-12-06 11:19                                   ` Viresh Kumar
     [not found]                                     ` <CAKohponrZ8a+=ozXox60nRVBO174Nr=GoSjKkkz7KjLCxd5BhQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-12-06 11:33                                       ` Lee Jones
2012-12-07 13:37                 ` Grant Likely
2012-12-06  2:36               ` Viresh Kumar
2012-12-07 13:44                 ` Grant Likely [this message]
2012-12-01 16:49 ` [PATCH V5 1/2] mfd: stmpe: Get rid of irq_invert_polarity Linus Walleij

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=20121207134422.738A23E0B87@localhost \
    --to=grant.likely@secretlab.ca \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rabin.vincent@stericsson.com \
    --cc=sameo@linux.intel.com \
    --cc=shiraz.hashim@st.com \
    --cc=spear-devel@list.st.com \
    --cc=vipulkumar.samar@st.com \
    --cc=viresh.kumar@linaro.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).