Skip to contentSkip to conversation

ARM: samsung: call clk_get_rate for debugfs rate files

PATCH In review 최종환 2 participants 2 messages Sep 7, 2012 – Oct 23, 2012

Subsystems (3)
lore
Share & tools
lore

최종환

author
#0 lore raw

PATCH 2/2 ARM: samsung: call clk_get_rate for debugfs rate files

From: Colin Cross <[email protected]>

c->rate is rarely set, call clk_get_rate on the clock to print the value in /d/clock/.../rate.

---
 arch/arm/plat-samsung/clock.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
arch/arm/plat-samsung/clock.c +9 -1
index 9392959..b8ec1cf 100644
@@ -454,6 +454,14 @@ static const struct file_operations clock_tree_fops = {
        .release        = single_release,
 };
 
+static int clock_rate_show(void *data, u64 *val)
+{
+       struct clk *c = data;
+       *val = clk_get_rate(c);
+       return 0;
+}
+DEFINE_SIMPLE_ATTRIBUTE(clock_rate_fops, clock_rate_show, NULL, "%llu\n");
+
 static int clk_debugfs_register_one(struct clk *c)
 {
        int err;
@@ -480,7 +488,7 @@ static int clk_debugfs_register_one(struct clk *c)
                goto err_out;
        }
 
-       d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
+       d = debugfs_create_file("rate", S_IRUGO, c->dent, c,
&clock_rate_fops);
        if (!d) {
                err = -ENOMEM;
                goto err_out;

--
1.7.1

#1 lore raw
Quoted 18 lines · 최종환

From: Colin Cross <[email protected]>

c->rate is rarely set, call clk_get_rate on the clock to print the value in /d/clock/.../rate.

---
 arch/arm/plat-samsung/clock.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
arch/arm/plat-samsung/clock.c +0 -0
index 9392959..b8ec1cf 100644
@@ -454,6 +454,14 @@ static const struct file_operations clock_tree_fops =
 {

arch/arm/plat-samsung/clock.c static const struct file_operations clock_tree_fops = · line 464

Quoted 10 lines
arch/arm/plat-samsung/clock.c +7 -0
        .release        = single_release,
 };
 
+static int clock_rate_show(void *data, u64 *val)
+{
+       struct clk *c = data;
+       *val = clk_get_rate(c);
+       return 0;
+}
+DEFINE_SIMPLE_ATTRIBUTE(clock_rate_fops, clock_rate_show, NULL,

"%llu\n");

Quoted 14 lines
arch/arm/plat-samsung/clock.c +1 -0
+
 static int clk_debugfs_register_one(struct clk *c)
 {
        int err;
arch/arm/plat-samsung/clock.c +1 -1
@@ -480,7 +488,7 @@ static int clk_debugfs_register_one(struct clk *c)
                goto err_out;
        }
 
-       d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
+       d = debugfs_create_file("rate", S_IRUGO, c->dent, c,
 &clock_rate_fops);
        if (!d) {
                err = -ENOMEM;
                goto err_out;
Quoted 2 lines

--
1.7.1

Looks good to me, applied.
Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.