# Re: \[PATCH 2/2\] of: search the best compatible match first in \_\_of\_match\_node()

- From: Grant Likely \<hidden\>
- Date: 2014-02-17 17:59:59 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2014/02/8085632
- Thread: https://ratatoskr.run/linux-devicetree/2014/02/8085632/t.md

```text
On Fri, 14 Feb 2014 09:53:40 -0600, Rob Herring [ref] wrote:
> On Thu, Feb 13, 2014 at 11:22 PM, Kevin Hao [ref] wrote:
> > Currently, of_match_node compares each given match against all 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, this patch introduces a function to match each of the node's
> > compatible strings against all given compatible matches without type and
> > name first, before checking the next compatible string. This implies
> > that node's compatibles are ordered from specific to generic while
> > given matches can be in any order. If we fail to find such a match
> > entry, then fall-back to the old method in order to keep compatibility.
> >
> > Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> > Signed-off-by: Kevin Hao <redacted>
> 
> Looks good to me. I'll put this in next for a few days. I'd really
> like to see some acks and tested-by's before sending to Linus.

As I commented on the patch, I don't think the new solution is correct
either. I've made a suggestion on how to fix it, but in the mean time
the revert should be applied and sent to Linus.

g.
```
