Don't load cpufreq_ondemand if it's built-in
authorChristian Hofstaedtler <ch@grml.org>
Sun, 11 Dec 2011 03:18:37 +0000 (04:18 +0100)
committerChristian Hofstaedtler <ch@grml.org>
Sun, 11 Dec 2011 03:18:37 +0000 (04:18 +0100)
autoconfig.functions

index a0e6f17..1a3488b 100755 (executable)
@@ -960,14 +960,18 @@ if [ -x /etc/init.d/loadcpufreq ] ; then
    rm -f $LOADCPUFREQ
 
    if [ -z "$SKIP_CPU_GOVERNOR" ] ; then
-      einfo "Loading cpufreq_ondemand, setting ondemand governor"
-      RC=0
-      if modprobe cpufreq_ondemand ; RC=$? ; then
-         for file in $(find /sys/devices/system/cpu/ -name scaling_governor 2>/dev/null) ; do
-            echo ondemand > $file
-         done
-      fi
-      eend $RC
+     if grep -vq ondemand /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors; then
+       einfo "Loading cpufreq_ondemand"
+       modprobe cpufreq_ondemand
+       eend $?
+     fi
+
+     einfo "Setting ondemand governor"
+     RC=0
+     for file in $(find /sys/devices/system/cpu/ -name scaling_governor 2>/dev/null) ; do
+       echo ondemand > $file || RC=1
+     done
+     eend $RC
    fi # cpu-governor
 
    eoutdent