remarkable-linux/drivers/of
Kevin Hao 215a14cfac of: reimplement the matching method for __of_match_node()
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>
2014-02-20 11:50:58 +00:00
..
address.c of: fix PCI bus match for PCIe slots 2014-02-05 09:59:20 -06:00
base.c of: reimplement the matching method for __of_match_node() 2014-02-20 11:50:58 +00:00
device.c platform: introduce OF style 'modalias' support for platform bus 2014-01-17 01:59:15 +01:00
fdt.c of: Fix NULL dereference in unflatten_and_copy() 2013-12-11 13:40:30 +00:00
irq.c Merge remote-tracking branch 'grant/devicetree/next' into for-3.14 2014-01-17 16:01:27 -06:00
Kconfig of/Kconfig: Spelling s/one/once/ 2013-12-30 10:23:25 -06:00
Makefile Revert "drivers: of: add initialization code for dma reserved memory" 2013-10-15 09:26:07 +01:00
of_mdio.c phylib: Add of_phy_attach 2014-01-13 14:29:49 -08:00
of_mtd.c
of_net.c phylib: introduce PHY_INTERFACE_MODE_XGMII for 10G PHY 2014-01-13 14:29:48 -08:00
of_pci.c of: implement pci_address_to_pio as weak function 2013-10-09 20:04:06 -05:00
of_pci_irq.c Merge remote-tracking branch 'grant/devicetree/next' into for-next 2013-11-07 10:34:46 -06:00
of_private.h
pdt.c of: remove unnecessary prom.h includes 2013-10-09 20:03:59 -05:00
platform.c Merge branch 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm 2013-11-14 07:55:21 +09:00
selftest.c of/irq: create interrupts-extended property 2013-10-28 16:48:14 -07:00