Re: [RFC PATCHv3 3/6] clk: Add TI-Nspire clock drivers

From: Arnd Bergmann
Date: Wed May 15 2013 - 10:08:32 EST


On Sunday 12 May 2013, Daniel Tang wrote:
>
> Signed-off-by: Daniel Tang <dt.tangr@xxxxxxxxx>
> ---
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/