summaryrefslogtreecommitdiff
path: root/pm
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-03-06 10:19:48 -0600
committerVictor Lowther <victor.lowther@gmail.com>2008-03-06 10:19:48 -0600
commit04f05c28427de4c1e96cb3b343834c22f7dcad7d (patch)
treeb6031107ebb2ed888b2fdc1292944c3b2a25ff64 /pm
parent9f3e2ea40123ca048d99f2a0d3911af642c87cfa (diff)
Fixed the case where two or more cores share the same cpufreq settings.
If the cpufreq directory is a symlink, that that cpu shares it settings with another cpu. In that case, skip this cpu.
Diffstat (limited to 'pm')
-rwxr-xr-xpm/sleep.d/94cpufreq15
1 files changed, 10 insertions, 5 deletions
diff --git a/pm/sleep.d/94cpufreq b/pm/sleep.d/94cpufreq
index 9157fb4..cfb0c60 100755
--- a/pm/sleep.d/94cpufreq
+++ b/pm/sleep.d/94cpufreq
@@ -7,12 +7,17 @@
hibernate_cpufreq()
{
( cd /sys/devices/system/cpu/
- for x in cpu[0-9]*/cpufreq/scaling_governor ; do
- [ -f "$x" ] || continue
+ for x in cpu[0-9]*; do
+ # if cpufreq is a symlink, it is handled by another cpu. Skip.
+ [ -L "$x/cpufreq" ] && continue
+ gov="$x/cpufreq/scaling_governor"
+ # if we do not have a scaling_governor file, skip.
+ [ -f "$gov" ] || continue
+ # if our temporary governor is not available, skip.
grep -q "$TEMPORARY_CPUFREQ_GOVERNOR" \
- "${x%/*}/scaling_available_governors" || continue
- savestate "${x%%/*}_governor" $(cat "$x")
- echo "$TEMPORARY_CPUFREQ_GOVERNOR" > "$x"
+ "$x/cpufreq/scaling_available_governors" || continue
+ savestate "${x}_governor" $(cat "$gov")
+ echo "$TEMPORARY_CPUFREQ_GOVERNOR" > "$gov"
done )
}