From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCHv3 3/6] clk: Add TI-Nspire clock drivers
Date: Wed, 15 May 2013 16:07:54 +0200 [thread overview]
Message-ID: <201305151607.54442.arnd@arndb.de> (raw)
In-Reply-To: <1368332581-94691-4-git-send-email-dt.tangr@gmail.com>
On Sunday 12 May 2013, Daniel Tang wrote:
>
> Signed-off-by: Daniel Tang <dt.tangr@gmail.com>
> ---
> drivers/clk/Makefile | 1 +
> drivers/clk/clk-nspire.c | 141 +++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 142 insertions(+)
> create mode 100644 drivers/clk/clk-nspire.c
You are missing a binding in Documentation/devicetree, same as for some of
the other drivers in this series.
> +static int nspire_clk_read(struct device_node *node,
> + struct nspire_clk_info *clk)
> +{
> + u32 val;
> + int ret;
> + void __iomem *io;
> + const char *type = NULL;
> +
> + ret = of_property_read_string(node, "io-type", &type);
> + if (ret)
> + return ret;
Using a string here feels clumsy. Why not use the "compatible" property
to distinguish the different models?
> +static void __init nspire_ahbdiv_setup(struct device_node *node)
> +{
> + int ret;
> + struct clk *clk;
> + const char *clk_name = node->name;
> + const char *parent_name;
> + struct nspire_clk_info info;
> +
> + ret = nspire_clk_read(node, &info);
> + if (WARN_ON(ret))
> + return;
> +
> + of_property_read_string(node, "clock-output-names", &clk_name);
It seems strange to assign the clk_name variable to node->name
first and then overriding it with the clock-output-names property.
Is that intentional? If so, please explain it in a comment.
> +
> + pr_info("TI-NSPIRE Base: %uMHz CPU: %uMHz AHB: %uMHz\n",
> + info.base_clock / MHZ,
> + info.base_clock / info.base_cpu_ratio / MHZ,
> + info.base_clock / info.base_ahb_ratio / MHZ);
> +}
> +
> +CLK_OF_DECLARE(nspire_clk, "nspire-clock", nspire_clk_setup);
> +CLK_OF_DECLARE(nspire_ahbdiv, "nspire-ahb-divider", nspire_ahbdiv_setup);
I would put each of these lines directly under the function it references.
Arnd
WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: Daniel Tang <dt.tangr@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk,
Linus Walleij <linus.walleij@linaro.org>,
"fabian@ritter-vogt.de Vogt" <fabian@ritter-vogt.de>,
Lionel Debroux <lionel_debroux@yahoo.fr>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCHv3 3/6] clk: Add TI-Nspire clock drivers
Date: Wed, 15 May 2013 16:07:54 +0200 [thread overview]
Message-ID: <201305151607.54442.arnd@arndb.de> (raw)
In-Reply-To: <1368332581-94691-4-git-send-email-dt.tangr@gmail.com>
On Sunday 12 May 2013, Daniel Tang wrote:
>
> Signed-off-by: Daniel Tang <dt.tangr@gmail.com>
> ---
> drivers/clk/Makefile | 1 +
> drivers/clk/clk-nspire.c | 141 +++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 142 insertions(+)
> create mode 100644 drivers/clk/clk-nspire.c
You are missing a binding in Documentation/devicetree, same as for some of
the other drivers in this series.
> +static int nspire_clk_read(struct device_node *node,
> + struct nspire_clk_info *clk)
> +{
> + u32 val;
> + int ret;
> + void __iomem *io;
> + const char *type = NULL;
> +
> + ret = of_property_read_string(node, "io-type", &type);
> + if (ret)
> + return ret;
Using a string here feels clumsy. Why not use the "compatible" property
to distinguish the different models?
> +static void __init nspire_ahbdiv_setup(struct device_node *node)
> +{
> + int ret;
> + struct clk *clk;
> + const char *clk_name = node->name;
> + const char *parent_name;
> + struct nspire_clk_info info;
> +
> + ret = nspire_clk_read(node, &info);
> + if (WARN_ON(ret))
> + return;
> +
> + of_property_read_string(node, "clock-output-names", &clk_name);
It seems strange to assign the clk_name variable to node->name
first and then overriding it with the clock-output-names property.
Is that intentional? If so, please explain it in a comment.
> +
> + pr_info("TI-NSPIRE Base: %uMHz CPU: %uMHz AHB: %uMHz\n",
> + info.base_clock / MHZ,
> + info.base_clock / info.base_cpu_ratio / MHZ,
> + info.base_clock / info.base_ahb_ratio / MHZ);
> +}
> +
> +CLK_OF_DECLARE(nspire_clk, "nspire-clock", nspire_clk_setup);
> +CLK_OF_DECLARE(nspire_ahbdiv, "nspire-ahb-divider", nspire_ahbdiv_setup);
I would put each of these lines directly under the function it references.
Arnd
next prev parent reply other threads:[~2013-05-15 14:07 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-12 4:22 [RFC PATCHv3 0/6] arm: Initial TI-Nspire support Daniel Tang
2013-05-12 4:22 ` Daniel Tang
2013-05-12 4:22 ` [RFC PATCHv3 1/6] " Daniel Tang
2013-05-12 4:22 ` Daniel Tang
2013-05-12 9:06 ` Russell King - ARM Linux
2013-05-12 9:06 ` Russell King - ARM Linux
2013-05-12 9:22 ` Daniel Tang
2013-05-12 9:22 ` Daniel Tang
2013-05-12 4:22 ` [RFC PATCHv3 2/6] arm: Add device trees for TI-Nspire Daniel Tang
2013-05-12 4:22 ` Daniel Tang
2013-05-15 14:10 ` Arnd Bergmann
2013-05-15 14:10 ` Arnd Bergmann
2013-05-12 4:22 ` [RFC PATCHv3 3/6] clk: Add TI-Nspire clock drivers Daniel Tang
2013-05-12 4:22 ` Daniel Tang
2013-05-15 14:07 ` Arnd Bergmann [this message]
2013-05-15 14:07 ` Arnd Bergmann
2013-05-16 8:31 ` Daniel Tang
2013-05-16 8:31 ` Daniel Tang
2013-05-16 12:17 ` Arnd Bergmann
2013-05-16 12:17 ` Arnd Bergmann
2013-05-19 11:09 ` Daniel Tang
2013-05-19 11:09 ` Daniel Tang
2013-05-19 19:48 ` Arnd Bergmann
2013-05-19 19:48 ` Arnd Bergmann
2013-05-20 11:19 ` Daniel Tang
2013-05-20 11:19 ` Daniel Tang
2013-05-20 12:26 ` Arnd Bergmann
2013-05-20 12:26 ` Arnd Bergmann
2013-05-12 4:22 ` [RFC PATCHv3 4/6] clocksource: Add TI-Nspire timer drivers Daniel Tang
2013-05-12 4:22 ` Daniel Tang
2013-05-14 8:03 ` Linus Walleij
2013-05-14 8:03 ` Linus Walleij
2013-05-14 11:51 ` Daniel Tang
2013-05-14 11:51 ` Daniel Tang
2013-05-17 13:17 ` Linus Walleij
2013-05-17 13:17 ` Linus Walleij
2013-05-18 6:40 ` Daniel Tang
2013-05-18 6:40 ` Daniel Tang
2013-05-20 12:49 ` Linus Walleij
2013-05-20 12:49 ` Linus Walleij
2013-05-12 4:23 ` [RFC PATCHv3 5/6] input: Add TI-Nspire keypad driver Daniel Tang
2013-05-12 4:23 ` Daniel Tang
2013-05-12 4:23 ` [RFC PATCHv3 6/6] irqchip: Add TI-Nspire irqchip Daniel Tang
2013-05-12 4:23 ` Daniel Tang
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=201305151607.54442.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=linux-arm-kernel@lists.infradead.org \
/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.