OMAP2+ clock: revise omap2_clk_{disable,enable}()
authorPaul Walmsley <paul@pwsan.com>
Tue, 23 Feb 2010 05:09:38 +0000 (22:09 -0700)
committerPaul Walmsley <paul@pwsan.com>
Thu, 25 Feb 2010 00:45:16 +0000 (17:45 -0700)
commit30962d9d0c74f6b00a7dece200fa08392b62817d
tree72c1e60fd4f42c244fb8fe9c68f8e3d95a880edb
parent4d30e82c26b7212021b9a5ab57760d9b8a3075fe
OMAP2+ clock: revise omap2_clk_{disable,enable}()

Simplify the code in the omap2_clk_disable() and omap2_clk_enable()
functions, reducing levels of indentation.  This makes the code easier
to read.  Add some additional debugging pr_debug()s here also to help
others understand what is going on.

Revise the omap2_clk_disable() logic so that it now attempts to
disable the clock's clockdomain before recursing up the clock tree.
Simultaneously, ensure that omap2_clk_enable() is called on parent
clocks first, before enabling the clockdomain.  This ensures that a
parent clock's clockdomain is enabled before the child clock's
clockdomain.  These sequences should be the inverse of each other.

Revise the omap2_clk_enable() logic so that it now cleans up after
itself upon encountering an error.  Previously, an error enabling a
parent clock could have resulted in inconsistent usecounts on the
enclosing clockdomain.

Remove the trivial _omap2_clk_disable() and _omap2_clk_enable() static
functions, and replace it with the clkops calls that they were
executing.

For all this to work, the clockdomain omap2_clkdm_clk_enable() and
omap2_clkdm_clk_disable() code must not return an error on clockdomains
without CLKSTCTRL registers; so modify those functions to simply return 0
in that case.

While here, add some basic kerneldoc documentation on both functions,
and get rid of some old non-CodingStyle-compliant comments that have
existed since the dawn of time (at least, the OMAP clock framework's
time).

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Richard Woodruff <r-woodruff2@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
arch/arm/mach-omap2/clock.c
arch/arm/mach-omap2/clockdomain.c