]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
OMAP2/3 clock: omap2_clk_enable(): fix bugs in clockdomain handling
authorPaul Walmsley <paul@pwsan.com>
Wed, 7 Jan 2009 15:23:45 +0000 (17:23 +0200)
committerTony Lindgren <tony@atomide.com>
Wed, 7 Jan 2009 15:23:45 +0000 (17:23 +0200)
omap2_clk_enable() should enable a clock's clockdomain before
attempting to enable its parent clock's clockdomain.  Similarly, in
the unlikely event that the parent clock enable fails, the clockdomain
should be disabled.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/clock.c

index 3f8354da62a3f88c5024b69d717c9616d0eb747b..55f43d0e6889a2076bcbc571781ad60028973c52 100644 (file)
@@ -488,16 +488,17 @@ int omap2_clk_enable(struct clk *clk)
        if (++clk->usecount > 1)
                return 0;
 
        if (++clk->usecount > 1)
                return 0;
 
+       omap2_clkdm_clk_enable(clk->clkdm.ptr, clk);
+
        if (clk->parent)
                ret = omap2_clk_enable(clk->parent);
 
        if (ret != 0) {
                clk->usecount--;
        if (clk->parent)
                ret = omap2_clk_enable(clk->parent);
 
        if (ret != 0) {
                clk->usecount--;
+               omap2_clkdm_clk_disable(clk->clkdm.ptr, clk);
                return ret;
        }
 
                return ret;
        }
 
-       omap2_clkdm_clk_enable(clk->clkdm.ptr, clk);
-
        ret = _omap2_clk_enable(clk);
 
        if (ret != 0) {
        ret = _omap2_clk_enable(clk);
 
        if (ret != 0) {