[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140219153441.5A271C4088D@trevor.secretlab.ca>
Date: Wed, 19 Feb 2014 15:34:41 +0000
From: Grant Likely <grant.likely@...aro.org>
To: Rob Herring <robherring2@...il.com>
Cc: "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Kevin Hao <haokexin@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>
Subject: Re: [PATCH v4 2/4] of: reimplement the matching method for __of_match_node()
On Wed, 19 Feb 2014 08:54:57 -0600, Rob Herring <robherring2@...il.com> wrote:
> On Wed, Feb 19, 2014 at 8:14 AM, Grant Likely <grant.likely@...aro.org> wrote:
> > From: Kevin Hao <haokexin@...il.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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists