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)
committerGrazvydas Ignotas <notasas@gmail.com>
Mon, 14 Apr 2014 20:09:24 +0000 (23:09 +0300)
commitc07f62e87e36d218a4dcb164aa9cbc1f920cdd17
treeb436a2a4930ec6098c7f8f8a2bd0f5ffbfe3e9cd
parenta551dd56a91c6d8b80fe531b2184a4f7ab74da67
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