From: Andrew Morton <akpm@linux-foundation.org>
To: Dmitry Baryshkov <dbaryshkov@gmail.com>
Cc: linux-kernel@vger.kernel.org, haavard.skinnemoen@atmel.com,
rmk+lkml@arm.linux.org.uk, lethal@linux-sh.org,
philipp.zabel@gmail.com, pavel@ucw.cz, tony@atomide.com,
paul@pwsan.com, Greg KH <greg@kroah.com>
Subject: Re: [PATCH 2/6] Clocklib: debugfs support
Date: Mon, 7 Apr 2008 15:59:01 -0700 [thread overview]
Message-ID: <20080407155901.c7431c3e.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080403132337.GA26981@doriath.ww600.siemens.net>
On Thu, 3 Apr 2008 17:23:37 +0400
Dmitry Baryshkov <dbaryshkov@gmail.com> wrote:
> Provide /sys/kernel/debug/clock to ease debugging.
>
Plese fully document the proposed kernel->userspace interface in the
changelog so that we can review it design.
> diff --git a/include/linux/clklib.h b/include/linux/clklib.h
> index 3d0ffaf..77514cc 100644
> --- a/include/linux/clklib.h
> +++ b/include/linux/clklib.h
> @@ -19,6 +19,7 @@ struct seq_file;
> * @get_rate: obtain the current clock rate of a specified clock
> * @set_rate: set the clock rate for a specified clock
> * @round_rate: adjust a reate to the exact rate a clock can provide
> + * @format: output any additional information for a clock
> *
> * This structure specifies clock operations that are used to configure
> * specific clock.
> @@ -30,6 +31,7 @@ struct clk_ops {
> unsigned long (*get_rate) (struct clk *clk);
> int (*set_rate) (struct clk *, unsigned long);
> long (*round_rate) (struct clk *, unsigned long);
> + int (*format) (struct clk *, struct seq_file *);
It's conventional to leave no space between the ) and the ( here. Using a
tab is quite unconventional.
> };
>
> /**
> diff --git a/kernel/clklib.c b/kernel/clklib.c
> index 012f845..8d872e1 100644
> --- a/kernel/clklib.c
> +++ b/kernel/clklib.c
> @@ -324,3 +324,77 @@ out:
> return rc;
> }
> EXPORT_SYMBOL(clk_alloc_function);
> +
> +#ifdef CONFIG_DEBUG_FS
> +
> +#include <linux/debugfs.h>
> +#include <linux/seq_file.h>
> +
> +#define NAME_FIELD_LEN 20
> +
> +static void dump_clocks(struct seq_file *s, struct clk *parent, int nest)
> +{
> + struct clk *clk;
> + int i;
> +
> + list_for_each_entry(clk, &clocks, node) {
> + if (clk->parent == parent) {
> + for (i = 0; i < nest; i++) {
> + seq_putc(s, ' ');
> + seq_putc(s, ' ');
> + }
> + seq_puts(s, clk->name);
> +
> + i = 2 * nest + strlen(clk->name);
> + if (i >= NAME_FIELD_LEN)
> + i = NAME_FIELD_LEN - 1;
> + for (; i < NAME_FIELD_LEN; i++) {
> + seq_putc(s, ' ');
> + }
> + seq_printf(s, "%c use=%d rate=%10lu Hz",
> + clk->ops && clk->ops->set_parent ? '*' : ' ',
> + clk->users,
> + __clk_get_rate(clk));
> + if (clk->ops && clk->ops->format)
> + clk->ops->format(clk, s);
> + seq_putc(s, '\n');
> +
> + dump_clocks(s, clk, nest + 1);
> + }
> + }
> +}
hm, this would break the one-value-per-file rule, except that applies to
sysfs, but this interface is implemented via debug fs, but it is proposed
that it appear under /sys. Tricky.
next prev parent reply other threads:[~2008-04-07 22:59 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-03 13:21 [PATCH 0/6] Clocklib: generic clocks framework Dmitry Baryshkov
2008-04-03 13:23 ` [PATCH 1/6] Clocklib: add generic framework for managing clocks Dmitry Baryshkov
2008-04-07 22:55 ` Andrew Morton
2008-04-03 13:23 ` [PATCH 2/6] Clocklib: debugfs support Dmitry Baryshkov
2008-04-07 22:59 ` Andrew Morton [this message]
2008-04-08 1:04 ` Greg KH
2008-04-03 13:23 ` [PATCH 3/6] Clocklib: support sa1100 sub-arch Dmitry Baryshkov
2008-04-03 13:23 ` [PATCH 4/6] Clocklib: support ARM pxa sub-arch Dmitry Baryshkov
2008-04-03 13:24 ` [PATCH 5/6] Clocklib: Use correct clock for IrDA on pxa Dmitry Baryshkov
2008-04-07 23:00 ` Andrew Morton
2008-04-07 23:04 ` Russell King
2008-04-08 9:47 ` Dmitry
2008-04-08 19:33 ` Russell King
2008-04-09 7:15 ` Dmitry
2008-04-09 19:05 ` Russell King
2008-04-09 19:09 ` Alan Cox
2008-04-09 19:20 ` Russell King
2008-04-09 19:39 ` Dmitry
2008-04-09 20:52 ` Alan Cox
2008-04-09 21:37 ` Russell King
2008-04-03 13:24 ` [PATCH 6/6] Clocklib: use correct name for 3,6MHz clock Dmitry Baryshkov
2008-04-07 23:01 ` Andrew Morton
2008-04-07 23:06 ` Russell King
2008-04-08 9:52 ` Dmitry
2008-04-08 19:35 ` Russell King
2008-04-08 19:58 ` Dmitry
2008-04-08 20:07 ` Russell King
2008-04-09 7:19 ` Dmitry
2008-04-11 10:25 ` Dmitry Baryshkov
-- strict thread matches above, loose matches on Subject: below --
2008-03-31 8:39 [PATCH 0/6] Clocklib: generic clocks framework Dmitry Baryshkov
2008-03-31 8:44 ` [PATCH 2/6] Clocklib: debugfs support Dmitry Baryshkov
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=20080407155901.c7431c3e.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dbaryshkov@gmail.com \
--cc=greg@kroah.com \
--cc=haavard.skinnemoen@atmel.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@pwsan.com \
--cc=pavel@ucw.cz \
--cc=philipp.zabel@gmail.com \
--cc=rmk+lkml@arm.linux.org.uk \
--cc=tony@atomide.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.