tags 428248 patch
thanks

Hi,

While I think this could almost have gone to another ticket, I don't think the 
issue reported here would be so bad if the initscript controlled output and 
errors a bit better.

p4_clockmod has been disabled from detection for a reason fine, so the script 
tries the alternative and also the fallback and fails. Instead of spraying 
the word FATAL all over the console, manage the failure with the lsb 
functions.

Also, this package should handle the case when no valid cpufreq module can 
control the hardware. That is not a failing case. The user may have disabled 
cpufreq in the bios temporarily of received the software bundled together on 
a live-cd (which caters for varying hardware requirements). In this case the 
lsb ending function should add the string "none" in the round brackets like 
the alsa initscript does.

This patch also reports usage of the fallback module when it succeeded but the 
primary detection did not.

Thanks, Kel.
diff -Nrup cpufrequtils-002/debian/cpufrequtils.loadcpufreq.init cpufrequtils-002.no-fatal/debian/cpufrequtils.loadcpufreq.init
--- cpufrequtils-002/debian/cpufrequtils.loadcpufreq.init	2007-11-24 20:17:30.000000000 +1000
+++ cpufrequtils-002.no-fatal/debian/cpufrequtils.loadcpufreq.init	2007-11-24 20:59:47.000000000 +1000
@@ -177,10 +177,12 @@ load_modules() {
         else
 	        load_detected_cpufreq_modules
 		if [ ! -z "$MODULE" ] || [ ! -z "$MODULE_FALLBACK" ] ; then
-		    if [ ! -z "$MODULE" ] && modprobe "$MODULE" ; then
+		    if [ ! -z "$MODULE" ] && modprobe "$MODULE" 2>/dev/null ; then
 			:
+		    elif modprobe "$MODULE_FALLBACK" 2>/dev/null ; then
+		        MODULE="$MODULE_FALLBACK"
 		    else
-			modprobe "$MODULE_FALLBACK"
+		        unset MODULE
 		    fi
 		fi
         fi
@@ -204,9 +206,9 @@ load_modules() {
 check_kernel() {
 	CPUFREQ=/sys/devices/system/cpu/cpu0/cpufreq
 
-	if [ -f "$CPUFREQ/scaling_governor" ] && \
+	if [ -z "$MODULE" ] || ( [ -f "$CPUFREQ/scaling_governor" ] && \
 		[ -f "$CPUFREQ/scaling_available_governors" ] && \
-		grep -q userspace "$CPUFREQ/scaling_available_governors"
+		grep -q userspace "$CPUFREQ/scaling_available_governors" )
 	then
 		return 0
 	else
@@ -219,6 +221,7 @@ case "$1" in
        	log_action_begin_msg "Loading cpufreq kernel modules"
         [ -f /proc/modules ] && load_modules
 	if check_kernel ; then
+	    [ -z "$MODULE" ] && MODULE="none"
 	    log_action_end_msg 0 "$MODULE"
 	else
 	    log_action_end_msg 1

Reply via email to