cpufreq: interactive: Round up timer_rate to match jiffy
[firefly-linux-kernel-4.4.55.git] / drivers / cpufreq / cpufreq_interactive.c
index 24fe0ce88e7745575ac8a29797e4fb416ad9c2e0..6bbcc905bb3e71561cd6d22ea4fd61a7558e5871 100644 (file)
@@ -609,14 +609,6 @@ static void cpufreq_interactive_boost(struct cpufreq_interactive_tunables *tunab
                                ktime_to_us(ktime_get());
                        anyboost = 1;
                }
-
-               /*
-                * Set floor freq and (re)start timer for when last
-                * validated.
-                */
-
-               pcpu->floor_freq = tunables->hispeed_freq;
-               pcpu->floor_validate_time = ktime_to_us(ktime_get());
                spin_unlock_irqrestore(&pcpu->target_freq_lock, flags[1]);
        }
 
@@ -863,12 +855,18 @@ static ssize_t store_timer_rate(struct cpufreq_interactive_tunables *tunables,
                const char *buf, size_t count)
 {
        int ret;
-       unsigned long val;
+       unsigned long val, val_round;
 
        ret = strict_strtoul(buf, 0, &val);
        if (ret < 0)
                return ret;
-       tunables->timer_rate = val;
+
+       val_round = jiffies_to_usecs(usecs_to_jiffies(val));
+       if (val != val_round)
+               pr_warn("timer_rate not aligned to jiffy. Rounded up to %lu\n",
+                       val_round);
+
+       tunables->timer_rate = val_round;
        return count;
 }
 
@@ -1185,8 +1183,10 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
                if (rc) {
                        kfree(tunables);
                        policy->governor_data = NULL;
-                       if (!have_governor_per_policy())
+                       if (!have_governor_per_policy()) {
                                common_tunables = NULL;
+                               cpufreq_put_global_kobject();
+                       }
                        return rc;
                }