[PATCH v3 4/7] ARM: sa1100: clean up clock support
Russell King - ARM Linux
linux at arm.linux.org.uk
Thu Feb 23 11:26:35 EST 2012
On Fri, Feb 24, 2012 at 12:00:48AM +0800, Haojian Zhuang wrote:
> int clk_enable(struct clk *clk)
> {
> unsigned long flags;
>
> spin_lock_irqsave(&clocks_lock, flags);
> if (clk->enabled++ == 0)
> - clk_gpio27_enable();
> + clk->ops->enable(clk);
> spin_unlock_irqrestore(&clocks_lock, flags);
If we're going to allow clk to be NULL, this needs:
if (clk) {
...
}
around it.
> +
> return 0;
> }
> EXPORT_SYMBOL(clk_enable);
> @@ -76,13 +72,26 @@ void clk_disable(struct clk *clk)
>
> spin_lock_irqsave(&clocks_lock, flags);
> if (--clk->enabled == 0)
> - clk_gpio27_disable();
> + clk->ops->disable(clk);
> spin_unlock_irqrestore(&clocks_lock, flags);
Same here.
> }
> EXPORT_SYMBOL(clk_disable);
>
> -unsigned long clk_get_rate(struct clk *clk)
> +const struct clkops clk_gpio27_ops = {
> + .enable = clk_gpio27_enable,
> + .disable = clk_gpio27_disable,
> +};
> +
> +static DEFINE_CLK(gpio27, &clk_gpio27_ops);
> +
> +static struct clk_lookup sa11xx_clkregs[] = {
> + CLKDEV_INIT("sa1111.0", NULL, &clk_gpio27),
> + CLKDEV_INIT("sa1100-rtc", NULL, NULL),
And as this introduces NULL clock, the above needs to be part of this
patch.
Apart from that, it's fine.
More information about the linux-arm-kernel
mailing list