[PATCH 6/7] rtc: sa1100: enable clk support
Russell King - ARM Linux
linux at arm.linux.org.uk
Wed Feb 22 08:20:29 EST 2012
On Wed, Feb 22, 2012 at 12:29:17PM +0000, Arnd Bergmann wrote:
> On Tuesday 21 February 2012, Haojian Zhuang wrote:
> > @@ -306,6 +308,13 @@ static int sa1100_rtc_probe(struct platform_device *pdev)
> > if (!info)
> > return -ENOMEM;
> >
> > + info->clk = clk_get(&pdev->dev, NULL);
> > + if (IS_ERR(info->clk)) {
> > + dev_err(&pdev->dev, "failed to find rtc clock source\n");
> > + ret = PTR_ERR(info->clk);
> > + goto err_clk;
> > + }
> > + clk_prepare_enable(info->clk);
> > info->iobase = res->start;
> > info->iosize = resource_size(res);
> > info->irq_1hz = irq_1hz;
> > @@ -379,6 +388,9 @@ err_dev:
> > iounmap(info->reg_base);
> > err_map:
> > platform_set_drvdata(pdev, NULL);
> > + clk_disable_unprepare(info->clk);
> > + clk_put(info->clk);
> > +err_clk:
> > kfree(info);
> > return ret;
>
> I wonder whether it would be easier to just make the clk handling
> conditional here, like
Eww. No, just keep this hidden beneath the clk API. Return a NULL
clock for this device, and ensure that all the standard clk API
functions know internally that that means 'no action required'.
There's no need to pollute drivers with this platform specific knowledge.
More information about the linux-arm-kernel
mailing list