linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: Ignore disabled DT clock providers
@ 2016-02-26 15:54 Geert Uytterhoeven
  2016-02-26 17:42 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2016-02-26 15:54 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: Ramesh Shanmugasundaram, linux-clk, linux-kernel, Geert Uytterhoeven

of_clk_init() uses for_each_matching_node_and_match() to find clock
providers, which returns all matching device nodes, whether they are
enabled or not. Hence clock providers that are disabled explicitly in DT
using e.g.

	"status = "disabled";

are still activated.

Add a check to ignore device nodes that are not enabled, like
of_irq_init() does.

Reported-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/clk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index a1bc8db1c00a064f..4c0cb112390986b2 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3247,6 +3247,9 @@ void __init of_clk_init(const struct of_device_id *matches)
 	for_each_matching_node_and_match(np, matches, &match) {
 		struct clock_provider *parent;
 
+		if (!of_device_is_available(np))
+			continue;
+
 		parent = kzalloc(sizeof(*parent), GFP_KERNEL);
 		if (!parent) {
 			list_for_each_entry_safe(clk_provider, next,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] clk: Ignore disabled DT clock providers
  2016-02-26 15:54 [PATCH] clk: Ignore disabled DT clock providers Geert Uytterhoeven
@ 2016-02-26 17:42 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2016-02-26 17:42 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Michael Turquette, Ramesh Shanmugasundaram, linux-clk, linux-kernel

On 02/26, Geert Uytterhoeven wrote:
> of_clk_init() uses for_each_matching_node_and_match() to find clock
> providers, which returns all matching device nodes, whether they are
> enabled or not. Hence clock providers that are disabled explicitly in DT
> using e.g.
> 
> 	"status = "disabled";
> 
> are still activated.
> 
> Add a check to ignore device nodes that are not enabled, like
> of_irq_init() does.
> 
> Reported-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Applied to clk-next

Too bad there isn't a for_each_available_matching_node_and_match()
macro to make this all one line. It would be a mouthful though.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-26 17:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-26 15:54 [PATCH] clk: Ignore disabled DT clock providers Geert Uytterhoeven
2016-02-26 17:42 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).