cpufreq: Save user policy min/max instead of policy min/max during hotplug

When a CPU is hotplugged off, various fields of the policy are saved so
that they can be restored when the CPU is hotplugged back in.

The existing code saves the policy min/max field during hotplug remove and
restores it into user policy min/max during hotplug add. This results in
the loss of the user policy min/max values across a hotplug remove/add.

Fix it by saving the user policy min/max instead of policy min/max during
hotplug remove. During a hotplug add, after user policy min/max is
restored, the policy min/max is already recomputed. So, there's no risk of
going beyound any limits imposed by the CPUFREQ_ADJUST/INCOMPATIBLE
notifiers.

Change-Id: Ib8e09fa324c1f80f095c5754b5dcf2685e8e4a66
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
cpufreq: ondemand: Fix locking issue in store_powersave_bias

store_powersave_bias takes timer_mutex before calling dbs_timer_exit
which tries to cancel the delayed work do_dbs_timer which in turn
tries to take the same lock. This can cause a lock recursion under
the race condition where can cancel_delayed_work_sync is called
when the work has already started executing.

This can be avoided by taking that lock after calling
dbs_timer_exit.

Change-Id: I7f862286e66f1ddc1e13e4eeee369dd188fc10d5
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
cpufreq: Remove rwsem lock from CPUFREQ_GOV_STOP call (again)

We need to unlock the semaphore due to an enabled conservative governor and
those old input hook commits.

We should get rid of the unused input boost functions, for now this is good
enough.

<4>[ 1338.237854] ------------[ cut here ]------------
<4>[ 1338.238067] WARNING: at fs/sysfs/dir.c:508 sysfs_add_one+0x7c/0x9c()
<4>[ 1338.238189] sysfs: cannot create duplicate filename '/devices/system/cpu/c
pufreq/conservative'
<4>[ 1338.238403] [<c010c204>] (unwind_backtrace+0x0/0xe0) from [<c0167a18>] (wa
rn_slowpath_common+0x48/0x60)
<4>[ 1338.238616] [<c0167a18>] (warn_slowpath_common+0x48/0x60) from [<c0167a88>
] (warn_slowpath_fmt+0x2c/0x3c)
<4>[ 1338.238830] [<c0167a88>] (warn_slowpath_fmt+0x2c/0x3c) from [<c026dc38>] (
sysfs_add_one+0x7c/0x9c)
<4>[ 1338.238952] [<c026dc38>] (sysfs_add_one+0x7c/0x9c) from [<c026de34>] (crea
te_dir+0x58/0xb0)
<4>[ 1338.239166] [<c026de34>] (create_dir+0x58/0xb0) from [<c026e0e0>] (sysfs_c
reate_subdir+0x18/0x1c)
<4>[ 1338.241058] [<c026e0e0>] (sysfs_create_subdir+0x18/0x1c) from [<c026f530>]
 (internal_create_group+0x84/0x1e0)
<4>[ 1338.241180] [<c026f530>] (internal_create_group+0x84/0x1e0) from [<c059ee5
4>] (cpufreq_governor_dbs+0x22c/0x3f8)
<4>[ 1338.241302] [<c059ee54>] (cpufreq_governor_dbs+0x22c/0x3f8) from [<c059a06
c>] (__cpufreq_governor+0x50/0x5c)
<4>[ 1338.241394] [<c059a06c>] (__cpufreq_governor+0x50/0x5c) from [<c059a198>]
(__cpufreq_set_policy+0x120/0x168)
<4>[ 1338.241516] [<c059a198>] (__cpufreq_set_policy+0x120/0x168) from [<c059a85
0>] (cpufreq_add_dev_interface+0x274/0x2c4)
<4>[ 1338.241577] [<c059a850>] (cpufreq_add_dev_interface+0x274/0x2c4) from [<c0
59ac84>] (cpufreq_add_dev+0x3e4/0x43c)
<4>[ 1338.241699] [<c059ac84>] (cpufreq_add_dev+0x3e4/0x43c) from [<c0907e70>] (
cpufreq_cpu_callback+0x88/0x9c)
<4>[ 1338.241821] [<c0907e70>] (cpufreq_cpu_callback+0x88/0x9c) from [<c0189b34>
] (notifier_call_chain+0x38/0x68)
<4>[ 1338.241943] [<c0189b34>] (notifier_call_chain+0x38/0x68) from [<c0169958>]
 (__cpu_notify+0x28/0x40)
<4>[ 1338.242065] [<c0169958>] (__cpu_notify+0x28/0x40) from [<c0905c30>] (_cpu_
up+0xc8/0x1a8)
<4>[ 1338.242156] [<c0905c30>] (_cpu_up+0xc8/0x1a8) from [<c0905d74>] (cpu_up+0x
64/0x84)
<4>[ 1338.242248] [<c0905d74>] (cpu_up+0x64/0x84) from [<c0903fac>] (decide_hotp
lug_func+0x1e8/0x2ec)
<4>[ 1338.242370] [<c0903fac>] (decide_hotplug_func+0x1e8/0x2ec) from [<c017f108
>] (process_one_work+0x204/0x410)
<4>[ 1338.242462] [<c017f108>] (process_one_work+0x204/0x410) from [<c017f4c8>]
(worker_thread+0x188/0x2a8)
<4>[ 1338.242584] [<c017f4c8>] (worker_thread+0x188/0x2a8) from [<c0184390>] (kt
hread+0x84/0x94)
<4>[ 1338.242675] [<c0184390>] (kthread+0x84/0x94) from [<c0106d8c>] (kernel_thr
ead_exit+0x0/0x8)
<4>[ 1338.242767] ---[ end trace e6d9e62662a91860 ]---
cpufreq: Always update frequency limits when setting a new policy
v1.2.1