diff mbox

[v2] clk: Add is_enabled sanity check

Message ID 1463450622-13960-1-git-send-email-jun.nie@linaro.org (mailing list archive)
State Under Review
Delegated to: Stephen Boyd
Headers show

Commit Message

Jun Nie May 17, 2016, 2:03 a.m. UTC
If .enable and .disable is implemented, we must implement .is_enabled
per document. Otherwise, clk_disable_unused_subtree will not disable
the unused clock if the .is_enabled is not implemented, unecessary
power consumption happens on the clock as a result.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
 drivers/clk/clk.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox


diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index fb74dc1..55f5c44 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2305,6 +2305,10 @@  static int __clk_core_init(struct clk_core *core)
 		goto out;
+	if (core->ops->enable && !core->ops->is_enabled)
+		pr_warn("Warning: %s %s must implement .is_enabled\n",
+			__func__, core->name);
 	/* throw a WARN if any entries in parent_names are NULL */
 	for (i = 0; i < core->num_parents; i++)