Lines 3-30
Link Here
|
3 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# Distributed under the terms of the GNU General Public License v2 |
4 |
# $Header: /var/cvsroot/gentoo-x86/sys-power/cpupower/files/init.d-r1,v 1.1 2013/04/24 09:44:06 ssuominen Exp $ |
4 |
# $Header: /var/cvsroot/gentoo-x86/sys-power/cpupower/files/init.d-r1,v 1.1 2013/04/24 09:44:06 ssuominen Exp $ |
5 |
|
5 |
|
|
|
6 |
CPUFREQ_SYSFS=/sys/devices/system/cpu/cpufreq |
7 |
|
6 |
change() { |
8 |
change() { |
7 |
local c ret=0 opts="$1" |
9 |
local c ret=0 opts="$1" |
8 |
shift |
10 |
shift |
9 |
ebegin "Running cpupower -c all frequency-set ${opts}" |
11 |
ebegin "Running cpupower -c all frequency-set ${opts}" |
10 |
cpupower -c all frequency-set ${opts} >/dev/null 2>&1 |
12 |
if [ "${opts}" != "" ] ; then |
11 |
: $(( ret += $? )) |
13 |
cpupower -c all frequency-set ${opts} >/dev/null 2>&1 |
|
|
14 |
: $(( ret += $? )) |
15 |
fi |
12 |
eend ${ret} |
16 |
eend ${ret} |
13 |
|
17 |
|
14 |
if [ $# -gt 0 ] ; then |
18 |
if [ -d ${CPUFREQ_SYSFS} ] ; then |
15 |
c=1 |
19 |
if [ $# -gt 0 ] ; then |
16 |
einfo "Setting extra options: $*" |
20 |
c=1 |
17 |
if cd /sys/devices/system/cpu/cpufreq ; then |
21 |
einfo "Setting extra options: $*" |
18 |
local o v |
22 |
if cd ${CPUFREQ_SYSFS} ; then |
19 |
for o in "$@" ; do |
23 |
local o v |
20 |
v=${o#*=} |
24 |
for o in "$@" ; do |
21 |
o=${o%%=*} |
25 |
v=${o#*=} |
22 |
echo ${v} > ${o} || break |
26 |
o=${o%%=*} |
23 |
done |
27 |
echo ${v} > ${o} || break |
24 |
c=0 |
28 |
done |
|
|
29 |
c=0 |
30 |
fi |
31 |
eend ${c} |
32 |
: $(( ret += c )) |
25 |
fi |
33 |
fi |
26 |
eend ${c} |
|
|
27 |
: $(( ret += c )) |
28 |
fi |
34 |
fi |
29 |
|
35 |
|
30 |
return ${ret} |
36 |
return ${ret} |