aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2015-02-04 11:43:01 -0500
committerRob Herring <robh@kernel.org>2015-02-04 11:43:01 -0500
commit962a70d05edac2e2eb53cd077715930083964b9e (patch)
treef0b3a7bd574b2edfa76ce960e7f8630aea77e257 /drivers/of
parent10638a4ed2b8618f20fabf9ed19df60a68446e90 (diff)
parent26bc420b59a38e4e6685a73345a0def461136dce (diff)
Merge tag 'v3.19-rc6' into HEAD
Linux 3.19-rc6
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/overlay.c11
-rw-r--r--drivers/of/platform.c9
-rw-r--r--drivers/of/unittest-data/tests-overlay.dtsi55
-rw-r--r--drivers/of/unittest.c39
4 files changed, 103 insertions, 11 deletions
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index ea63fbd228ed..352b4f28f82c 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -114,17 +114,6 @@ static int of_overlay_apply_single_device_node(struct of_overlay *ov,
114 ret = of_overlay_apply_one(ov, tchild, child); 114 ret = of_overlay_apply_one(ov, tchild, child);
115 if (ret) 115 if (ret)
116 return ret; 116 return ret;
117
118 /* The properties are already copied, now do the child nodes */
119 for_each_child_of_node(child, grandchild) {
120 ret = of_overlay_apply_single_device_node(ov, tchild, grandchild);
121 if (ret) {
122 pr_err("%s: Failed to apply single node @%s/%s\n",
123 __func__, tchild->full_name,
124 grandchild->name);
125 return ret;
126 }
127 }
128 } 117 }
129 118
130 return ret; 119 return ret;
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index a54ec1087fd2..b0d50d70a8a1 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -566,6 +566,10 @@ static int of_platform_notify(struct notifier_block *nb,
566 if (!of_node_check_flag(rd->dn->parent, OF_POPULATED_BUS)) 566 if (!of_node_check_flag(rd->dn->parent, OF_POPULATED_BUS))
567 return NOTIFY_OK; /* not for us */ 567 return NOTIFY_OK; /* not for us */
568 568
569 /* already populated? (driver using of_populate manually) */
570 if (of_node_check_flag(rd->dn, OF_POPULATED))
571 return NOTIFY_OK;
572
569 /* pdev_parent may be NULL when no bus platform device */ 573 /* pdev_parent may be NULL when no bus platform device */
570 pdev_parent = of_find_device_by_node(rd->dn->parent); 574 pdev_parent = of_find_device_by_node(rd->dn->parent);
571 pdev = of_platform_device_create(rd->dn, NULL, 575 pdev = of_platform_device_create(rd->dn, NULL,
@@ -581,6 +585,11 @@ static int of_platform_notify(struct notifier_block *nb,
581 break; 585 break;
582 586
583 case OF_RECONFIG_CHANGE_REMOVE: 587 case OF_RECONFIG_CHANGE_REMOVE:
588
589 /* already depopulated? */
590 if (!of_node_check_flag(rd->dn, OF_POPULATED))
591 return NOTIFY_OK;
592
584 /* find our device by node */ 593 /* find our device by node */
585 pdev = of_find_device_by_node(rd->dn); 594 pdev = of_find_device_by_node(rd->dn);
586 if (pdev == NULL) 595 if (pdev == NULL)
diff --git a/drivers/of/unittest-data/tests-overlay.dtsi b/drivers/of/unittest-data/tests-overlay.dtsi
index 75976da22b2e..a2b687d5f324 100644
--- a/drivers/of/unittest-data/tests-overlay.dtsi
+++ b/drivers/of/unittest-data/tests-overlay.dtsi
@@ -176,5 +176,60 @@
176 }; 176 };
177 }; 177 };
178 178
179 overlay10 {
180 fragment@0 {
181 target-path = "/testcase-data/overlay-node/test-bus";
182 __overlay__ {
183
184 /* suppress DTC warning */
185 #address-cells = <1>;
186 #size-cells = <0>;
187
188 test-selftest10 {
189 compatible = "selftest";
190 status = "okay";
191 reg = <10>;
192
193 #address-cells = <1>;
194 #size-cells = <0>;
195
196 test-selftest101 {
197 compatible = "selftest";
198 status = "okay";
199 reg = <1>;
200 };
201
202 };
203 };
204 };
205 };
206
207 overlay11 {
208 fragment@0 {
209 target-path = "/testcase-data/overlay-node/test-bus";
210 __overlay__ {
211
212 /* suppress DTC warning */
213 #address-cells = <1>;
214 #size-cells = <0>;
215
216 test-selftest11 {
217 compatible = "selftest";
218 status = "okay";
219 reg = <11>;
220
221 #address-cells = <1>;
222 #size-cells = <0>;
223
224 test-selftest111 {
225 compatible = "selftest";
226 status = "okay";
227 reg = <1>;
228 };
229
230 };
231 };
232 };
233 };
179 }; 234 };
180}; 235};
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 139363af5c88..12cdbc1e3042 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -935,6 +935,9 @@ static int selftest_probe(struct platform_device *pdev)
935 } 935 }
936 936
937 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name); 937 dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name);
938
939 of_platform_populate(np, NULL, NULL, &pdev->dev);
940
938 return 0; 941 return 0;
939} 942}
940 943
@@ -1342,6 +1345,39 @@ static void of_selftest_overlay_8(void)
1342 selftest(1, "overlay test %d passed\n", 8); 1345 selftest(1, "overlay test %d passed\n", 8);
1343} 1346}
1344 1347
1348/* test insertion of a bus with parent devices */
1349static void of_selftest_overlay_10(void)
1350{
1351 int ret;
1352 char *child_path;
1353
1354 /* device should disable */
1355 ret = of_selftest_apply_overlay_check(10, 10, 0, 1);
1356 if (selftest(ret == 0, "overlay test %d failed; overlay application\n", 10))
1357 return;
1358
1359 child_path = kasprintf(GFP_KERNEL, "%s/test-selftest101",
1360 selftest_path(10));
1361 if (selftest(child_path, "overlay test %d failed; kasprintf\n", 10))
1362 return;
1363
1364 ret = of_path_platform_device_exists(child_path);
1365 kfree(child_path);
1366 if (selftest(ret, "overlay test %d failed; no child device\n", 10))
1367 return;
1368}
1369
1370/* test insertion of a bus with parent devices (and revert) */
1371static void of_selftest_overlay_11(void)
1372{
1373 int ret;
1374
1375 /* device should disable */
1376 ret = of_selftest_apply_revert_overlay_check(11, 11, 0, 1);
1377 if (selftest(ret == 0, "overlay test %d failed; overlay application\n", 11))
1378 return;
1379}
1380
1345static void __init of_selftest_overlay(void) 1381static void __init of_selftest_overlay(void)
1346{ 1382{
1347 struct device_node *bus_np = NULL; 1383 struct device_node *bus_np = NULL;
@@ -1390,6 +1426,9 @@ static void __init of_selftest_overlay(void)
1390 of_selftest_overlay_6(); 1426 of_selftest_overlay_6();
1391 of_selftest_overlay_8(); 1427 of_selftest_overlay_8();
1392 1428
1429 of_selftest_overlay_10();
1430 of_selftest_overlay_11();
1431
1393out: 1432out:
1394 of_node_put(bus_np); 1433 of_node_put(bus_np);
1395} 1434}