diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-06-13 17:33:17 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-06-13 17:33:17 -0400 |
commit | bb4b9933e2bc0554cf4db37aa07b19ff69a85f8f (patch) | |
tree | 92ec230e0292874d6a53ff33534e8637fa315479 /kernel | |
parent | 5edb56491d4812c42175980759da53388e5d86f5 (diff) | |
parent | f6709b8aa78fb6765c443ad6b70fdaf48b89d95d (diff) |
Merge back earlier cpufreq changes for v4.8.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched/cpufreq_schedutil.c | 43 |
1 files changed, 9 insertions, 34 deletions
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 14c4aa25cc45..758efd7f3abe 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c | |||
@@ -394,7 +394,7 @@ static int sugov_init(struct cpufreq_policy *policy) | |||
394 | return ret; | 394 | return ret; |
395 | } | 395 | } |
396 | 396 | ||
397 | static int sugov_exit(struct cpufreq_policy *policy) | 397 | static void sugov_exit(struct cpufreq_policy *policy) |
398 | { | 398 | { |
399 | struct sugov_policy *sg_policy = policy->governor_data; | 399 | struct sugov_policy *sg_policy = policy->governor_data; |
400 | struct sugov_tunables *tunables = sg_policy->tunables; | 400 | struct sugov_tunables *tunables = sg_policy->tunables; |
@@ -412,7 +412,6 @@ static int sugov_exit(struct cpufreq_policy *policy) | |||
412 | mutex_unlock(&global_tunables_lock); | 412 | mutex_unlock(&global_tunables_lock); |
413 | 413 | ||
414 | sugov_policy_free(sg_policy); | 414 | sugov_policy_free(sg_policy); |
415 | return 0; | ||
416 | } | 415 | } |
417 | 416 | ||
418 | static int sugov_start(struct cpufreq_policy *policy) | 417 | static int sugov_start(struct cpufreq_policy *policy) |
@@ -444,7 +443,7 @@ static int sugov_start(struct cpufreq_policy *policy) | |||
444 | return 0; | 443 | return 0; |
445 | } | 444 | } |
446 | 445 | ||
447 | static int sugov_stop(struct cpufreq_policy *policy) | 446 | static void sugov_stop(struct cpufreq_policy *policy) |
448 | { | 447 | { |
449 | struct sugov_policy *sg_policy = policy->governor_data; | 448 | struct sugov_policy *sg_policy = policy->governor_data; |
450 | unsigned int cpu; | 449 | unsigned int cpu; |
@@ -456,53 +455,29 @@ static int sugov_stop(struct cpufreq_policy *policy) | |||
456 | 455 | ||
457 | irq_work_sync(&sg_policy->irq_work); | 456 | irq_work_sync(&sg_policy->irq_work); |
458 | cancel_work_sync(&sg_policy->work); | 457 | cancel_work_sync(&sg_policy->work); |
459 | return 0; | ||
460 | } | 458 | } |
461 | 459 | ||
462 | static int sugov_limits(struct cpufreq_policy *policy) | 460 | static void sugov_limits(struct cpufreq_policy *policy) |
463 | { | 461 | { |
464 | struct sugov_policy *sg_policy = policy->governor_data; | 462 | struct sugov_policy *sg_policy = policy->governor_data; |
465 | 463 | ||
466 | if (!policy->fast_switch_enabled) { | 464 | if (!policy->fast_switch_enabled) { |
467 | mutex_lock(&sg_policy->work_lock); | 465 | mutex_lock(&sg_policy->work_lock); |
468 | 466 | cpufreq_policy_apply_limits(policy); | |
469 | if (policy->max < policy->cur) | ||
470 | __cpufreq_driver_target(policy, policy->max, | ||
471 | CPUFREQ_RELATION_H); | ||
472 | else if (policy->min > policy->cur) | ||
473 | __cpufreq_driver_target(policy, policy->min, | ||
474 | CPUFREQ_RELATION_L); | ||
475 | |||
476 | mutex_unlock(&sg_policy->work_lock); | 467 | mutex_unlock(&sg_policy->work_lock); |
477 | } | 468 | } |
478 | 469 | ||
479 | sg_policy->need_freq_update = true; | 470 | sg_policy->need_freq_update = true; |
480 | return 0; | ||
481 | } | ||
482 | |||
483 | int sugov_governor(struct cpufreq_policy *policy, unsigned int event) | ||
484 | { | ||
485 | if (event == CPUFREQ_GOV_POLICY_INIT) { | ||
486 | return sugov_init(policy); | ||
487 | } else if (policy->governor_data) { | ||
488 | switch (event) { | ||
489 | case CPUFREQ_GOV_POLICY_EXIT: | ||
490 | return sugov_exit(policy); | ||
491 | case CPUFREQ_GOV_START: | ||
492 | return sugov_start(policy); | ||
493 | case CPUFREQ_GOV_STOP: | ||
494 | return sugov_stop(policy); | ||
495 | case CPUFREQ_GOV_LIMITS: | ||
496 | return sugov_limits(policy); | ||
497 | } | ||
498 | } | ||
499 | return -EINVAL; | ||
500 | } | 471 | } |
501 | 472 | ||
502 | static struct cpufreq_governor schedutil_gov = { | 473 | static struct cpufreq_governor schedutil_gov = { |
503 | .name = "schedutil", | 474 | .name = "schedutil", |
504 | .governor = sugov_governor, | ||
505 | .owner = THIS_MODULE, | 475 | .owner = THIS_MODULE, |
476 | .init = sugov_init, | ||
477 | .exit = sugov_exit, | ||
478 | .start = sugov_start, | ||
479 | .stop = sugov_stop, | ||
480 | .limits = sugov_limits, | ||
506 | }; | 481 | }; |
507 | 482 | ||
508 | static int __init sugov_module_init(void) | 483 | static int __init sugov_module_init(void) |