]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
dvfs: tegra: Re-factor clipping frequency function
authorAlex Frid <afrid@nvidia.com>
Sat, 20 Jun 2015 00:11:23 +0000 (17:11 -0700)
committerAleksandr Frid <afrid@nvidia.com>
Tue, 23 Jun 2015 01:25:02 +0000 (18:25 -0700)
Re-factored clipping frequency function for readability.

Bug 200085579

Change-Id: If4b0c1308d96de3a519350bc11a2cddd86b5cda5
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/760332
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
drivers/platform/tegra/dvfs.c

index 6f12c6e21109e9a24161a61293218063f427ba54..6ec8ddf2143e1e0f52a81be0639b64c80576b727 100644 (file)
@@ -1415,31 +1415,26 @@ void tegra_clip_freqs(u32 *freqs, int *num_freqs, int freqs_mult,
                        break;
                }
 
+               if (freq > freq_step) {
+                       k++;
+                       continue;
+               }
+
                if (up) {
-                       if (freq <= freq_step) {
-                               if (!j || (freqs[j - 1] < freq_step))
-                                       freqs[j++] = freq_step;
-                               i++;
-                       } else {
-                               k++;
-                       }
+                       if (!j || (freqs[j - 1] < freq_step))
+                               freqs[j++] = freq_step;
                } else {
-                       if (freq <= freq_step) {
-                               if (!k || (freq == freq_step)) {
-                                       if (!j || (freqs[j - 1] < freq))
-                                               freqs[j++] = freq;
-                               } else {
-                                       freq_step =
-                                               rates_ladder[k-1] / freqs_mult;
-
-                                       if (!j || (freqs[j - 1] < freq_step))
-                                               freqs[j++] = freq_step;
-                               }
-                               i++;
+                       if (!k || (freq == freq_step)) {
+                               if (!j || (freqs[j - 1] < freq))
+                                       freqs[j++] = freq;
                        } else {
-                               k++;
+                               freq_step = rates_ladder[k-1] / freqs_mult;
+
+                               if (!j || (freqs[j - 1] < freq_step))
+                                       freqs[j++] = freq_step;
                        }
                }
+               i++;
        }
        *num_freqs = j;
 }