https://github.com/torvalds/linux
Revision 215a14cface21ba205f6edc813be157fdf7899b8 authored by Kevin Hao on 19 February 2014, 08:15:45 UTC, committed by Grant Likely on 20 February 2014, 11:50:58 UTC
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

v5: Fix nested locking bug
v4: Short-circuit failure cases instead of mucking with score, and
    remove extra __of_device_is_compatible() wrapper stub.
    Move scoring logic directly into __of_device_is_compatible()
v3: Also need to bail out when there does have a compatible member in match
    entry, but it doesn't match with the device node's compatible.
v2: Fix the bug such as we get the same score for the following two match
    entries with the empty node 'name2 { };'
	struct of_device_id matches[] = {
		{.name = "name2", },
		{.name = "name2", .type = "type1", },
		{}
	};

Signed-off-by: Kevin Hao <haokexin@gmail.com>
[grant.likely: added v4 changes]
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Tested-by: Stephen Chivers <schivers@csc.com>
Tested-by: Sachin Kamat <sachin.kamat@linaro.org>
1 parent 71c5498
Raw File
Tip revision: 215a14cface21ba205f6edc813be157fdf7899b8 authored by Kevin Hao on 19 February 2014, 08:15:45 UTC
of: reimplement the matching method for __of_match_node()
Tip revision: 215a14c
README.AddingFirmware

	DO NOT ADD FIRMWARE TO THIS DIRECTORY.
	======================================

This directory is only here to contain firmware images extracted from old
device drivers which predate the common use of request_firmware().

As we update those drivers to use request_firmware() and keep a clean
separation between code and firmware, we put the extracted firmware
here.

This directory is _NOT_ for adding arbitrary new firmware images. The
place to add those is the separate linux-firmware repository:

    git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git

That repository contains all these firmware images which have been
extracted from older drivers, as well various new firmware images which
we were never permitted to include in a GPL'd work, but which we _have_
been permitted to redistribute under separate cover.

To submit firmware to that repository, please send either a git binary
diff or preferably a git pull request to:
      David Woodhouse <dwmw2@infradead.org>
      Ben Hutchings <ben@decadent.org.uk>

Your commit should include an update to the WHENCE file clearly
identifying the licence under which the firmware is available, and
that it is redistributable. If the licence is long and involved, it's
permitted to include it in a separate file and refer to it from the
WHENCE file.

Ideally, your commit should contain a Signed-Off-By: from someone
authoritative on the licensing of the firmware in question (i.e. from
within the company that owns the code).
back to top