Thread (1 message) 1 message, 1 author, 2014-02-19

Re: [PATCH 2/2] of: reimplement the matching method for __of_match_node()

From: Kevin Hao <hidden>
Date: 2014-02-19 03:09:47

On Tue, Feb 18, 2014 at 10:29:18PM +0000, Grant Likely wrote:
On Tue, 18 Feb 2014 15:57:30 +0800, Kevin Hao [off-list ref] wrote:
quoted
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

This is based on some pseudo-codes provided by Grant Likely.
The patch looks good, but I wasn't confident applying it directly
without some validation, so I've written a test case for this function.
I'll resend the series to the list and cc you. Unfortunately I've found
one case that is failing on the test cases, but I'm too tired to debug
it now. Maybe you'd like to take a look. The test case may very well be
wrong.
The test case looks great. Actually there is a bug in this patch. I will make
new spin to fix it.

Thanks,
Kevin

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help