|
@@ -46,46 +46,54 @@ static struct unittest_results {
|
|
|
static void __init of_unittest_find_node_by_name(void)
|
|
|
{
|
|
|
struct device_node *np;
|
|
|
- const char *options;
|
|
|
+ const char *options, *name;
|
|
|
|
|
|
np = of_find_node_by_path("/testcase-data");
|
|
|
- unittest(np && !strcmp("/testcase-data", np->full_name),
|
|
|
+ name = kasprintf(GFP_KERNEL, "%pOF", np);
|
|
|
+ unittest(np && !strcmp("/testcase-data", name),
|
|
|
"find /testcase-data failed\n");
|
|
|
of_node_put(np);
|
|
|
+ kfree(name);
|
|
|
|
|
|
/* Test if trailing '/' works */
|
|
|
np = of_find_node_by_path("/testcase-data/");
|
|
|
unittest(!np, "trailing '/' on /testcase-data/ should fail\n");
|
|
|
|
|
|
np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
|
|
|
- unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", np->full_name),
|
|
|
+ name = kasprintf(GFP_KERNEL, "%pOF", np);
|
|
|
+ unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", name),
|
|
|
"find /testcase-data/phandle-tests/consumer-a failed\n");
|
|
|
of_node_put(np);
|
|
|
+ kfree(name);
|
|
|
|
|
|
np = of_find_node_by_path("testcase-alias");
|
|
|
- unittest(np && !strcmp("/testcase-data", np->full_name),
|
|
|
+ name = kasprintf(GFP_KERNEL, "%pOF", np);
|
|
|
+ unittest(np && !strcmp("/testcase-data", name),
|
|
|
"find testcase-alias failed\n");
|
|
|
of_node_put(np);
|
|
|
+ kfree(name);
|
|
|
|
|
|
/* Test if trailing '/' works on aliases */
|
|
|
np = of_find_node_by_path("testcase-alias/");
|
|
|
unittest(!np, "trailing '/' on testcase-alias/ should fail\n");
|
|
|
|
|
|
np = of_find_node_by_path("testcase-alias/phandle-tests/consumer-a");
|
|
|
- unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", np->full_name),
|
|
|
+ name = kasprintf(GFP_KERNEL, "%pOF", np);
|
|
|
+ unittest(np && !strcmp("/testcase-data/phandle-tests/consumer-a", name),
|
|
|
"find testcase-alias/phandle-tests/consumer-a failed\n");
|
|
|
of_node_put(np);
|
|
|
+ kfree(name);
|
|
|
|
|
|
np = of_find_node_by_path("/testcase-data/missing-path");
|
|
|
- unittest(!np, "non-existent path returned node %s\n", np->full_name);
|
|
|
+ unittest(!np, "non-existent path returned node %pOF\n", np);
|
|
|
of_node_put(np);
|
|
|
|
|
|
np = of_find_node_by_path("missing-alias");
|
|
|
- unittest(!np, "non-existent alias returned node %s\n", np->full_name);
|
|
|
+ unittest(!np, "non-existent alias returned node %pOF\n", np);
|
|
|
of_node_put(np);
|
|
|
|
|
|
np = of_find_node_by_path("testcase-alias/missing-path");
|
|
|
- unittest(!np, "non-existent alias with relative path returned node %s\n", np->full_name);
|
|
|
+ unittest(!np, "non-existent alias with relative path returned node %pOF\n", np);
|
|
|
of_node_put(np);
|
|
|
|
|
|
np = of_find_node_opts_by_path("/testcase-data:testoption", &options);
|
|
@@ -315,8 +323,8 @@ static void __init of_unittest_check_phandles(void)
|
|
|
|
|
|
hash_for_each_possible(phandle_ht, nh, node, np->phandle) {
|
|
|
if (nh->np->phandle == np->phandle) {
|
|
|
- pr_info("Duplicate phandle! %i used by %s and %s\n",
|
|
|
- np->phandle, nh->np->full_name, np->full_name);
|
|
|
+ pr_info("Duplicate phandle! %i used by %pOF and %pOF\n",
|
|
|
+ np->phandle, nh->np, np);
|
|
|
dup_count++;
|
|
|
break;
|
|
|
}
|
|
@@ -406,8 +414,8 @@ static void __init of_unittest_parse_phandle_with_args(void)
|
|
|
passed = false;
|
|
|
}
|
|
|
|
|
|
- unittest(passed, "index %i - data error on node %s rc=%i\n",
|
|
|
- i, args.np->full_name, rc);
|
|
|
+ unittest(passed, "index %i - data error on node %pOF rc=%i\n",
|
|
|
+ i, args.np, rc);
|
|
|
}
|
|
|
|
|
|
/* Check for missing list property */
|
|
@@ -590,7 +598,7 @@ static void __init of_unittest_changeset(void)
|
|
|
|
|
|
/* 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);
|
|
|
+ "'%pOF' not added\n", n21);
|
|
|
of_node_put(np);
|
|
|
|
|
|
unittest(!of_changeset_revert(&chgset), "revert failed\n");
|
|
@@ -621,8 +629,8 @@ static void __init of_unittest_parse_interrupts(void)
|
|
|
passed &= (args.args_count == 1);
|
|
|
passed &= (args.args[0] == (i + 1));
|
|
|
|
|
|
- unittest(passed, "index %i - data error on node %s rc=%i\n",
|
|
|
- i, args.np->full_name, rc);
|
|
|
+ unittest(passed, "index %i - data error on node %pOF rc=%i\n",
|
|
|
+ i, args.np, rc);
|
|
|
}
|
|
|
of_node_put(np);
|
|
|
|
|
@@ -667,8 +675,8 @@ static void __init of_unittest_parse_interrupts(void)
|
|
|
default:
|
|
|
passed = false;
|
|
|
}
|
|
|
- unittest(passed, "index %i - data error on node %s rc=%i\n",
|
|
|
- i, args.np->full_name, rc);
|
|
|
+ unittest(passed, "index %i - data error on node %pOF rc=%i\n",
|
|
|
+ i, args.np, rc);
|
|
|
}
|
|
|
of_node_put(np);
|
|
|
}
|
|
@@ -737,8 +745,8 @@ static void __init of_unittest_parse_interrupts_extended(void)
|
|
|
passed = false;
|
|
|
}
|
|
|
|
|
|
- unittest(passed, "index %i - data error on node %s rc=%i\n",
|
|
|
- i, args.np->full_name, rc);
|
|
|
+ unittest(passed, "index %i - data error on node %pOF rc=%i\n",
|
|
|
+ i, args.np, rc);
|
|
|
}
|
|
|
of_node_put(np);
|
|
|
}
|
|
@@ -917,8 +925,11 @@ static int attach_node_and_children(struct device_node *np)
|
|
|
{
|
|
|
struct device_node *next, *dup, *child;
|
|
|
unsigned long flags;
|
|
|
+ const char *full_name;
|
|
|
|
|
|
- dup = of_find_node_by_path(np->full_name);
|
|
|
+ full_name = kasprintf(GFP_KERNEL, "%pOF", np);
|
|
|
+ dup = of_find_node_by_path(full_name);
|
|
|
+ kfree(full_name);
|
|
|
if (dup) {
|
|
|
update_node_properties(np, dup);
|
|
|
return 0;
|
|
@@ -1023,7 +1034,7 @@ static int unittest_probe(struct platform_device *pdev)
|
|
|
|
|
|
}
|
|
|
|
|
|
- dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name);
|
|
|
+ dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
|
|
|
|
|
|
of_platform_populate(np, NULL, NULL, &pdev->dev);
|
|
|
|
|
@@ -1035,7 +1046,7 @@ static int unittest_remove(struct platform_device *pdev)
|
|
|
struct device *dev = &pdev->dev;
|
|
|
struct device_node *np = dev->of_node;
|
|
|
|
|
|
- dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name);
|
|
|
+ dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -1649,7 +1660,7 @@ static int unittest_i2c_bus_probe(struct platform_device *pdev)
|
|
|
|
|
|
}
|
|
|
|
|
|
- dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name);
|
|
|
+ dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
|
|
|
|
|
|
std = devm_kzalloc(dev, sizeof(*std), GFP_KERNEL);
|
|
|
if (!std) {
|
|
@@ -1687,7 +1698,7 @@ static int unittest_i2c_bus_remove(struct platform_device *pdev)
|
|
|
struct device_node *np = dev->of_node;
|
|
|
struct unittest_i2c_bus_data *std = platform_get_drvdata(pdev);
|
|
|
|
|
|
- dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name);
|
|
|
+ dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
|
|
|
i2c_del_adapter(&std->adap);
|
|
|
|
|
|
return 0;
|
|
@@ -1718,7 +1729,7 @@ static int unittest_i2c_dev_probe(struct i2c_client *client,
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
|
|
|
- dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name);
|
|
|
+ dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
|
|
|
|
|
|
return 0;
|
|
|
};
|
|
@@ -1728,7 +1739,7 @@ static int unittest_i2c_dev_remove(struct i2c_client *client)
|
|
|
struct device *dev = &client->dev;
|
|
|
struct device_node *np = client->dev.of_node;
|
|
|
|
|
|
- dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name);
|
|
|
+ dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -1763,7 +1774,7 @@ static int unittest_i2c_mux_probe(struct i2c_client *client,
|
|
|
struct i2c_mux_core *muxc;
|
|
|
u32 reg, max_reg;
|
|
|
|
|
|
- dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name);
|
|
|
+ dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
|
|
|
|
|
|
if (!np) {
|
|
|
dev_err(dev, "No OF node\n");
|
|
@@ -1808,7 +1819,7 @@ static int unittest_i2c_mux_remove(struct i2c_client *client)
|
|
|
struct device_node *np = client->dev.of_node;
|
|
|
struct i2c_mux_core *muxc = i2c_get_clientdata(client);
|
|
|
|
|
|
- dev_dbg(dev, "%s for node @%s\n", __func__, np->full_name);
|
|
|
+ dev_dbg(dev, "%s for node @%pOF\n", __func__, np);
|
|
|
i2c_mux_del_adapters(muxc);
|
|
|
return 0;
|
|
|
}
|