diff mbox series

[v2,16/19] of: unittest: Add a test case for of_changeset_add_prop_bool()

Message ID 20240527161450.326615-17-herve.codina@bootlin.com (mailing list archive)
State Not Applicable
Headers show
Series Add support for the LAN966x PCI device using a DT overlay | expand

Checks

Context Check Description
netdev/series_format fail Series longer than 15 patches
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 904 this patch: 904
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 3 of 3 maintainers
netdev/build_clang success Errors and warnings before: 906 this patch: 906
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 908 this patch: 908
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 29 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 1 this patch: 1
netdev/source_inline success Was 0 now: 0

Commit Message

Herve Codina May 27, 2024, 4:14 p.m. UTC
Improve of_unittest_changeset_prop() to have a test case for the
newly introduced of_changeset_add_prop_bool().

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
 drivers/of/unittest.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index f8edc96db680..c830f346df45 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1009,6 +1009,13 @@  static void __init __maybe_unused changeset_check_u32_array(struct device_node *
 	}
 }
 
+static void __init __maybe_unused changeset_check_bool(struct device_node *np,
+						       const char *prop_name)
+{
+	unittest(of_property_read_bool(np, prop_name),
+		 "%s value mismatch (read 'false', exp 'true')\n", prop_name);
+}
+
 static void __init of_unittest_changeset_prop(void)
 {
 #ifdef CONFIG_OF_DYNAMIC
@@ -1044,6 +1051,9 @@  static void __init of_unittest_changeset_prop(void)
 					      u32_array, ARRAY_SIZE(u32_array));
 	unittest(ret == 0, "failed to add prop-u32-array\n");
 
+	ret = of_changeset_add_prop_bool(&chgset, np, "prop-bool");
+	unittest(ret == 0, "failed to add prop-bool\n");
+
 	of_node_put(np);
 
 	ret = of_changeset_apply(&chgset);
@@ -1058,6 +1068,7 @@  static void __init of_unittest_changeset_prop(void)
 	changeset_check_string_array(np, "prop-string-array", str_array, ARRAY_SIZE(str_array));
 	changeset_check_u32(np, "prop-u32", 1234);
 	changeset_check_u32_array(np, "prop-u32-array", u32_array, ARRAY_SIZE(u32_array));
+	changeset_check_bool(np, "prop-bool");
 
 	of_node_put(np);