fix bad comparison of possible frequency scaling governor values

git-svn-id: svn://localhost/ardour2/branches/3.0@8776 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-02-08 19:52:50 +00:00
parent cc074c66fa
commit ce9035388b

View File

@ -108,27 +108,27 @@ int system_uses_frequencyscaling() {
char filename[256], buf[256]; char filename[256], buf[256];
while (!done) { while (!done) {
(void) snprintf(filename, 256, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor", cpu); (void) snprintf(filename, 256, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor", cpu);
if (0<read_string(filename, buf, 256)) { if (0<read_string(filename, buf, 256)) {
if ((0!=strcmp("performance", buf)) && if ((0!=strncmp("performance", buf, 11)) &&
(0!=strcmp("powersafe", buf))) { (0!=strncmp("powersafe", buf, 9))) {
// So it's neither the "performance" nor the "powersafe" governor // So it's neither the "performance" nor the "powersafe" governor
(void) snprintf(filename, 256, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_min_freq", cpu); (void) snprintf(filename, 256, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_min_freq", cpu);
if (read_int(filename, &min)) { if (read_int(filename, &min)) {
(void) snprintf(filename, 256, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_max_freq", cpu); (void) snprintf(filename, 256, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_max_freq", cpu);
if (read_int(filename, &max)) { if (read_int(filename, &max)) {
if (min!=max) { if (min!=max) {
// wrong governor AND different frequency limits -> scaling // wrong governor AND different frequency limits -> scaling
return 1; return 1;
} }
} }
} }
} }
} else { } else {
// couldn't open file -> no more cores // couldn't open file -> no more cores
done = 1; done = 1;
} }
cpu++; cpu++;
} }
// couldn't find anything that points to scaling // couldn't find anything that points to scaling