From: Simon Glass Date: Sat, 11 Jan 2025 00:00:27 +0000 (-0700) Subject: dm: core: Clarify behaviour of ofnode_name_eq() X-Git-Tag: v2025.04-rc1~27^2~2 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff698f2ddbcce5601a19fd61bef45aedd3d59cc6;p=pandora-u-boot.git dm: core: Clarify behaviour of ofnode_name_eq() This function is somewhat ambiguous, so expand the comments and add a test for the undefined behaviour. Signed-off-by: Simon Glass --- diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index c5f0a6d6788..2f3da384eba 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -386,11 +386,10 @@ static inline oftree oftree_from_np(struct device_node *root) void oftree_dispose(oftree tree); /** - * ofnode_name_eq() - Check if the node name is equivalent to a given name - * ignoring the unit address + * ofnode_name_eq() - Check a node name ignoring its unit address * - * @node: valid node reference that has to be compared - * @name: name that has to be compared with the node name + * @node: valid node to compared, which may have a unit address + * @name: name (without unit address) to compare with the node name * Return: true if matches, false if it doesn't match */ bool ofnode_name_eq(ofnode node, const char *name); diff --git a/test/dm/core.c b/test/dm/core.c index c59ffc6f611..d40916ef588 100644 --- a/test/dm/core.c +++ b/test/dm/core.c @@ -186,6 +186,8 @@ static int dm_test_compare_node_name(struct unit_test_state *uts) ut_assert(ofnode_valid(node)); ut_assert(ofnode_name_eq(node, "mmio-bus")); + ut_assert(!ofnode_name_eq(node, "mmio-bus@0")); + return 0; } DM_TEST(dm_test_compare_node_name, UTF_SCAN_PDATA);