Skip to content

Commit 1e43683

Browse files
hcodinarobherring
authored andcommitted
of: unittest: Add a test case for of_changeset_add_prop_bool()
Improve of_unittest_changeset_prop() to have a test case for the newly introduced of_changeset_add_prop_bool(). Signed-off-by: Herve Codina <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring (Arm) <[email protected]>
1 parent f2b388d commit 1e43683

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/of/unittest.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,13 @@ static void __init __maybe_unused changeset_check_u32_array(struct device_node *
10091009
}
10101010
}
10111011

1012+
static void __init __maybe_unused changeset_check_bool(struct device_node *np,
1013+
const char *prop_name)
1014+
{
1015+
unittest(of_property_read_bool(np, prop_name),
1016+
"%s value mismatch (read 'false', exp 'true')\n", prop_name);
1017+
}
1018+
10121019
static void __init of_unittest_changeset_prop(void)
10131020
{
10141021
#ifdef CONFIG_OF_DYNAMIC
@@ -1044,6 +1051,9 @@ static void __init of_unittest_changeset_prop(void)
10441051
u32_array, ARRAY_SIZE(u32_array));
10451052
unittest(ret == 0, "failed to add prop-u32-array\n");
10461053

1054+
ret = of_changeset_add_prop_bool(&chgset, np, "prop-bool");
1055+
unittest(ret == 0, "failed to add prop-bool\n");
1056+
10471057
of_node_put(np);
10481058

10491059
ret = of_changeset_apply(&chgset);
@@ -1058,6 +1068,7 @@ static void __init of_unittest_changeset_prop(void)
10581068
changeset_check_string_array(np, "prop-string-array", str_array, ARRAY_SIZE(str_array));
10591069
changeset_check_u32(np, "prop-u32", 1234);
10601070
changeset_check_u32_array(np, "prop-u32-array", u32_array, ARRAY_SIZE(u32_array));
1071+
changeset_check_bool(np, "prop-bool");
10611072

10621073
of_node_put(np);
10631074

0 commit comments

Comments
 (0)