aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@linaro.org>2014-11-24 09:50:07 -0500
committerGrant Likely <grant.likely@linaro.org>2014-11-24 09:50:07 -0500
commit66e6a5a1fcd2f3e05f4d499b539a1f77ceb52d1d (patch)
treed72f980f64b88ea4e976215a503fcb038e02f981 /drivers/of
parent2d0747c4b68be8eb8ccfa2c538f2f5dd2ea89094 (diff)
parent5d01410fe4d92081f349b013a2e7a95429e4f2c9 (diff)
Merge tag 'v3.18-rc6' into devicetree/next
v3.18-rc6 contains an important DT bug fix, c1a2086e2d, "of/selftest: Fix off-by-one error in removal path" which affects testing of the overlay patch series. Merge it into the devicetree/next staging branch so that the overlay patches are applied on top of a known working tree. Linux 3.18-rc6 Conflicts: drivers/of/address.c
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/address.c19
-rw-r--r--drivers/of/dynamic.c2
-rw-r--r--drivers/of/fdt.c2
-rw-r--r--drivers/of/unittest.c11
4 files changed, 26 insertions, 8 deletions
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 78f02f65fc48..ad2906919d45 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -450,6 +450,21 @@ static struct of_bus *of_match_bus(struct device_node *np)
450 return NULL; 450 return NULL;
451} 451}
452 452
453static int of_empty_ranges_quirk(void)
454{
455 if (IS_ENABLED(CONFIG_PPC)) {
456 /* To save cycles, we cache the result */
457 static int quirk_state = -1;
458
459 if (quirk_state < 0)
460 quirk_state =
461 of_machine_is_compatible("Power Macintosh") ||
462 of_machine_is_compatible("MacRISC");
463 return quirk_state;
464 }
465 return false;
466}
467
453static int of_translate_one(struct device_node *parent, struct of_bus *bus, 468static int of_translate_one(struct device_node *parent, struct of_bus *bus,
454 struct of_bus *pbus, __be32 *addr, 469 struct of_bus *pbus, __be32 *addr,
455 int na, int ns, int pna, const char *rprop) 470 int na, int ns, int pna, const char *rprop)
@@ -475,12 +490,10 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus,
475 * This code is only enabled on powerpc. --gcl 490 * This code is only enabled on powerpc. --gcl
476 */ 491 */
477 ranges = of_get_property(parent, rprop, &rlen); 492 ranges = of_get_property(parent, rprop, &rlen);
478#if !defined(CONFIG_PPC) 493 if (ranges == NULL && !of_empty_ranges_quirk()) {
479 if (ranges == NULL) {
480 pr_debug("OF: no ranges; cannot translate\n"); 494 pr_debug("OF: no ranges; cannot translate\n");
481 return 1; 495 return 1;
482 } 496 }
483#endif /* !defined(CONFIG_PPC) */
484 if (ranges == NULL || rlen == 0) { 497 if (ranges == NULL || rlen == 0) {
485 offset = of_read_number(addr, na); 498 offset = of_read_number(addr, na);
486 memset(addr, 0, pna * 4); 499 memset(addr, 0, pna * 4);
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index da2509d639c8..d43f3059963b 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -234,7 +234,7 @@ void of_node_release(struct kobject *kobj)
234 * @allocflags: Allocation flags (typically pass GFP_KERNEL) 234 * @allocflags: Allocation flags (typically pass GFP_KERNEL)
235 * 235 *
236 * Copy a property by dynamically allocating the memory of both the 236 * Copy a property by dynamically allocating the memory of both the
237 * property stucture and the property name & contents. The property's 237 * property structure and the property name & contents. The property's
238 * flags have the OF_DYNAMIC bit set so that we can differentiate between 238 * flags have the OF_DYNAMIC bit set so that we can differentiate between
239 * dynamically allocated properties and not. 239 * dynamically allocated properties and not.
240 * Returns the newly allocated property or NULL on out of memory error. 240 * Returns the newly allocated property or NULL on out of memory error.
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index cb19adfb3933..7f6ee31d5650 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -775,7 +775,7 @@ int __init early_init_dt_scan_chosen_serial(void)
775 if (offset < 0) 775 if (offset < 0)
776 return -ENODEV; 776 return -ENODEV;
777 777
778 while (match->compatible) { 778 while (match->compatible[0]) {
779 unsigned long addr; 779 unsigned long addr;
780 if (fdt_node_check_compatible(fdt, offset, match->compatible)) { 780 if (fdt_node_check_compatible(fdt, offset, match->compatible)) {
781 match++; 781 match++;
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 082bb2b6a5ad..46af7019d291 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -908,10 +908,14 @@ static void selftest_data_remove(void)
908 return; 908 return;
909 } 909 }
910 910
911 while (last_node_index >= 0) { 911 while (last_node_index-- > 0) {
912 if (nodes[last_node_index]) { 912 if (nodes[last_node_index]) {
913 np = of_find_node_by_path(nodes[last_node_index]->full_name); 913 np = of_find_node_by_path(nodes[last_node_index]->full_name);
914 if (strcmp(np->full_name, "/aliases") != 0) { 914 if (np == nodes[last_node_index]) {
915 if (of_aliases == np) {
916 of_node_put(of_aliases);
917 of_aliases = NULL;
918 }
915 detach_node_and_children(np); 919 detach_node_and_children(np);
916 } else { 920 } else {
917 for_each_property_of_node(np, prop) { 921 for_each_property_of_node(np, prop) {
@@ -920,7 +924,6 @@ static void selftest_data_remove(void)
920 } 924 }
921 } 925 }
922 } 926 }
923 last_node_index--;
924 } 927 }
925} 928}
926 929
@@ -933,6 +936,8 @@ static int __init of_selftest(void)
933 res = selftest_data_add(); 936 res = selftest_data_add();
934 if (res) 937 if (res)
935 return res; 938 return res;
939 if (!of_aliases)
940 of_aliases = of_find_node_by_path("/aliases");
936 941
937 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); 942 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
938 if (!np) { 943 if (!np) {