Commit 17135782 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

cpufreq: acpi-cpufreq: Simplify boost-related code

The store_boost() routine is only used by store_cpb(), so move
the code from it directly to that function and rename _store_boost()
to set_boost() to make its name reflect the name of the driver
callback pointing to it.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent 41669da0
...@@ -135,7 +135,7 @@ static void boost_set_msrs(bool enable, const struct cpumask *cpumask) ...@@ -135,7 +135,7 @@ static void boost_set_msrs(bool enable, const struct cpumask *cpumask)
wrmsr_on_cpus(cpumask, msr_addr, msrs); wrmsr_on_cpus(cpumask, msr_addr, msrs);
} }
static int _store_boost(int val) static int set_boost(int val)
{ {
get_online_cpus(); get_online_cpus();
boost_set_msrs(val, cpu_online_mask); boost_set_msrs(val, cpu_online_mask);
...@@ -158,29 +158,24 @@ static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf) ...@@ -158,29 +158,24 @@ static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *buf)
cpufreq_freq_attr_ro(freqdomain_cpus); cpufreq_freq_attr_ro(freqdomain_cpus);
#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB #ifdef CONFIG_X86_ACPI_CPUFREQ_CPB
static ssize_t store_boost(const char *buf, size_t count) static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf,
size_t count)
{ {
int ret; int ret;
unsigned long val = 0; unsigned int val = 0;
if (!acpi_cpufreq_driver.boost_supported) if (!acpi_cpufreq_driver.boost_supported)
return -EINVAL; return -EINVAL;
ret = kstrtoul(buf, 10, &val); ret = kstrtouint(buf, 10, &val);
if (ret || (val > 1)) if (ret || val > 1)
return -EINVAL; return -EINVAL;
_store_boost((int) val); set_boost(val);
return count; return count;
} }
static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf,
size_t count)
{
return store_boost(buf, count);
}
static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf) static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf)
{ {
return sprintf(buf, "%u\n", acpi_cpufreq_driver.boost_enabled); return sprintf(buf, "%u\n", acpi_cpufreq_driver.boost_enabled);
...@@ -905,7 +900,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = { ...@@ -905,7 +900,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
.resume = acpi_cpufreq_resume, .resume = acpi_cpufreq_resume,
.name = "acpi-cpufreq", .name = "acpi-cpufreq",
.attr = acpi_cpufreq_attr, .attr = acpi_cpufreq_attr,
.set_boost = _store_boost, .set_boost = set_boost,
}; };
static void __init acpi_cpufreq_boost_init(void) static void __init acpi_cpufreq_boost_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment