From: Paul Walmsley Date: Wed, 7 Jan 2009 15:23:45 +0000 (+0200) Subject: OMAP2/3 clock: omap2_clk_enable(): refactor usecount check X-Git-Tag: v2.6.28-omap1~28 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=18d4ecba1c1afc52379d5395766f442948822fc0;p=linux-2.6-omap-h63xx.git OMAP2/3 clock: omap2_clk_enable(): refactor usecount check Clean up omap2_clk_enable() by moving most of the function body out of the usecount check. Should result in no functional change. Signed-off-by: Paul Walmsley Signed-off-by: Tony Lindgren --- diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c index 1979d5fc9cc..3f8354da62a 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c @@ -485,26 +485,27 @@ int omap2_clk_enable(struct clk *clk) { int ret = 0; - if (clk->usecount++ == 0) { - if (clk->parent) - ret = omap2_clk_enable(clk->parent); + if (++clk->usecount > 1) + return 0; - if (ret != 0) { - clk->usecount--; - return ret; - } + if (clk->parent) + ret = omap2_clk_enable(clk->parent); + + if (ret != 0) { + clk->usecount--; + return ret; + } - omap2_clkdm_clk_enable(clk->clkdm.ptr, clk); + omap2_clkdm_clk_enable(clk->clkdm.ptr, clk); - ret = _omap2_clk_enable(clk); + ret = _omap2_clk_enable(clk); - if (ret != 0) { - omap2_clkdm_clk_disable(clk->clkdm.ptr, clk); + if (ret != 0) { + omap2_clkdm_clk_disable(clk->clkdm.ptr, clk); - if (clk->parent) { - omap2_clk_disable(clk->parent); - clk->usecount--; - } + if (clk->parent) { + omap2_clk_disable(clk->parent); + clk->usecount--; } }