From: Rafael J. Wysocki Date: Fri, 13 May 2016 23:01:08 +0000 (+0200) Subject: cpufreq: governor: Simplify performance and powersave governors X-Git-Tag: v4.8-rc1~25^2^3~16^2~3^2~4^2~18 X-Git-Url: http://git.cascardo.info/?a=commitdiff_plain;ds=sidebyside;h=16de72b9f4d07e393bea7b1221898b3be718a296;p=cascardo%2Flinux.git cpufreq: governor: Simplify performance and powersave governors The performance and powersave cpufreq governors handle the CPUFREQ_GOV_START event in the same way as CPUFREQ_GOV_LIMITS. However, the cpufreq core always invokes cpufreq_governor() with the event argument equal to CPUFREQ_GOV_LIMITS right after invoking it with event equal to CPUFREQ_GOV_START. As a result, for both the governors in question, __cpufreq_driver_target() is executed twice in a row with the same arguments which is not useful. For this reason, simplify the performance and powersave governors to handle the CPUFREQ_GOV_LIMITS event only as that's going to be sufficient for the governor start too. Signed-off-by: Rafael J. Wysocki Acked-by: Viresh Kumar --- diff --git a/drivers/cpufreq/cpufreq_performance.c b/drivers/cpufreq/cpufreq_performance.c index af9f4b96f5a8..dd4dca3ab844 100644 --- a/drivers/cpufreq/cpufreq_performance.c +++ b/drivers/cpufreq/cpufreq_performance.c @@ -20,10 +20,8 @@ static int cpufreq_governor_performance(struct cpufreq_policy *policy, unsigned int event) { switch (event) { - case CPUFREQ_GOV_START: case CPUFREQ_GOV_LIMITS: - pr_debug("setting to %u kHz because of event %u\n", - policy->max, event); + pr_debug("setting to %u kHz\n", policy->max); __cpufreq_driver_target(policy, policy->max, CPUFREQ_RELATION_H); break; diff --git a/drivers/cpufreq/cpufreq_powersave.c b/drivers/cpufreq/cpufreq_powersave.c index b8b400232a74..691e573e46ee 100644 --- a/drivers/cpufreq/cpufreq_powersave.c +++ b/drivers/cpufreq/cpufreq_powersave.c @@ -20,10 +20,8 @@ static int cpufreq_governor_powersave(struct cpufreq_policy *policy, unsigned int event) { switch (event) { - case CPUFREQ_GOV_START: case CPUFREQ_GOV_LIMITS: - pr_debug("setting to %u kHz because of event %u\n", - policy->min, event); + pr_debug("setting to %u kHz\n", policy->min); __cpufreq_driver_target(policy, policy->min, CPUFREQ_RELATION_L); break;