aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched/cpufreq_schedutil.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 8c4e1652e895..68f21bb6bd44 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -416,9 +416,13 @@ static int sugov_init(struct cpufreq_policy *policy)
416 if (policy->governor_data) 416 if (policy->governor_data)
417 return -EBUSY; 417 return -EBUSY;
418 418
419 cpufreq_enable_fast_switch(policy);
420
419 sg_policy = sugov_policy_alloc(policy); 421 sg_policy = sugov_policy_alloc(policy);
420 if (!sg_policy) 422 if (!sg_policy) {
421 return -ENOMEM; 423 ret = -ENOMEM;
424 goto disable_fast_switch;
425 }
422 426
423 mutex_lock(&global_tunables_lock); 427 mutex_lock(&global_tunables_lock);
424 428
@@ -456,8 +460,6 @@ static int sugov_init(struct cpufreq_policy *policy)
456 460
457out: 461out:
458 mutex_unlock(&global_tunables_lock); 462 mutex_unlock(&global_tunables_lock);
459
460 cpufreq_enable_fast_switch(policy);
461 return 0; 463 return 0;
462 464
463fail: 465fail:
@@ -468,6 +470,10 @@ free_sg_policy:
468 mutex_unlock(&global_tunables_lock); 470 mutex_unlock(&global_tunables_lock);
469 471
470 sugov_policy_free(sg_policy); 472 sugov_policy_free(sg_policy);
473
474disable_fast_switch:
475 cpufreq_disable_fast_switch(policy);
476
471 pr_err("initialization failed (error %d)\n", ret); 477 pr_err("initialization failed (error %d)\n", ret);
472 return ret; 478 return ret;
473} 479}
@@ -478,8 +484,6 @@ static void sugov_exit(struct cpufreq_policy *policy)
478 struct sugov_tunables *tunables = sg_policy->tunables; 484 struct sugov_tunables *tunables = sg_policy->tunables;
479 unsigned int count; 485 unsigned int count;
480 486
481 cpufreq_disable_fast_switch(policy);
482
483 mutex_lock(&global_tunables_lock); 487 mutex_lock(&global_tunables_lock);
484 488
485 count = gov_attr_set_put(&tunables->attr_set, &sg_policy->tunables_hook); 489 count = gov_attr_set_put(&tunables->attr_set, &sg_policy->tunables_hook);
@@ -490,6 +494,7 @@ static void sugov_exit(struct cpufreq_policy *policy)
490 mutex_unlock(&global_tunables_lock); 494 mutex_unlock(&global_tunables_lock);
491 495
492 sugov_policy_free(sg_policy); 496 sugov_policy_free(sg_policy);
497 cpufreq_disable_fast_switch(policy);
493} 498}
494 499
495static int sugov_start(struct cpufreq_policy *policy) 500static int sugov_start(struct cpufreq_policy *policy)