diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-10 15:49:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-10 15:49:32 -0400 |
commit | bc51b0c22cebf5c311a6f1895fcca9f78efd0478 (patch) | |
tree | 8465a0f8bf3559621aaab6d84d9f0d14831677d8 /drivers/of | |
parent | 2437fccfbfc83bcb868ccc7fdfe2b5310bf07835 (diff) |
Revert "of: match by compatible property first"
This reverts commit 107a84e61cdd3406c842a0e4be7efffd3a05dba6.
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 commit 107a84e61cdd.
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>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | drivers/of/base.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index eada3f4ef801..d9bfd49b1935 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -511,22 +511,6 @@ out: | |||
511 | } | 511 | } |
512 | EXPORT_SYMBOL(of_find_node_with_property); | 512 | EXPORT_SYMBOL(of_find_node_with_property); |
513 | 513 | ||
514 | static const struct of_device_id *of_match_compat(const struct of_device_id *matches, | ||
515 | const char *compat) | ||
516 | { | ||
517 | while (matches->name[0] || matches->type[0] || matches->compatible[0]) { | ||
518 | const char *cp = matches->compatible; | ||
519 | int len = strlen(cp); | ||
520 | |||
521 | if (len > 0 && of_compat_cmp(compat, cp, len) == 0) | ||
522 | return matches; | ||
523 | |||
524 | matches++; | ||
525 | } | ||
526 | |||
527 | return NULL; | ||
528 | } | ||
529 | |||
530 | /** | 514 | /** |
531 | * of_match_node - Tell if an device_node has a matching of_match structure | 515 | * of_match_node - Tell if an device_node has a matching of_match structure |
532 | * @matches: array of of device match structures to search in | 516 | * @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 | |||
537 | const struct of_device_id *of_match_node(const struct of_device_id *matches, | 521 | const struct of_device_id *of_match_node(const struct of_device_id *matches, |
538 | const struct device_node *node) | 522 | const struct device_node *node) |
539 | { | 523 | { |
540 | struct property *prop; | ||
541 | const char *cp; | ||
542 | |||
543 | if (!matches) | 524 | if (!matches) |
544 | return NULL; | 525 | return NULL; |
545 | 526 | ||
546 | of_property_for_each_string(node, "compatible", prop, cp) { | ||
547 | const struct of_device_id *match = of_match_compat(matches, cp); | ||
548 | if (match) | ||
549 | return match; | ||
550 | } | ||
551 | |||
552 | while (matches->name[0] || matches->type[0] || matches->compatible[0]) { | 527 | while (matches->name[0] || matches->type[0] || matches->compatible[0]) { |
553 | int match = 1; | 528 | int match = 1; |
554 | if (matches->name[0]) | 529 | if (matches->name[0]) |
@@ -557,7 +532,10 @@ const struct of_device_id *of_match_node(const struct of_device_id *matches, | |||
557 | if (matches->type[0]) | 532 | if (matches->type[0]) |
558 | match &= node->type | 533 | match &= node->type |
559 | && !strcmp(matches->type, node->type); | 534 | && !strcmp(matches->type, node->type); |
560 | if (match && !matches->compatible[0]) | 535 | if (matches->compatible[0]) |
536 | match &= of_device_is_compatible(node, | ||
537 | matches->compatible); | ||
538 | if (match) | ||
561 | return matches; | 539 | return matches; |
562 | matches++; | 540 | matches++; |
563 | } | 541 | } |