linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: Warn (and therefore taint the kernel) on clk_ignore_unused
@ 2025-02-01 16:52 Konrad Dybcio
  2025-03-03 22:48 ` Stephen Boyd
  0 siblings, 1 reply; 9+ messages in thread
From: Konrad Dybcio @ 2025-02-01 16:52 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: Marijn Suijten, linux-clk, linux-kernel, Bjorn Andersson,
	Dmitry Baryshkov, Konrad Dybcio

From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

If any sort of ignore_unused is in place, it means one of:

* power is going to waste
* the platform description is incomplete (missing consumer-provider
  relationships)
* the platform description is just broken

Many people will happily declare their job done when a platform
magically happens to work as they make use of bootloader-enabled
resources, which then leads to double or triple the amount of work
of another person, as they attempt to reduce the unnecessary power
drainage and/or ensure stabiility throughout a suspend-resume cycle.

Issue a good ol' warning (and taint the kernel) to make such cases
obvious and hopefully draw more attention to it. This way, it'll be
easier to avoid effectively untested code or DT description getting
merged into the kernel, or worse, going into production.

The clock subsystem plays a crucial part in this quest, as even if
the clock controllers themselves don't draw a lot of power when on
(comparatively), improper description of clock requirements has been
the #1 cause of incomplete/incorrect devicetree bindings in my
experience.

Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
---
 drivers/clk/clk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index cf7720b9172ff223d86227aad144e15375ddfd86..9e2e240efc31f02e4880542370ba773037b733a0 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1527,7 +1527,8 @@ static int __init clk_disable_unused(void)
 	struct clk_core *core;
 	int ret;
 
-	if (clk_ignore_unused) {
+	/* If you need ignore_unused, your platform description is broken / incomplete */
+	if (WARN_ON(clk_ignore_unused)) {
 		pr_warn("clk: Not disabling unused clocks\n");
 		return 0;
 	}

---
base-commit: df4b2bbff898227db0c14264ac7edd634e79f755
change-id: 20250201-topic-ignore_unused_warn-254a966f627a

Best regards,
-- 
Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>


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

end of thread, other threads:[~2025-06-03  1:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-01 16:52 [PATCH] clk: Warn (and therefore taint the kernel) on clk_ignore_unused Konrad Dybcio
2025-03-03 22:48 ` Stephen Boyd
2025-03-03 23:16   ` Florian Fainelli
2025-03-03 23:17     ` Dmitry Baryshkov
2025-03-04 19:34       ` Stephen Boyd
2025-05-22 19:47         ` Konrad Dybcio
2025-06-03  0:31           ` Brian Masney
2025-06-03  1:20       ` Bjorn Andersson
2025-06-03  1:23     ` Bjorn Andersson

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).