cpufreq interactive governor: fix crash on CPU shutdown
Don't reference the saved copy of the CPU's cpufreq policy
pointer after the governor has been stopped for the CPU.
When the governor is stopped for a CPU:
* Use del_timer_sync() to wait for a currently-running timer
function to stop.
* Delete the timer when the governor is stopped for the
associated CPU, not when the last CPU is stopped.
* Flush any speed down work ongoing.
* Reset the timestamp that is used to tell if the timer function
has had a chance to run since last idle exit.
Check the governor enabled flag for the CPU before re-arming the
timer from within the timer function and at idle exit (in case
stopping the governor at runtime).
Check the governor enabled flag for the CPU in the worker
function and thread before using the policy pointer. (There is
still a tiny window in the thread that needs more work to close.)
Change-Id: Ifaddf7a495a8dae15a579a57bdc654f7c47f6ada
Signed-off-by: Todd Poynor <toddpoynor@google.com>