[alsa-devel] Question about devm_get_clk_from_child()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed Mar 6 08:18:28 CET 2019


Hi Stephen, again

> I noticed that this commit breaks my ALSA Sound playback
> 
> 	4472287a3b2f52f4aa53f294ccb74392dde4e07d
> 	("clk: Introduce of_clk_get_hw_from_clkspec()")

I could solve this issue, but I'm not sure this is correct.

For ALSA SoC
At least if you are using "simple-card" or "audio-graph" driver,
you might got same issue.

------------------
From ea035a378a24479aea8d00fa8463bc4ff0bc5926 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
Date: Wed, 6 Mar 2019 15:54:59 +0900
Subject: [PATCH] clk: fixup default index for of_clk_get_by_name()

of_clk_get_by_name() is using -1 for __of_clk_get() index.
It will goes to of_parse_clkspec(), and be used for
of_parse_phandle_with_args().
Here, if user doesn't specified clock name
(= of_clk_get_by_name(np, NULL)), this index is still -1,
and of_parse_phandle_with_args() will return -EINVAL
(This index will be updated if if it had clock name).
clk_get_by_name(np, NULL) should work, then, default index
should be 0 instead of -1.
This patch fixup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 drivers/clk/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 14cbf23..96053a9 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -4213,7 +4213,7 @@ struct clk *of_clk_get_by_name(struct device_node *np, const char *name)
 	if (!np)
 		return ERR_PTR(-ENOENT);
 
-	return __of_clk_get(np, -1, np->full_name, name);
+	return __of_clk_get(np, 0, np->full_name, name);
 }
 EXPORT_SYMBOL(of_clk_get_by_name);
 
-- 
2.7.4


Best regards
---
Kuninori Morimoto


More information about the Alsa-devel mailing list