Skip to content

Commit

Permalink
Merge branch 'fixes-for-grant' of git://sources.calxeda.com/kernel/linux
Browse files Browse the repository at this point in the history
Pull DT fixes from Rob Herring:
 "Mainly some documentation updates and 2 fixes:

   - An export symbol fix for of_platform_populate from Stephen W.
   - A fix for the order compatible entries are matched to ensure the
     first compatible string is matched when there are multiple matches."

Normally these would go through Grant Likely (thus the "fixes-for-grant"
branch name), but Grant is in the middle of moving to Scotland, and is
practically offline until sometime in August. So pull directly from Rob.

* 'fixes-for-grant' of git://sources.calxeda.com/kernel/linux:
  of: match by compatible property first
  dt: mc13xxx.txt: Fix gpio number assignment
  dt: fsl-fec.txt: Fix gpio number assignment
  dt: fsl-mma8450.txt: Add missing 'reg' description
  dt: fsl-imx-esdhc.txt: Fix gpio number assignment
  dt: fsl-imx-cspi.txt: Fix comment about GPIOs used for chip selects
  of: Add Avionic Design vendor prefix
  of: export of_platform_populate()
  • Loading branch information
Linus Torvalds committed Jul 5, 2012
2 parents 9e85a6f + 107a84e commit 62ad644
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 11 deletions.
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/input/fsl-mma8450.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Required properties:
- compatible : "fsl,mma8450".
- reg: the I2C address of MMA8450

Example:

Expand Down
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/mfd/mc13xxx.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ Examples:

ecspi@70010000 { /* ECSPI1 */
fsl,spi-num-chipselects = <2>;
cs-gpios = <&gpio3 24 0>, /* GPIO4_24 */
<&gpio3 25 0>; /* GPIO4_25 */
cs-gpios = <&gpio4 24 0>, /* GPIO4_24 */
<&gpio4 25 0>; /* GPIO4_25 */
status = "okay";

pmic: mc13892@0 {
Expand Down
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ esdhc@70008000 {
compatible = "fsl,imx51-esdhc";
reg = <0x70008000 0x4000>;
interrupts = <2>;
cd-gpios = <&gpio0 6 0>; /* GPIO1_6 */
wp-gpios = <&gpio0 5 0>; /* GPIO1_5 */
cd-gpios = <&gpio1 6 0>; /* GPIO1_6 */
wp-gpios = <&gpio1 5 0>; /* GPIO1_5 */
};
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/net/fsl-fec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ ethernet@83fec000 {
reg = <0x83fec000 0x4000>;
interrupts = <87>;
phy-mode = "mii";
phy-reset-gpios = <&gpio1 14 0>; /* GPIO2_14 */
phy-reset-gpios = <&gpio2 14 0>; /* GPIO2_14 */
local-mac-address = [00 04 9F 01 1B B9];
};
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ ecspi@70010000 {
reg = <0x70010000 0x4000>;
interrupts = <36>;
fsl,spi-num-chipselects = <2>;
cs-gpios = <&gpio3 24 0>, /* GPIO4_24 */
<&gpio3 25 0>; /* GPIO4_25 */
cs-gpios = <&gpio3 24 0>, /* GPIO3_24 */
<&gpio3 25 0>; /* GPIO3_25 */
};
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/vendor-prefixes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Device tree binding vendor prefix registry. Keep list in alphabetical order.
This isn't an exhaustive list, but you should add new prefixes to it before
using them to avoid name-space collisions.

ad Avionic Design GmbH
adi Analog Devices, Inc.
amcc Applied Micro Circuits Corporation (APM, formally AMCC)
apm Applied Micro Circuits Corporation (APM)
Expand Down
30 changes: 26 additions & 4 deletions drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,22 @@ struct device_node *of_find_node_with_property(struct device_node *from,
}
EXPORT_SYMBOL(of_find_node_with_property);

static const struct of_device_id *of_match_compat(const struct of_device_id *matches,
const char *compat)
{
while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
const char *cp = matches->compatible;
int len = strlen(cp);

if (len > 0 && of_compat_cmp(compat, cp, len) == 0)
return matches;

matches++;
}

return NULL;
}

/**
* of_match_node - Tell if an device_node has a matching of_match structure
* @matches: array of of device match structures to search in
Expand All @@ -521,9 +537,18 @@ EXPORT_SYMBOL(of_find_node_with_property);
const struct of_device_id *of_match_node(const struct of_device_id *matches,
const struct device_node *node)
{
struct property *prop;
const char *cp;

if (!matches)
return NULL;

of_property_for_each_string(node, "compatible", prop, cp) {
const struct of_device_id *match = of_match_compat(matches, cp);
if (match)
return match;
}

while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
int match = 1;
if (matches->name[0])
Expand All @@ -532,10 +557,7 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches,
if (matches->type[0])
match &= node->type
&& !strcmp(matches->type, node->type);
if (matches->compatible[0])
match &= of_device_is_compatible(node,
matches->compatible);
if (match)
if (match && !matches->compatible[0])
return matches;
matches++;
}
Expand Down
1 change: 1 addition & 0 deletions drivers/of/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,4 +462,5 @@ int of_platform_populate(struct device_node *root,
of_node_put(root);
return rc;
}
EXPORT_SYMBOL_GPL(of_platform_populate);
#endif /* CONFIG_OF_ADDRESS */

0 comments on commit 62ad644

Please sign in to comment.