diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2017-06-23 05:25:31 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-07-17 11:32:05 -0400 |
commit | 93a57081d20c1f93c209fec0f247f5bed936cc34 (patch) | |
tree | cb8458fc180662ed36d3588f61590e1bdcae5847 | |
parent | 3eeba1a28e0df150adec37d67b567de653cf285c (diff) |
arch_topology: Convert switch block to if block
We only need to take care of one case here (CPUFREQ_NOTIFY) and there is
no need to add an extra level of indentation to the case specific code
by using a switch block. Use an if block instead.
Also add some blank lines to make the code look better.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Juri Lelli <juri.lelli@arm.com>
Tested-by: Juri Lelli <juri.lelli@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/base/arch_topology.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 0ad79b5cd56d..a3cd7c869c3e 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c | |||
@@ -174,26 +174,29 @@ init_cpu_capacity_callback(struct notifier_block *nb, | |||
174 | if (cap_parsing_failed || cap_parsing_done) | 174 | if (cap_parsing_failed || cap_parsing_done) |
175 | return 0; | 175 | return 0; |
176 | 176 | ||
177 | switch (val) { | 177 | if (val != CPUFREQ_NOTIFY) |
178 | case CPUFREQ_NOTIFY: | 178 | return 0; |
179 | pr_debug("cpu_capacity: init cpu capacity for CPUs [%*pbl] (to_visit=%*pbl)\n", | 179 | |
180 | cpumask_pr_args(policy->related_cpus), | 180 | pr_debug("cpu_capacity: init cpu capacity for CPUs [%*pbl] (to_visit=%*pbl)\n", |
181 | cpumask_pr_args(cpus_to_visit)); | 181 | cpumask_pr_args(policy->related_cpus), |
182 | cpumask_andnot(cpus_to_visit, cpus_to_visit, | 182 | cpumask_pr_args(cpus_to_visit)); |
183 | policy->related_cpus); | 183 | |
184 | for_each_cpu(cpu, policy->related_cpus) { | 184 | cpumask_andnot(cpus_to_visit, cpus_to_visit, policy->related_cpus); |
185 | raw_capacity[cpu] = topology_get_cpu_scale(NULL, cpu) * | 185 | |
186 | policy->cpuinfo.max_freq / 1000UL; | 186 | for_each_cpu(cpu, policy->related_cpus) { |
187 | capacity_scale = max(raw_capacity[cpu], capacity_scale); | 187 | raw_capacity[cpu] = topology_get_cpu_scale(NULL, cpu) * |
188 | } | 188 | policy->cpuinfo.max_freq / 1000UL; |
189 | if (cpumask_empty(cpus_to_visit)) { | 189 | capacity_scale = max(raw_capacity[cpu], capacity_scale); |
190 | topology_normalize_cpu_scale(); | ||
191 | kfree(raw_capacity); | ||
192 | pr_debug("cpu_capacity: parsing done\n"); | ||
193 | cap_parsing_done = true; | ||
194 | schedule_work(&parsing_done_work); | ||
195 | } | ||
196 | } | 190 | } |
191 | |||
192 | if (cpumask_empty(cpus_to_visit)) { | ||
193 | topology_normalize_cpu_scale(); | ||
194 | kfree(raw_capacity); | ||
195 | pr_debug("cpu_capacity: parsing done\n"); | ||
196 | cap_parsing_done = true; | ||
197 | schedule_work(&parsing_done_work); | ||
198 | } | ||
199 | |||
197 | return 0; | 200 | return 0; |
198 | } | 201 | } |
199 | 202 | ||