cpufreq: interactive: fix policy locking
authorDmitry Torokhov <dtor@chromium.org>
Wed, 4 Feb 2015 21:54:48 +0000 (13:54 -0800)
committerAmit Pundir <amit.pundir@linaro.org>
Thu, 7 Apr 2016 11:20:07 +0000 (16:50 +0530)
commit02018626853b6dd6dee77d1e1befeaf2d6a8098e
treef02b13b5eb3df7958d24a884be1e2cddd5bcf1df
parent73a20ae3132fc35ba83b6c622fc60b8fc9fe7589
cpufreq: interactive: fix policy locking

cpufreq_interactive_speedchange_task() is running as a separate kernel
thread and is calling __cpufreq_driver_target(), which requires callers
to hold policy->rwsem for writing to prevent racing with other parts of
the kernel trying to adjust the frequency, for example kernel thermal
throttling. Let's change the code to take policy->rwsem and while at it
refactor the code a bit.

This was originally 2 changes reviewed at:
https://chromium-review.googlesource.com/246273
https://chromium-review.googlesource.com/256120

Change-Id: Icc2d97c6c1b929acd2ee32e8c81d81fd2af778ab
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Dmitry Torokhov <dtor@google.com>
drivers/cpufreq/cpufreq_interactive.c