From: Grant Likely <grant.likely@linaro.org>
To: Rob Herring <robherring2@gmail.com>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Kevin Hao <haokexin@gmail.com>, Rob Herring <robh+dt@kernel.org>,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: [PATCH v4 2/4] of: reimplement the matching method for __of_match_node()
Date: Wed, 19 Feb 2014 15:34:41 +0000 [thread overview]
Message-ID: <20140219153441.5A271C4088D@trevor.secretlab.ca> (raw)
In-Reply-To: <CAL_JsqLbjK02Z1qzfP9K+Grp2WwAth8rMctK9myf8ZwJA6PUGQ@mail.gmail.com>
On Wed, 19 Feb 2014 08:54:57 -0600, Rob Herring <robherring2@gmail.com> wrote:
> On Wed, Feb 19, 2014 at 8:14 AM, Grant Likely <grant.likely@linaro.org> wrote:
> > From: Kevin Hao <haokexin@gmail.com>
> >
> > In the current implementation of __of_match_node(), it will compare
> > each given match entry against all the node's compatible strings
> > with of_device_is_compatible().
> >
> > To achieve multiple compatible strings per node with ordering from
> > specific to generic, this requires given matches to be ordered from
> > specific to generic. For most of the drivers this is not true and
> > also an alphabetical ordering is more sane there.
> >
> > Therefore, we define a following priority order for the match, and
> > then scan all the entries to find the best match.
> > 1. specific compatible && type && name
> > 2. specific compatible && type
> > 3. specific compatible && name
> > 4. specific compatible
> > 5. general compatible && type && name
> > 6. general compatible && type
> > 7. general compatible && name
> > 8. general compatible
> > 9. type && name
> > 10. type
> > 11. name
>
> While I agree this should be the right order, I worry that this may be
> changing the matching in some case as all previous attempts have done.
True, but they should be few and far between, and they can be
fixed up with bugfixes in drivers. This time we actually have test cases
that show the behaviour is correct. The previous versions failed the
current test cases (I checked).
> > + /* Compatible match has highest priority */
> > + if (compat && compat[0]) {
> > + cp = __of_get_property(device, "compatible", &cplen);
> > + if (!cp)
> > + return 0;
> > + for (index = 0; cplen > 0; index++, cp += l, cplen -= l) {
> > + l = strlen(cp) + 1;
>
> This could use of_property_for_each_string.
Good point. Changed.
g.
next prev parent reply other threads:[~2014-02-19 15:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 14:14 [PATCH v4 0/4] Bugfix for of_match_node ordering Grant Likely
[not found] ` < CAK9yfHwwmZkFMRvxsxjBAfUbVXU3V+iPFDZO=DwQsFvJ3NQyKA@mail.gmail.com>
[not found] ` < 1392819290-1044-3-git-send-email-grant.likely@linaro.org>
2014-02-19 14:14 ` [PATCH v4 1/4] Revert "of: search the best compatible match first in __of_match_node()" Grant Likely
2014-02-19 14:14 ` [PATCH v4 2/4] of: reimplement the matching method for __of_match_node() Grant Likely
2014-02-19 14:54 ` Rob Herring
2014-02-19 15:34 ` Grant Likely [this message]
2014-02-19 14:14 ` [PATCH v4 3/4] of: Move testcase FDT data into drivers/of Grant Likely
2014-02-19 14:14 ` [PATCH v4 4/4] of: Add self test for of_match_node() Grant Likely
2014-02-20 8:39 ` [PATCH v4 0/4] Bugfix for of_match_node ordering Sachin Kamat
2014-02-20 10:12 ` Kevin Hao
2014-02-20 10:27 ` Sachin Kamat
2014-02-20 10:55 ` Kevin Hao
2014-02-20 11:13 ` Sachin Kamat
2014-02-20 11:53 ` Grant Likely
2014-02-20 11:29 ` Grant Likely
2014-02-21 1:22 ` Sören Brinkmann
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=20140219153441.5A271C4088D@trevor.secretlab.ca \
--to=grant.likely@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=haokexin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=robherring2@gmail.com \
--cc=sebastian.hesselbarth@gmail.com \
/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
all inboxes | Powered by JetHome®