acpi-cpufreq: replace per_cpu with driver_data of policy
authorPan Xinhui <xinhuix.pan@intel.com>
Tue, 7 Jul 2015 12:43:26 +0000 (20:43 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 16 Jul 2015 21:51:05 +0000 (23:51 +0200)
commiteb0b3e78e6290e5a1bf970830939d5c8c9151892
tree458fbbd60bb39f8ae937484c16c1f83edf654ddd
parent5a31d594a9732a2fa2eb83b0c4dcba75da2dff5d
acpi-cpufreq: replace per_cpu with driver_data of policy

Drivers can store their internal per-policy information in
policy->driver_data, lets use it.

we have benefits after this replacing.
1) memory saving.
2) policy is shared by several cpus, per_cpu seems not correct. using
*driver_data* is more reasonable.
3) fix a memory leak in acpi_cpufreq_cpu_exit. as policy->cpu might
change during cpu hotplug. So sometimes we cant't free *data*, use
*driver_data* to fix it.
4) fix a zero return value of get_cur_freq_on_cpu. Only per_cpu of
policy->cpu is set to *data*, if we try to get cpufreq on other cpus, we
get zero instead of correct values. Use *driver_data* to fix it.

Signed-off-by: Pan Xinhui <xinhuix.pan@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/acpi-cpufreq.c