blob: 5613345d48e9509312588fd360ae73d918f5932b [file] [log] [blame]
--- cpufreqd-2.2.1.orig/src/cpufreqd_cpu.c 2007-08-03 13:55:54.000000000 +0200
+++ cpufreqd-2.2.1/src/cpufreqd_cpu.c 2007-08-03 14:17:36.000000000 +0200
@@ -222,7 +222,7 @@
/* special handling for CPU_ALL and CPU_ANY */
if (c->cpu == CPU_ANY || c->cpu == CPU_ALL) {
for (i = 0; i < cinfo->cpus; i++) {
- clog(LOG_DEBUG, "CPU%d user=%d nice=%d sys=%d\n", c->cpu,
+ clog(LOG_DEBUG, "CPU%d user=%d nice=%d sys=%d\n", i,
cusage[i].c_user, cusage[i].c_nice, cusage[i].c_sys);
cpu_percent = calculate_cpu_usage(&cusage[i], &cusage_old[i], c->nice_scale);
clog(LOG_DEBUG, "CPU%d %d%% - min=%d max=%d scale=%.2f (%s)\n", i, cpu_percent,
@@ -234,14 +234,16 @@
if (c->cpu == CPU_ALL && !(cpu_percent >= c->min && cpu_percent <= c->max))
break;
}
- /* if this code is reached then either CPU_ANY and none matches
- * or CPU_ALL and all match
+ /* if this code is reached then
+ * either CPU_ANY and none matches
+ * or CPU_ALL and all match, where i == cinfo->cpus
+ * or CPU_ALL and break was called
*/
- if (c->cpu == CPU_ANY) {
- c = c->next;
- continue;
- }
- return MATCH; /*if (c->cpu == ALL)*/
+ if (c->cpu == CPU_ALL && i == cinfo->cpus)
+ return MATCH;
+
+ c = c->next;
+ continue;
}
/* cacluate weighted activity for the requested CPU */