Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xiphi1978
linux
提交
fc0dc4d3
L
linux
项目概览
xiphi1978
/
linux
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fc0dc4d3
编写于
8月 12, 2007
作者:
L
Len Brown
浏览文件
操作
浏览文件
下载
差异文件
Pull bugzilla-8768 into release branch
上级
53fdc518
3bd92ba1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
30 deletion
+17
-30
drivers/acpi/battery.c
drivers/acpi/battery.c
+17
-30
未找到文件。
drivers/acpi/battery.c
浏览文件 @
fc0dc4d3
...
...
@@ -113,7 +113,7 @@ struct acpi_battery_info {
acpi_string
oem_info
;
};
enum
acpi_battery_files
{
enum
acpi_battery_files
{
ACPI_BATTERY_INFO
=
0
,
ACPI_BATTERY_STATE
,
ACPI_BATTERY_ALARM
,
...
...
@@ -129,13 +129,14 @@ struct acpi_battery_flags {
};
struct
acpi_battery
{
struct
mutex
mutex
;
struct
acpi_device
*
device
;
struct
acpi_battery_flags
flags
;
struct
acpi_buffer
bif_data
;
struct
acpi_buffer
bst_data
;
struct
mutex
lock
;
unsigned
long
alarm
;
unsigned
long
update_time
[
ACPI_BATTERY_NUMFILES
];
};
inline
int
acpi_battery_present
(
struct
acpi_battery
*
battery
)
...
...
@@ -235,10 +236,10 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
return
0
;
/* Evaluate _BIF */
status
=
acpi_evaluate_object
(
acpi_battery_handle
(
battery
),
"_BIF"
,
NULL
,
&
buffer
);
mutex_lock
(
&
battery
->
lock
);
status
=
acpi_evaluate_object
(
acpi_battery_handle
(
battery
),
"_BIF"
,
NULL
,
&
buffer
);
mutex_unlock
(
&
battery
->
lock
);
if
(
ACPI_FAILURE
(
status
))
{
ACPI_EXCEPTION
((
AE_INFO
,
status
,
"Evaluating _BIF"
));
return
-
ENODEV
;
...
...
@@ -285,10 +286,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
return
0
;
/* Evaluate _BST */
status
=
acpi_evaluate_object
(
acpi_battery_handle
(
battery
),
"_BST"
,
NULL
,
&
buffer
);
mutex_lock
(
&
battery
->
lock
);
status
=
acpi_evaluate_object
(
acpi_battery_handle
(
battery
),
"_BST"
,
NULL
,
&
buffer
);
mutex_unlock
(
&
battery
->
lock
);
if
(
ACPI_FAILURE
(
status
))
{
ACPI_EXCEPTION
((
AE_INFO
,
status
,
"Evaluating _BST"
));
return
-
ENODEV
;
...
...
@@ -336,9 +337,10 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery,
arg0
.
integer
.
value
=
alarm
;
status
=
acpi_evaluate_object
(
acpi_battery_handle
(
battery
),
"_BTP"
,
mutex_lock
(
&
battery
->
lock
);
status
=
acpi_evaluate_object
(
acpi_battery_handle
(
battery
),
"_BTP"
,
&
arg_list
,
NULL
);
mutex_unlock
(
&
battery
->
lock
);
if
(
ACPI_FAILURE
(
status
))
return
-
ENODEV
;
...
...
@@ -658,8 +660,6 @@ acpi_battery_write_alarm(struct file *file,
if
(
!
battery
||
(
count
>
sizeof
(
alarm_string
)
-
1
))
return
-
EINVAL
;
mutex_lock
(
&
battery
->
mutex
);
result
=
acpi_battery_update
(
battery
,
1
,
&
update_result
);
if
(
result
)
{
result
=
-
ENODEV
;
...
...
@@ -688,9 +688,7 @@ acpi_battery_write_alarm(struct file *file,
acpi_battery_check_result
(
battery
,
result
);
if
(
!
result
)
result
=
count
;
mutex_unlock
(
&
battery
->
mutex
);
return
count
;
return
result
;
}
...
...
@@ -714,8 +712,6 @@ static int acpi_battery_read(int fid, struct seq_file *seq)
int
update_result
=
ACPI_BATTERY_NONE_UPDATE
;
int
update
=
0
;
mutex_lock
(
&
battery
->
mutex
);
update
=
(
get_seconds
()
-
battery
->
update_time
[
fid
]
>=
update_time
);
update
=
(
update
|
battery
->
flags
.
update
[
fid
]);
...
...
@@ -733,7 +729,6 @@ static int acpi_battery_read(int fid, struct seq_file *seq)
result
=
acpi_read_funcs
[
fid
].
print
(
seq
,
result
);
acpi_battery_check_result
(
battery
,
result
);
battery
->
flags
.
update
[
fid
]
=
result
;
mutex_unlock
(
&
battery
->
mutex
);
return
result
;
}
...
...
@@ -897,10 +892,7 @@ static int acpi_battery_add(struct acpi_device *device)
if
(
!
battery
)
return
-
ENOMEM
;
mutex_init
(
&
battery
->
mutex
);
mutex_lock
(
&
battery
->
mutex
);
mutex_init
(
&
battery
->
lock
);
battery
->
device
=
device
;
strcpy
(
acpi_device_name
(
device
),
ACPI_BATTERY_DEVICE_NAME
);
strcpy
(
acpi_device_class
(
device
),
ACPI_BATTERY_CLASS
);
...
...
@@ -936,7 +928,6 @@ static int acpi_battery_add(struct acpi_device *device)
kfree
(
battery
);
}
mutex_unlock
(
&
battery
->
mutex
);
return
result
;
}
...
...
@@ -951,8 +942,6 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
battery
=
acpi_driver_data
(
device
);
mutex_lock
(
&
battery
->
mutex
);
status
=
acpi_remove_notify_handler
(
device
->
handle
,
ACPI_ALL_NOTIFY
,
acpi_battery_notify
);
...
...
@@ -963,9 +952,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
kfree
(
battery
->
bst_data
.
pointer
);
mutex_unlock
(
&
battery
->
mutex
);
mutex_destroy
(
&
battery
->
mutex
);
mutex_destroy
(
&
battery
->
lock
);
kfree
(
battery
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录