diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2011-01-26 19:20:55 -0500 |
---|---|---|
committer | David Brown <davidb@codeaurora.org> | 2011-01-28 14:20:49 -0500 |
commit | 6e6d9b5bec5b27164126894c452853e4cac19b15 (patch) | |
tree | b1ae787945fe1b540b63be6cef6af8ad5349311c /arch/arm | |
parent | d64560fe3e9bf64b2050ceeb6b6946ba2a4efda0 (diff) |
msm: clock: Invert debugfs directory layout
There are currently 3 separate directories for clock debugging in
debugfs: clk_enable, clk_rate, and clk_local. Each of these
directories contains a list of clocks. This is rather annoying
when you are focusing on one clock and want to enable/disable it
and then check its rate. You either have to cd to the other
directory or cat ../clk_rate/<clk>.
Invert the layout so that there is one clock directory containing
a directory for each clock. Inside each respective clock
directory place an enable, rate, and is_local file relating to
the clk_enable, clk_disable, and clk_local directories that exist
today.
Reviewed-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: David Brown <davidb@codeaurora.org>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-msm/clock-debug.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/arch/arm/mach-msm/clock-debug.c b/arch/arm/mach-msm/clock-debug.c index 6f603edbb4d0..b67b9e82ece6 100644 --- a/arch/arm/mach-msm/clock-debug.c +++ b/arch/arm/mach-msm/clock-debug.c | |||
@@ -87,47 +87,45 @@ static int clock_debug_local_get(void *data, u64 *val) | |||
87 | DEFINE_SIMPLE_ATTRIBUTE(clock_local_fops, clock_debug_local_get, | 87 | DEFINE_SIMPLE_ATTRIBUTE(clock_local_fops, clock_debug_local_get, |
88 | NULL, "%llu\n"); | 88 | NULL, "%llu\n"); |
89 | 89 | ||
90 | static struct dentry *dent_rate, *dent_enable, *dent_local; | 90 | static struct dentry *debugfs_base; |
91 | 91 | ||
92 | int __init clock_debug_init(void) | 92 | int __init clock_debug_init(void) |
93 | { | 93 | { |
94 | dent_rate = debugfs_create_dir("clk_rate", 0); | 94 | debugfs_base = debugfs_create_dir("clk", NULL); |
95 | if (!dent_rate) | 95 | if (!debugfs_base) |
96 | goto err; | 96 | return -ENOMEM; |
97 | |||
98 | dent_enable = debugfs_create_dir("clk_enable", 0); | ||
99 | if (!dent_enable) | ||
100 | goto err; | ||
101 | |||
102 | dent_local = debugfs_create_dir("clk_local", NULL); | ||
103 | if (!dent_local) | ||
104 | goto err; | ||
105 | |||
106 | return 0; | 97 | return 0; |
107 | err: | ||
108 | debugfs_remove(dent_local); | ||
109 | debugfs_remove(dent_enable); | ||
110 | debugfs_remove(dent_rate); | ||
111 | return -ENOMEM; | ||
112 | } | 98 | } |
113 | 99 | ||
114 | int __init clock_debug_add(struct clk *clock) | 100 | int __init clock_debug_add(struct clk *clock) |
115 | { | 101 | { |
116 | char temp[50], *ptr; | 102 | char temp[50], *ptr; |
103 | struct dentry *clk_dir; | ||
117 | 104 | ||
118 | if (!dent_rate || !dent_enable || !dent_local) | 105 | if (!debugfs_base) |
119 | return -ENOMEM; | 106 | return -ENOMEM; |
120 | 107 | ||
121 | strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1); | 108 | strncpy(temp, clock->dbg_name, ARRAY_SIZE(temp)-1); |
122 | for (ptr = temp; *ptr; ptr++) | 109 | for (ptr = temp; *ptr; ptr++) |
123 | *ptr = tolower(*ptr); | 110 | *ptr = tolower(*ptr); |
124 | 111 | ||
125 | debugfs_create_file(temp, S_IRUGO | S_IWUSR, dent_rate, | 112 | clk_dir = debugfs_create_dir(temp, debugfs_base); |
126 | clock, &clock_rate_fops); | 113 | if (!clk_dir) |
127 | debugfs_create_file(temp, S_IRUGO | S_IWUSR, dent_enable, | 114 | return -ENOMEM; |
128 | clock, &clock_enable_fops); | 115 | |
129 | debugfs_create_file(temp, S_IRUGO, dent_local, | 116 | if (!debugfs_create_file("rate", S_IRUGO | S_IWUSR, clk_dir, |
130 | clock, &clock_local_fops); | 117 | clock, &clock_rate_fops)) |
118 | goto error; | ||
131 | 119 | ||
120 | if (!debugfs_create_file("enable", S_IRUGO | S_IWUSR, clk_dir, | ||
121 | clock, &clock_enable_fops)) | ||
122 | goto error; | ||
123 | |||
124 | if (!debugfs_create_file("is_local", S_IRUGO, clk_dir, clock, | ||
125 | &clock_local_fops)) | ||
126 | goto error; | ||
132 | return 0; | 127 | return 0; |
128 | error: | ||
129 | debugfs_remove_recursive(clk_dir); | ||
130 | return -ENOMEM; | ||
133 | } | 131 | } |