[PATCH RFC] clk: add support for automatic parent handling
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Sun Apr 24 16:14:30 EDT 2011
On Sun, Apr 24, 2011 at 05:45:57PM +0800, Richard Zhao wrote:
> Hi Uwe,
> On Wed, Apr 20, 2011 at 04:07:37PM +0200, Uwe Kleine-König wrote:
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> > ---
> > Hello,
> >
> > only compile tested so far.
> >
> > Best regards
> > Uwe
> >
> > drivers/clk/clk.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> > include/linux/clk.h | 8 ++++++++
> > 2 files changed, 51 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index 264c809..7627815 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -14,10 +14,23 @@
> > int clk_prepare(struct clk *clk)
> > {
> > int ret = 0;
> > + struct clk *parent = ERR_PTR(-ENOSYS);
> >
> > if (!clk)
> > return 0;
> >
> > + if (clk->ops->flags & CLK_OPS_GENERIC_PARENT) {
> > + parent = clk_get_parent(clk);
> > +
> > + if (!IS_ERR(parent)) {
> > + ret = clk_prepare(parent);
> > + if (ret)
> > + return ret;
> > + } else if (PTR_ERR(parent) != -ENOSYS)
> > + /* -ENOSYS means no parent and is OK */
> > + return PTR_ERR(parent);
> > + }
> Is this supposed to be in prepare_lock? If prepare_count > 1, we need do nothing.
> Other parent operations need to be in lock protect too.
Yeah, I noticed that myself, too. Also it would be nice to handle the
set_parent callback.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
More information about the linux-arm-kernel
mailing list