All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jun Nie <jun.nie@linaro.org>
To: sboyd@codeaurora.org, mturquette@baylibre.com, linux-clk@vger.kernel.org
Cc: Jun Nie <jun.nie@linaro.org>
Subject: [PATCH] clk: Add is_enabled sanity check
Date: Fri, 22 Apr 2016 10:32:36 +0800	[thread overview]
Message-ID: <1461292356-26043-1-git-send-email-jun.nie@linaro.org> (raw)

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 --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index f13c3f4..5e63bee 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2526,6 +2526,10 @@ struct clk *clk_register(struct device *dev, struct clk_hw *hw)
 	int i, ret;
 	struct clk_core *core;
 
+	if (hw->init->ops->enable && !hw->init->ops->is_enabled)
+		pr_warn("Warning: %s %s must implement .is_enabled\n",
+			__func__, hw->init->name);
+
 	core = kzalloc(sizeof(*core), GFP_KERNEL);
 	if (!core) {
 		ret = -ENOMEM;
-- 
1.9.1

             reply	other threads:[~2016-04-22  2:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22  2:32 Jun Nie [this message]
2016-04-22 22:36 ` [PATCH] clk: Add is_enabled sanity check Stephen Boyd
2016-04-25  6:48   ` Jun Nie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461292356-26043-1-git-send-email-jun.nie@linaro.org \
    --to=jun.nie@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.