summaryrefslogtreecommitdiff
path: root/test/dm/core.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-01-10 17:00:28 -0700
committerTom Rini <trini@konsulko.com>2025-01-22 17:08:24 -0600
commitaacc05b07d28e01bbbaf9037b3e8e1275e48701f (patch)
tree4af4bd71b7f85f818ed1defb81f60e037d6735b2 /test/dm/core.c
parentff698f2ddbcce5601a19fd61bef45aedd3d59cc6 (diff)
dm: core: Provide ofnode_name_eq_unit() to accept a unit address
When a unit-address is provided, use it to match against the node name. Since this increases code size, put it into a separate function. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm/core.c')
-rw-r--r--test/dm/core.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/dm/core.c b/test/dm/core.c
index d40916ef588..959b834576f 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -192,6 +192,24 @@ static int dm_test_compare_node_name(struct unit_test_state *uts)
}
DM_TEST(dm_test_compare_node_name, UTF_SCAN_PDATA);
+/* compare node names ignoring the unit address */
+static int dm_test_compare_node_name_unit(struct unit_test_state *uts)
+{
+ ofnode node;
+
+ node = ofnode_path("/mmio-bus@0");
+ ut_assert(ofnode_valid(node));
+ ut_assert(ofnode_name_eq_unit(node, "mmio-bus"));
+
+ ut_assert(ofnode_name_eq_unit(node, "mmio-bus@0"));
+ ut_assert(!ofnode_name_eq_unit(node, "mmio-bus@1"));
+ ut_assert(!ofnode_name_eq_unit(node, "mmio-bu"));
+ ut_assert(!ofnode_name_eq_unit(node, "mmio-buss@0"));
+
+ return 0;
+}
+DM_TEST(dm_test_compare_node_name_unit, UTF_SCAN_PDATA);
+
/* Test that binding with uclass plat setting occurs correctly */
static int dm_test_autobind_uclass_pdata_valid(struct unit_test_state *uts)
{