[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240527161450.326615-17-herve.codina@bootlin.com>
Date: Mon, 27 May 2024 18:14:43 +0200
From: Herve Codina <herve.codina@...tlin.com>
To: Simon Horman <horms@...nel.org>,
Sai Krishna Gajula <saikrishnag@...vell.com>,
Herve Codina <herve.codina@...tlin.com>,
Thomas Gleixner <tglx@...utronix.de>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Lee Jones <lee@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
Horatiu Vultur <horatiu.vultur@...rochip.com>,
UNGLinuxDriver@...rochip.com,
Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
Saravana Kannan <saravanak@...gle.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Lars Povlsen <lars.povlsen@...rochip.com>,
Steen Hegelund <Steen.Hegelund@...rochip.com>,
Daniel Machon <daniel.machon@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc: linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org,
netdev@...r.kernel.org,
linux-pci@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Allan Nielsen <allan.nielsen@...rochip.com>,
Steen Hegelund <steen.hegelund@...rochip.com>,
Luca Ceresoli <luca.ceresoli@...tlin.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: [PATCH v2 16/19] 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 <herve.codina@...tlin.com>
---
drivers/of/unittest.c | 11 +++++++++++
1 file changed, 11 insertions(+)
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);
--
2.45.0
Powered by blists - more mailing lists