test_printf: Refactor fwnode_pointer() to make it more readable
Converting fwnode_pointer() to use better swnode API allows to make code more readable. While at it, rename full_name to full_name_third to show exact relation in the hierarchy. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/20220824170542.18263-1-andriy.shevchenko@linux.intel.com
This commit is contained in:
parent
66283a8f49
commit
fd070e8ceb
@ -704,31 +704,29 @@ flags(void)
|
|||||||
|
|
||||||
static void __init fwnode_pointer(void)
|
static void __init fwnode_pointer(void)
|
||||||
{
|
{
|
||||||
const struct software_node softnodes[] = {
|
const struct software_node first = { .name = "first" };
|
||||||
{ .name = "first", },
|
const struct software_node second = { .name = "second", .parent = &first };
|
||||||
{ .name = "second", .parent = &softnodes[0], },
|
const struct software_node third = { .name = "third", .parent = &second };
|
||||||
{ .name = "third", .parent = &softnodes[1], },
|
const struct software_node *group[] = { &first, &second, &third, NULL };
|
||||||
{ NULL /* Guardian */ }
|
|
||||||
};
|
|
||||||
const char * const full_name = "first/second/third";
|
|
||||||
const char * const full_name_second = "first/second";
|
const char * const full_name_second = "first/second";
|
||||||
|
const char * const full_name_third = "first/second/third";
|
||||||
const char * const second_name = "second";
|
const char * const second_name = "second";
|
||||||
const char * const third_name = "third";
|
const char * const third_name = "third";
|
||||||
int rval;
|
int rval;
|
||||||
|
|
||||||
rval = software_node_register_nodes(softnodes);
|
rval = software_node_register_node_group(group);
|
||||||
if (rval) {
|
if (rval) {
|
||||||
pr_warn("cannot register softnodes; rval %d\n", rval);
|
pr_warn("cannot register softnodes; rval %d\n", rval);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
test(full_name_second, "%pfw", software_node_fwnode(&softnodes[1]));
|
test(full_name_second, "%pfw", software_node_fwnode(&second));
|
||||||
test(full_name, "%pfw", software_node_fwnode(&softnodes[2]));
|
test(full_name_third, "%pfw", software_node_fwnode(&third));
|
||||||
test(full_name, "%pfwf", software_node_fwnode(&softnodes[2]));
|
test(full_name_third, "%pfwf", software_node_fwnode(&third));
|
||||||
test(second_name, "%pfwP", software_node_fwnode(&softnodes[1]));
|
test(second_name, "%pfwP", software_node_fwnode(&second));
|
||||||
test(third_name, "%pfwP", software_node_fwnode(&softnodes[2]));
|
test(third_name, "%pfwP", software_node_fwnode(&third));
|
||||||
|
|
||||||
software_node_unregister_nodes(softnodes);
|
software_node_unregister_node_group(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __init fourcc_pointer(void)
|
static void __init fourcc_pointer(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user