cpufreq: interactive: fix race on timer restart on governor start
authorTodd Poynor <toddpoynor@google.com>
Thu, 20 Dec 2012 23:51:00 +0000 (15:51 -0800)
committerArve Hjønnevåg <arve@android.com>
Mon, 1 Jul 2013 21:16:18 +0000 (14:16 -0700)
commit1d0427d1c36f56bef034cb562ec9c5a09f0fa62c
tree948c9719d2ea06b3f1157ddcb898d2e7ed2ce773
parentbeb55c19d504f6d8fd7cd1c019027d67d4b4084a
cpufreq: interactive: fix race on timer restart on governor start

Starting the governor, or restarting on a hotplugged-in CPU, can race
with the timer start in idle, triggering a BUG on timer already pending.
Start the timer before setting the enable flag, and use enable_sem to
protect the sequence (and ensure correct order of the update to the
enable flag).  Delete any existing timer for safety.

Change-Id: Ife77cf9fe099e8fd8543224cbf148c6722c2ffb0
Reported-by: Francisco Franco <francisco.franco@cloudcar.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
drivers/cpufreq/cpufreq_interactive.c