Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
ecfc555c
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
161
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ecfc555c
编写于
2月 27, 2014
作者:
R
Rafael J. Wysocki
浏览文件
操作
浏览文件
下载
差异文件
Merge back earlier 'pm-cpufreq' material.
上级
e66c1768
1c0ca902
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
44 addition
and
56 deletion
+44
-56
drivers/cpufreq/cpufreq.c
drivers/cpufreq/cpufreq.c
+44
-56
未找到文件。
drivers/cpufreq/cpufreq.c
浏览文件 @
ecfc555c
...
...
@@ -2017,22 +2017,21 @@ EXPORT_SYMBOL(cpufreq_get_policy);
static
int
cpufreq_set_policy
(
struct
cpufreq_policy
*
policy
,
struct
cpufreq_policy
*
new_policy
)
{
int
ret
=
0
,
failed
=
1
;
struct
cpufreq_governor
*
old_gov
;
int
ret
;
pr_debug
(
"setting new policy for CPU %u: %u - %u kHz
\n
"
,
new_policy
->
cpu
,
new_policy
->
min
,
new_policy
->
max
);
memcpy
(
&
new_policy
->
cpuinfo
,
&
policy
->
cpuinfo
,
sizeof
(
policy
->
cpuinfo
));
if
(
new_policy
->
min
>
policy
->
max
||
new_policy
->
max
<
policy
->
min
)
{
ret
=
-
EINVAL
;
goto
error_out
;
}
if
(
new_policy
->
min
>
policy
->
max
||
new_policy
->
max
<
policy
->
min
)
return
-
EINVAL
;
/* verify the cpu speed can be set within this limit */
ret
=
cpufreq_driver
->
verify
(
new_policy
);
if
(
ret
)
goto
error_ou
t
;
return
re
t
;
/* adjust if necessary - all reasons */
blocking_notifier_call_chain
(
&
cpufreq_policy_notifier_list
,
...
...
@@ -2048,7 +2047,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
*/
ret
=
cpufreq_driver
->
verify
(
new_policy
);
if
(
ret
)
goto
error_ou
t
;
return
re
t
;
/* notification of the new policy */
blocking_notifier_call_chain
(
&
cpufreq_policy_notifier_list
,
...
...
@@ -2063,58 +2062,48 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
if
(
cpufreq_driver
->
setpolicy
)
{
policy
->
policy
=
new_policy
->
policy
;
pr_debug
(
"setting range
\n
"
);
ret
=
cpufreq_driver
->
setpolicy
(
new_policy
);
}
else
{
if
(
new_policy
->
governor
!=
policy
->
governor
)
{
/* save old, working values */
struct
cpufreq_governor
*
old_gov
=
policy
->
governor
;
pr_debug
(
"governor switch
\n
"
);
/* end old governor */
if
(
policy
->
governor
)
{
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_STOP
);
up_write
(
&
policy
->
rwsem
);
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_POLICY_EXIT
);
down_write
(
&
policy
->
rwsem
);
}
return
cpufreq_driver
->
setpolicy
(
new_policy
);
}
/* start new governor */
policy
->
governor
=
new_policy
->
governor
;
if
(
!
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_POLICY_INIT
))
{
if
(
!
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_START
))
{
failed
=
0
;
}
else
{
up_write
(
&
policy
->
rwsem
);
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_POLICY_EXIT
);
down_write
(
&
policy
->
rwsem
);
}
}
if
(
new_policy
->
governor
==
policy
->
governor
)
goto
out
;
if
(
failed
)
{
/* new governor failed, so re-start old one */
pr_debug
(
"starting governor %s failed
\n
"
,
policy
->
governor
->
name
);
if
(
old_gov
)
{
policy
->
governor
=
old_gov
;
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_POLICY_INIT
);
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_START
);
}
ret
=
-
EINVAL
;
goto
error_out
;
}
/* might be a policy change, too, so fall through */
}
pr_debug
(
"governor: change or update limits
\n
"
);
ret
=
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_LIMITS
);
pr_debug
(
"governor switch
\n
"
);
/* save old, working values */
old_gov
=
policy
->
governor
;
/* end old governor */
if
(
old_gov
)
{
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_STOP
);
up_write
(
&
policy
->
rwsem
);
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_POLICY_EXIT
);
down_write
(
&
policy
->
rwsem
);
}
error_out:
return
ret
;
/* start new governor */
policy
->
governor
=
new_policy
->
governor
;
if
(
!
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_POLICY_INIT
))
{
if
(
!
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_START
))
goto
out
;
up_write
(
&
policy
->
rwsem
);
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_POLICY_EXIT
);
down_write
(
&
policy
->
rwsem
);
}
/* new governor failed, so re-start old one */
pr_debug
(
"starting governor %s failed
\n
"
,
policy
->
governor
->
name
);
if
(
old_gov
)
{
policy
->
governor
=
old_gov
;
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_POLICY_INIT
);
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_START
);
}
return
-
EINVAL
;
out:
pr_debug
(
"governor: change or update limits
\n
"
);
return
__cpufreq_governor
(
policy
,
CPUFREQ_GOV_LIMITS
);
}
/**
...
...
@@ -2186,7 +2175,6 @@ static int cpufreq_cpu_callback(struct notifier_block *nfb,
switch
(
action
&
~
CPU_TASKS_FROZEN
)
{
case
CPU_ONLINE
:
__cpufreq_add_dev
(
dev
,
NULL
,
frozen
);
cpufreq_update_policy
(
cpu
);
break
;
case
CPU_DOWN_PREPARE
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录