Revert "of: match by compatible property first"
This reverts commit107a84e61c
. Meelis Roos reports a regression since 3.5-rc5 that stops Sun Fire V100 and Sun Netra X1 sparc64 machines from booting, hanging after enabling serial console. He bisected it to commit107a84e61c
. Rob Herring explains: "The problem is match combinations of compatible plus name and/or type fail to match correctly. I have a fix for this, but given how late it is for 3.5 I think it is best to revert this for now. There could be other cases that rely on the current although wrong behavior. I will post an updated version for 3.6." Bisected-and-reported-by: Meelis Roos <mroos@linux.ee> Requested-by: Rob Herring <rob.herring@calxeda.com> Cc: Thierry Reding <thierry.reding@avionic-design.de> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
2437fccfbf
commit
bc51b0c22c
|
@ -511,22 +511,6 @@ out:
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(of_find_node_with_property);
|
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
|
* of_match_node - Tell if an device_node has a matching of_match structure
|
||||||
* @matches: array of of device match structures to search in
|
* @matches: array of of device match structures to search in
|
||||||
|
@ -537,18 +521,9 @@ static const struct of_device_id *of_match_compat(const struct of_device_id *mat
|
||||||
const struct of_device_id *of_match_node(const struct of_device_id *matches,
|
const struct of_device_id *of_match_node(const struct of_device_id *matches,
|
||||||
const struct device_node *node)
|
const struct device_node *node)
|
||||||
{
|
{
|
||||||
struct property *prop;
|
|
||||||
const char *cp;
|
|
||||||
|
|
||||||
if (!matches)
|
if (!matches)
|
||||||
return NULL;
|
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]) {
|
while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
|
||||||
int match = 1;
|
int match = 1;
|
||||||
if (matches->name[0])
|
if (matches->name[0])
|
||||||
|
@ -557,7 +532,10 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches,
|
||||||
if (matches->type[0])
|
if (matches->type[0])
|
||||||
match &= node->type
|
match &= node->type
|
||||||
&& !strcmp(matches->type, node->type);
|
&& !strcmp(matches->type, node->type);
|
||||||
if (match && !matches->compatible[0])
|
if (matches->compatible[0])
|
||||||
|
match &= of_device_is_compatible(node,
|
||||||
|
matches->compatible);
|
||||||
|
if (match)
|
||||||
return matches;
|
return matches;
|
||||||
matches++;
|
matches++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue