ARM: OMAP: clockdomain: Fix locking on _clkdm_clk_hwmod_enable / disable
authorTero Kristo <t-kristo@ti.com>
Tue, 25 Sep 2012 16:05:32 +0000 (19:05 +0300)
committerTony Lindgren <tony@atomide.com>
Wed, 17 Oct 2012 16:00:31 +0000 (09:00 -0700)
commit64e29fd5ed42f5d0ff5b0ea9395b3abd5d43f89b
tree2d1a162662e2279f03d17de9b2e33c5d6cb8ca54
parent49c58e82023649924b1b0f38d715d94093f4044b
ARM: OMAP: clockdomain: Fix locking on _clkdm_clk_hwmod_enable / disable

Previously the code only acquired spinlock after increasing / decreasing
the usecount value, which is wrong. This leaves a small window where
a task switch may occur between the check of the usecount and the actual
wakeup / sleep of the domain. Fixed by moving the spinlock locking before
the usecount access. Left the usecount as atomic_t if someone wants an
easy access to the parameter through atomic_read.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
Acked-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/clockdomain.c