From 2050f824e1367cb227d8e13a91c98577987fe413 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Sat, 21 Jan 2023 18:02:51 -0600 Subject: 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 Reviewed-by: Sean Anderson Reviewed-by: Simon Glass Link: https://lore.kernel.org/r/20230122000252.53642-1-samuel@sholland.org --- test/dm/clk.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/dm/clk.c') diff --git a/test/dm/clk.c b/test/dm/clk.c index 21997ed8922..f48de05436b 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); -- cgit v1.2.3