lkml.org 
[lkml]   [2014]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH v4 2/4] of: reimplement the matching method for __of_match_node()
    Date
    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.


    \
     
     \ /
      Last update: 2014-02-19 21:01    [W:4.110 / U:0.068 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site