lkml.org 
[lkml]   [2010]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] arm: mxc: utilise usecount field in clock operations
    Hi Amit,

    On Wed, Apr 21, 2010 at 09:37:31PM +0300, Amit Kucheria wrote:
    > clk->usecount can be used by platform code to check if a clock is active or
    > not.
    >
    > Signed-off-by: Amit Kucheria <amit.kucheria@canonical.com>
    > ---
    > arch/arm/plat-mxc/clock.c | 37 ++++++++++++++++++++++++-------------
    > 1 files changed, 24 insertions(+), 13 deletions(-)
    >
    > diff --git a/arch/arm/plat-mxc/clock.c b/arch/arm/plat-mxc/clock.c
    > index 323ff8c..c791f38 100644
    > --- a/arch/arm/plat-mxc/clock.c
    > +++ b/arch/arm/plat-mxc/clock.c

    [snip]

    > @@ -160,17 +161,27 @@ EXPORT_SYMBOL(clk_set_rate);
    > int clk_set_parent(struct clk *clk, struct clk *parent)
    > {
    > int ret = -EINVAL;
    > + struct clk *prev_parent = clk->parent;
    >
    > if (clk == NULL || IS_ERR(clk) || parent == NULL ||
    > IS_ERR(parent) || clk->set_parent == NULL)
    > return ret;
    >
    > + if (clk->usecount != 0) {
    > + clk_enable(parent);
    > + }

    Unnecessary braces here. See chapter 3 of Documentation/CodingStyle.

    > +
    > mutex_lock(&clocks_mutex);
    > ret = clk->set_parent(clk, parent);
    > - if (ret == 0)
    > + if (ret == 0) {
    > clk->parent = parent;
    > + }

    Ditto

    > mutex_unlock(&clocks_mutex);
    >
    > + if (clk->usecount != 0) {
    > + clk_disable(prev_parent);
    > + }

    Ditto

    > +
    > return ret;
    > }
    > EXPORT_SYMBOL(clk_set_parent);
    > --

    baruch

    --
    ~. .~ Tk Open Systems
    =}------------------------------------------------ooO--U--Ooo------------{=
    - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -


    \
     
     \ /
      Last update: 2010-04-22 13:51    [W:0.021 / U:92.444 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site