mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 08:14:15 +08:00
cpufreq: Optimize cpufreq_show_cpus()
Instead of specially adding a space for each CPU, except the first one, lets add space for each of them and remove it at the end. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
b13baccc38
commit
336e51283a
@ -843,12 +843,14 @@ ssize_t cpufreq_show_cpus(const struct cpumask *mask, char *buf)
|
||||
unsigned int cpu;
|
||||
|
||||
for_each_cpu(cpu, mask) {
|
||||
if (i)
|
||||
i += scnprintf(&buf[i], (PAGE_SIZE - i - 2), " ");
|
||||
i += scnprintf(&buf[i], (PAGE_SIZE - i - 2), "%u", cpu);
|
||||
i += scnprintf(&buf[i], (PAGE_SIZE - i - 2), "%u ", cpu);
|
||||
if (i >= (PAGE_SIZE - 5))
|
||||
break;
|
||||
}
|
||||
|
||||
/* Remove the extra space at the end */
|
||||
i--;
|
||||
|
||||
i += sprintf(&buf[i], "\n");
|
||||
return i;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user