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

Previous thread: sh: Renesas R0P7785LC0011RL board support by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:08 am. (1 message)

Next thread: sh: Introduce clk_always_enable() function by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:08 am. (1 message)
From: Linux Kernel Mailing List
Date: Monday, July 28, 2008 - 10:08 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=152fe3...
Commit:     152fe36ebee82b63a9c6e510c52aaa82f4b1940d
Parent:     1312994c8008d66806d9452c15d50df86a031437
Author:     Magnus Damm <damm@igel.co.jp>
AuthorDate: Thu Jul 17 19:05:54 2008 +0900
Committer:  Paul Mundt <lethal@linux-sh.org>
CommitDate: Mon Jul 28 18:10:36 2008 +0900

    sh: Show all clocks and their state in /proc/clocks
    
    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.
    
    Signed-off-by: Magnus Damm <damm@igel.co.jp>
    Signed-off-by: Paul Mundt <lethal@linux-sh.org>
---
 arch/sh/kernel/cpu/clock.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index 73334c6..f5eb56e 100644
--- a/arch/sh/kernel/cpu/clock.c
+++ b/arch/sh/kernel/cpu/clock.c
@@ -308,15 +308,11 @@ static int show_clocks(char *buf, char **start, off_t off,
 	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;
--

Previous thread: sh: Renesas R0P7785LC0011RL board support by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:08 am. (1 message)

Next thread: sh: Introduce clk_always_enable() function by Linux Kernel Mailing List on Monday, July 28, 2008 - 10:08 am. (1 message)