]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/of/unittest.c
Merge tag 'dmaengine-fix-4.5-rc1' of git://git.infradead.org/users/vkoul/slave-dma
[karo-tx-linux.git] / drivers / of / unittest.c
index e16ea5717b7f76df9c4734ee0f9373fb8e758b45..979b6e415cea0837b735d52d8e602f1d8b02e36c 100644 (file)
@@ -530,18 +530,14 @@ static void __init of_unittest_changeset(void)
        unittest(!of_changeset_add_property(&chgset, parent, ppadd), "fail add prop\n");
        unittest(!of_changeset_update_property(&chgset, parent, ppupdate), "fail update prop\n");
        unittest(!of_changeset_remove_property(&chgset, parent, ppremove), "fail remove prop\n");
-       mutex_lock(&of_mutex);
        unittest(!of_changeset_apply(&chgset), "apply failed\n");
-       mutex_unlock(&of_mutex);
 
        /* Make sure node names are constructed correctly */
        unittest((np = of_find_node_by_path("/testcase-data/changeset/n2/n21")),
                 "'%s' not added\n", n21->full_name);
        of_node_put(np);
 
-       mutex_lock(&of_mutex);
        unittest(!of_changeset_revert(&chgset), "revert failed\n");
-       mutex_unlock(&of_mutex);
 
        of_changeset_destroy(&chgset);
 #endif
@@ -757,6 +753,11 @@ static void __init of_unittest_match_node(void)
        }
 }
 
+static struct resource test_bus_res = {
+       .start = 0xfffffff8,
+       .end = 0xfffffff9,
+       .flags = IORESOURCE_MEM,
+};
 static const struct platform_device_info test_bus_info = {
        .name = "unittest-bus",
 };
@@ -800,6 +801,15 @@ static void __init of_unittest_platform_populate(void)
                return;
        test_bus->dev.of_node = np;
 
+       /*
+        * Add a dummy resource to the test bus node after it is
+        * registered to catch problems with un-inserted resources. The
+        * DT code doesn't insert the resources, and it has caused the
+        * kernel to oops in the past. This makes sure the same bug
+        * doesn't crop up again.
+        */
+       platform_device_add_resources(test_bus, &test_bus_res, 1);
+
        of_platform_populate(np, match, NULL, &test_bus->dev);
        for_each_child_of_node(np, child) {
                for_each_child_of_node(child, grandchild)