]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
cpufreq: Rearrange __cpufreq_driver_target()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 25 Feb 2016 23:03:01 +0000 (00:03 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 26 Feb 2016 21:11:55 +0000 (22:11 +0100)
Drop a pointless label at a return statement from
__cpufreq_driver_target() and rearrange that function
to reduce the indentation level.

No intentional functional changes.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/cpufreq.c

index 9be654375657a197ddd65bab852476f6fbed3190..bdf258ea09775e6511ada8ea7af8d93ae4368771 100644 (file)
@@ -1805,7 +1805,8 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
                            unsigned int relation)
 {
        unsigned int old_target_freq = target_freq;
-       int retval = -EINVAL;
+       struct cpufreq_frequency_table *freq_table;
+       int index, retval;
 
        if (cpufreq_disabled())
                return -ENODEV;
@@ -1832,34 +1833,28 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
        policy->restore_freq = policy->cur;
 
        if (cpufreq_driver->target)
-               retval = cpufreq_driver->target(policy, target_freq, relation);
-       else if (cpufreq_driver->target_index) {
-               struct cpufreq_frequency_table *freq_table;
-               int index;
+               return cpufreq_driver->target(policy, target_freq, relation);
 
-               freq_table = cpufreq_frequency_get_table(policy->cpu);
-               if (unlikely(!freq_table)) {
-                       pr_err("%s: Unable to find freq_table\n", __func__);
-                       goto out;
-               }
-
-               retval = cpufreq_frequency_table_target(policy, freq_table,
-                               target_freq, relation, &index);
-               if (unlikely(retval)) {
-                       pr_err("%s: Unable to find matching freq\n", __func__);
-                       goto out;
-               }
+       if (!cpufreq_driver->target_index)
+               return -EINVAL;
 
-               if (freq_table[index].frequency == policy->cur) {
-                       retval = 0;
-                       goto out;
-               }
+       freq_table = cpufreq_frequency_get_table(policy->cpu);
+       if (unlikely(!freq_table)) {
+               pr_err("%s: Unable to find freq_table\n", __func__);
+               return -EINVAL;
+       }
 
-               retval = __target_index(policy, freq_table, index);
+       retval = cpufreq_frequency_table_target(policy, freq_table, target_freq,
+                                               relation, &index);
+       if (unlikely(retval)) {
+               pr_err("%s: Unable to find matching freq\n", __func__);
+               return retval;
        }
 
-out:
-       return retval;
+       if (freq_table[index].frequency == policy->cur)
+               return 0;
+
+       return __target_index(policy, freq_table, index);
 }
 EXPORT_SYMBOL_GPL(__cpufreq_driver_target);