rpms/cpuspeed/devel cpuspeed.init, 1.14, 1.15 cpuspeed.spec, 1.41, 1.42

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Nov 20 21:25:08 UTC 2006


Author: davej

Update of /cvs/dist/rpms/cpuspeed/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv21256

Modified Files:
	cpuspeed.init cpuspeed.spec 
Log Message:
* Mon Nov 20 2006 Dave Jones <davej at redhat.com>
- Merge patch from Michal Jaegermann <michal at harddata.com>
  that solves the acpi-cpufreq problem in an improved
  way and fixes several other nits.




Index: cpuspeed.init
===================================================================
RCS file: /cvs/dist/rpms/cpuspeed/devel/cpuspeed.init,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- cpuspeed.init	28 Oct 2006 18:47:07 -0000	1.14
+++ cpuspeed.init	20 Nov 2006 21:25:00 -0000	1.15
@@ -12,42 +12,52 @@
 prog="cpuspeed"
 
 # Get config.
-if [ -f /etc/cpuspeed.conf ]; then
-        . /etc/cpuspeed.conf
+if [ -f /etc/cpuspeed/cpuspeed ]; then
+        . /etc/sysconfig/cpuspeed
 fi
 
+cpu0freqd=/sys/devices/system/cpu/cpu0/cpufreq
+testpat='/sys/devices/system/cpu/cpu*/cpufreq/scaling_driver'
+
+some_file_exist() {
+	while [ "$1" ] ; do
+		[ -f "$1" ] && return 0
+		shift
+	done
+	return 1
+}
+
 start() {
-	if [ ! -f /var/lock/subsys/cpuspeed ]; then
-		# Attempt to load scaling_driver if not loaded but it is configured
-		for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver; do
-			# We want to run the code below only if the
-			# wildcard above got no matches.
-			[ ! -f "$file" ] || break
+	if [ ! -f /var/lock/subsys/cpuspeed ] ; then
+		
+		if ! some_file_exist $testpat ; then
+			# Attempt to load scaling_driver if not loaded
+			# but it is configured
 
 			if [ -n "$DRIVER" ]; then
 				/sbin/modprobe "$DRIVER"
 			else
-				if [ -d /proc/acpi ]; then
-					EST=`grep flags /proc/cpuinfo | grep est`
-					if [ "$EST" ]; then
-						# use ACPI as a fallback
-						/sbin/modprobe acpi-cpufreq
-						# even ACPI didn't work, remove it, and bail out.
-						if [ -d /sys/devices/system/cpu/cpu0/cpufreq ]; then
-							/sbin/rmmod acpi-cpufreq
-						fi
-					fi
+				if [ -d /proc/acpi ] &&
+					grep flags /proc/cpuinfo | \
+						grep -q est ; then
+					# use ACPI as a fallback 
+					/sbin/modprobe acpi-cpufreq
+					# if even ACPI didn't work, remove it
+					# and then next test will bail out.
+					[ -d ${cpu0freqd} ] || \
+						/sbin/modprobe -r acpi-cpufreq
 				else
-					# This is a no-ACPI machine. Just exit.
+					# No scaling. Just exit.
 					return 0
 				fi
 			fi
-		done
+		fi
 
-		# If we get this far with no driver, we must have no ACPI. We're doomed.
-		[ ! -f /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver ] && return 0
+		# If we get this far with no driver, we must have no scaling.
+		# We're doomed.
+		[ ! -f ${cpu0freqd}/scaling_driver ] && return 0
 
-		drv=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver)
+		drv=`cat ${cpu0freqd}/scaling_driver`
 
 		case "$drv" in
 		centrino|powernow-k8)
@@ -72,10 +82,12 @@
 }
 
 stop() {
-	drv=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver)
+	[ ! -f ${cpu0freqd}/scaling_driver ] && return 0
+	drv=`cat ${cpu0freqd}/scaling_driver`
+	
 	case "$drv" in
 	centrino|powernow-k8)
-		/sbin/rmmod cpufreq-ondemand
+		/sbin/modprobe -r cpufreq-ondemand
 		RETVAL=0
 		;;
 	*)
@@ -89,9 +101,10 @@
 			killproc cpuspeed
 		fi
 		RETVAL=$?
-		[ $RETVAL = 0 ] && rm -f /var/lock/subsys/cpuspeed
 	esac
-
+	/sbin/modprobe -r $drv
+	[ $RETVAL = 0 ] && RETVAL=$?
+	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/cpuspeed
 	return $RETVAL
 }
 


Index: cpuspeed.spec
===================================================================
RCS file: /cvs/dist/rpms/cpuspeed/devel/cpuspeed.spec,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- cpuspeed.spec	28 Oct 2006 18:47:07 -0000	1.41
+++ cpuspeed.spec	20 Nov 2006 21:25:00 -0000	1.42
@@ -72,6 +72,11 @@
 exit 0
 
 %changelog
+* Mon Nov 20 2006 Dave Jones <davej at redhat.com>
+- Merge patch from Michal Jaegermann <michal at harddata.com>
+  that solves the acpi-cpufreq problem in an improved
+  way and fixes several other nits.
+
 * Sat Oct 28 2006 Dave Jones <davej at redhat.com>
 - Only load acpi-cpufreq on speedstep capable machines.
 - Unload acpi-cpufreq if BIOS tables didn't exist or




More information about the fedora-cvs-commits mailing list