Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
4f0447b8
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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看板
提交
4f0447b8
编写于
5月 21, 2010
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
get rid of home-grown mutex in cris eeprom.c
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
48c1e44a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
19 deletion
+8
-19
arch/cris/arch-v10/drivers/eeprom.c
arch/cris/arch-v10/drivers/eeprom.c
+8
-19
未找到文件。
arch/cris/arch-v10/drivers/eeprom.c
浏览文件 @
4f0447b8
...
...
@@ -73,8 +73,7 @@ struct eeprom_type
int
adapt_state
;
/* 1 = To high , 0 = Even, -1 = To low */
/* this one is to keep the read/write operations atomic */
wait_queue_head_t
wait_q
;
volatile
int
busy
;
struct
mutex
lock
;
int
retry_cnt_addr
;
/* Used to keep track of number of retries for
adaptive timing adjustments */
int
retry_cnt_read
;
...
...
@@ -115,8 +114,7 @@ const struct file_operations eeprom_fops =
int
__init
eeprom_init
(
void
)
{
init_waitqueue_head
(
&
eeprom
.
wait_q
);
eeprom
.
busy
=
0
;
mutex_init
(
&
eeprom
.
lock
);
#ifdef CONFIG_ETRAX_I2C_EEPROM_PROBE
#define EETEXT "Found"
...
...
@@ -461,12 +459,9 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t
return
-
EFAULT
;
}
wait_event_interruptible
(
eeprom
.
wait_q
,
!
eeprom
.
busy
);
if
(
signal_pending
(
current
))
if
(
mutex_lock_interruptible
(
&
eeprom
.
lock
))
return
-
EINTR
;
eeprom
.
busy
++
;
page
=
(
unsigned
char
)
(
p
>>
8
);
if
(
!
eeprom_address
(
p
))
...
...
@@ -476,8 +471,7 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t
i2c_stop
();
/* don't forget to wake them up */
eeprom
.
busy
--
;
wake_up_interruptible
(
&
eeprom
.
wait_q
);
mutex_unlock
(
&
eeprom
.
lock
);
return
-
EFAULT
;
}
...
...
@@ -504,8 +498,7 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t
file
->
f_pos
+=
read
;
}
eeprom
.
busy
--
;
wake_up_interruptible
(
&
eeprom
.
wait_q
);
mutex_unlock
(
&
eeprom
.
lock
);
return
read
;
}
...
...
@@ -534,11 +527,9 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count,
return
-
EFAULT
;
}
wait_event_interruptible
(
eeprom
.
wait_q
,
!
eeprom
.
busy
);
/* bail out if we get interrupted */
if
(
signal_pending
(
current
))
if
(
mutex_lock_interruptible
(
&
eeprom
.
lock
))
return
-
EINTR
;
eeprom
.
busy
++
;
for
(
i
=
0
;
(
i
<
EEPROM_RETRIES
)
&&
(
restart
>
0
);
i
++
)
{
restart
=
0
;
...
...
@@ -556,8 +547,7 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count,
i2c_stop
();
/* don't forget to wake them up */
eeprom
.
busy
--
;
wake_up_interruptible
(
&
eeprom
.
wait_q
);
mutex_unlock
(
&
eeprom
.
lock
);
return
-
EFAULT
;
}
#ifdef EEPROM_ADAPTIVE_TIMING
...
...
@@ -669,8 +659,7 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count,
}
/* while */
}
/* for */
eeprom
.
busy
--
;
wake_up_interruptible
(
&
eeprom
.
wait_q
);
mutex_unlock
(
&
eeprom
.
lock
);
if
(
written
==
0
&&
file
->
f_pos
>=
eeprom
.
size
){
return
-
ENOSPC
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录