summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2023-01-21 18:02:51 -0600
committerSean Anderson <seanga2@gmail.com>2023-02-12 13:44:20 -0500
commit2050f824e1367cb227d8e13a91c98577987fe413 (patch)
treebb06ae6e463c3df7b8aed1b2aac2eaa4e4e0d59f /test
parentc40251c120fac5a85fb445b6b2c7db5d18792e2a (diff)
clk: Allow clk_get_by_name() with NULL name
This allows devm_clock_get(dev, NULL) to work and get the first clock, which is common in code ported from Linux. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/r/20230122000252.53642-1-samuel@sholland.org
Diffstat (limited to 'test')
-rw-r--r--test/dm/clk.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/dm/clk.c b/test/dm/clk.c
index 21997ed892..f48de05436 100644
--- a/test/dm/clk.c
+++ b/test/dm/clk.c
@@ -26,6 +26,11 @@ static int dm_test_clk_base(struct unit_test_state *uts)
ut_assertok(uclass_get_device_by_name(UCLASS_MISC, "clk-test", &dev));
/* Get the same clk port in 2 different ways and compare */
+ ut_assertok(clk_get_by_index(dev, 0, &clk_method1));
+ ut_assertok(clk_get_by_name(dev, NULL, &clk_method2));
+ ut_asserteq(clk_is_match(&clk_method1, &clk_method2), true);
+ ut_asserteq(clk_method1.id, clk_method2.id);
+
ut_assertok(clk_get_by_index(dev, 1, &clk_method1));
ut_assertok(clk_get_by_index_nodev(dev_ofnode(dev), 1, &clk_method2));
ut_asserteq(clk_is_match(&clk_method1, &clk_method2), true);