Skip to contentSkip to conversation

sh: Show all clocks and their state in /proc/clocks

PATCH New Magnus Damm 1 participant 1 message Jul 17, 2008 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: Show all clocks and their state in /proc/clocks

From: Magnus Damm <[email protected]>

Show all clocks in /proc/clocks, and also show if they are enabled or disabled. This is useful to show MSTPCR bits on SuperH Mobile processors.

---

 arch/sh/kernel/cpu/clock.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
arch/sh/kernel/cpu/clock.c +5 -9
@@ -308,15 +308,11 @@ static int show_clocks(char *buf, char *
 	list_for_each_entry_reverse(clk, &clock_list, node) {
 		unsigned long rate = clk_get_rate(clk);
 
-		/*
-		 * Don't bother listing dummy clocks with no ancestry
-		 * that only support enable and disable ops.
-		 */
-		if (unlikely(!rate && !clk->parent))
-			continue;
-
-		p += sprintf(p, "%-12s\t: %ld.%02ldMHz\n", clk->name,
-			     rate / 1000000, (rate % 1000000) / 10000);
+		p += sprintf(p, "%-12s\t: %ld.%02ldMHz\t%s\n", clk->name,
+			     rate / 1000000, (rate % 1000000) / 10000,
+			     ((clk->flags & CLK_ALWAYS_ENABLED) ||
+			      (atomic_read(&clk->kref.refcount) != 1)) ?
+			     "enabled" : "disabled");
 	}
 
 	return p - buf;