summaryrefslogtreecommitdiff
path: root/pm/sleep.d
diff options
context:
space:
mode:
Diffstat (limited to 'pm/sleep.d')
-rwxr-xr-xpm/sleep.d/94cpufreq17
1 files changed, 11 insertions, 6 deletions
diff --git a/pm/sleep.d/94cpufreq b/pm/sleep.d/94cpufreq
index 1006180..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 )
}
@@ -28,7 +33,7 @@ thaw_cpufreq()
}
case "$1" in
- suspend|hibernate*)
+ suspend*|hibernate)
hibernate_cpufreq
;;
resume|thaw)