Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Abel Vesa <abel.vesa@linaro.org>
To: Mike Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-arm-msm@vger.kernel.org, Abel Vesa <abel.vesa@linaro.org>
Subject: [RFC PATCH 3/4] clk: Add consumers count information to debugfs
Date: Thu,  7 Jul 2022 13:03:08 +0300	[thread overview]
Message-ID: <20220707100309.1357663-3-abel.vesa@linaro.org> (raw)
In-Reply-To: <20220707100309.1357663-1-abel.vesa@linaro.org>

Lets add consumers count information to debugfs. It could be useful for
identifying which clocks do not have a consumer but are enabled at boot
and should be disabled since they are unused. Also you could tell which
clocks are marked as critical since they do not have consumers, but
their enable_count is non-zero.

Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
---
 drivers/clk/clk.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 9b54afd2fee8..e412e83a6e28 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2955,9 +2955,9 @@ static void clk_summary_show_one(struct seq_file *s, struct clk_core *c,
 {
 	int phase;
 
-	seq_printf(s, "%*s%-*s %7d %8d %8d %11lu %10lu ",
+	seq_printf(s, "%*s%-*s %7d %7d %8d %8d %11lu %10lu ",
 		   level * 3 + 1, "",
-		   30 - level * 3, c->name,
+		   30 - level * 3, c->name, c->consumers_count,
 		   c->enable_count, c->prepare_count, c->protect_count,
 		   clk_core_get_rate_recalc(c),
 		   clk_core_get_accuracy_recalc(c));
@@ -2996,9 +2996,9 @@ static int clk_summary_show(struct seq_file *s, void *data)
 	struct clk_core *c;
 	struct hlist_head **lists = (struct hlist_head **)s->private;
 
-	seq_puts(s, "                                 enable  prepare  protect                                duty  hardware\n");
-	seq_puts(s, "   clock                          count    count    count        rate   accuracy phase  cycle    enable\n");
-	seq_puts(s, "-------------------------------------------------------------------------------------------------------\n");
+	seq_puts(s, "                                 counsumers  enable  prepare  protect                                duty  hardware\n");
+	seq_puts(s, "   clock                              count   count    count    count        rate   accuracy phase  cycle    enable\n");
+	seq_puts(s, "-------------------------------------------------------------------------------------------------------------------\n");
 
 	clk_prepare_lock();
 
@@ -3021,6 +3021,7 @@ static void clk_dump_one(struct seq_file *s, struct clk_core *c, int level)
 
 	/* This should be JSON format, i.e. elements separated with a comma */
 	seq_printf(s, "\"%s\": { ", c->name);
+	seq_printf(s, "\"consumers_count\": %d,", c->consumers_count);
 	seq_printf(s, "\"enable_count\": %d,", c->enable_count);
 	seq_printf(s, "\"prepare_count\": %d,", c->prepare_count);
 	seq_printf(s, "\"protect_count\": %d,", c->protect_count);
@@ -3330,6 +3331,7 @@ static void clk_debug_create_one(struct clk_core *core, struct dentry *pdentry)
 	debugfs_create_u32("clk_phase", 0444, root, &core->phase);
 	debugfs_create_file("clk_flags", 0444, root, core, &clk_flags_fops);
 	debugfs_create_u32("clk_prepare_count", 0444, root, &core->prepare_count);
+	debugfs_create_u32("clk_consumers_count", 0444, root, &core->consumers_count);
 	debugfs_create_u32("clk_enable_count", 0444, root, &core->enable_count);
 	debugfs_create_u32("clk_protect_count", 0444, root, &core->protect_count);
 	debugfs_create_u32("clk_notifier_count", 0444, root, &core->notifier_count);
-- 
2.34.3


  parent reply	other threads:[~2022-07-07 10:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07 10:03 [RFC PATCH 1/4] clk: Use clk_core_unlink_consumer on __clk_put Abel Vesa
2022-07-07 10:03 ` [RFC PATCH 2/4] clk: Add consumers count to core Abel Vesa
2022-07-07 10:03 ` Abel Vesa [this message]
2022-07-07 10:03 ` [RFC PATCH 4/4] clk: Skip disabling clocks if they have consumers Abel Vesa
2022-07-21  8:17 ` [RFC PATCH 1/4] clk: Use clk_core_unlink_consumer on __clk_put Abel Vesa

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=20220707100309.1357663-3-abel.vesa@linaro.org \
    --to=abel.vesa@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox