Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
9efd85df
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
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看板
提交
9efd85df
编写于
10月 11, 2010
作者:
M
Mauro Carvalho Chehab
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[media] tm6000: fix resource locking
Signed-off-by:
N
Mauro Carvalho Chehab
<
mchehab@redhat.com
>
上级
4ae18398
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
15 deletion
+45
-15
drivers/staging/tm6000/tm6000-video.c
drivers/staging/tm6000/tm6000-video.c
+42
-14
drivers/staging/tm6000/tm6000.h
drivers/staging/tm6000/tm6000.h
+3
-1
未找到文件。
drivers/staging/tm6000/tm6000-video.c
浏览文件 @
9efd85df
...
...
@@ -788,25 +788,49 @@ static struct videobuf_queue_ops tm6000_video_qops = {
IOCTL handling
------------------------------------------------------------------*/
static
int
res_get
(
struct
tm6000_core
*
dev
,
struct
tm6000_fh
*
fh
)
static
bool
is_res_read
(
struct
tm6000_core
*
dev
,
struct
tm6000_fh
*
fh
)
{
/* is it free? */
if
(
dev
->
resources
)
return
0
;
/* it's free, grab it */
dev
->
resources
=
1
;
dprintk
(
dev
,
V4L2_DEBUG_RES_LOCK
,
"res: get
\n
"
);
return
1
;
/* Is the current fh handling it? if so, that's OK */
if
(
dev
->
resources
==
fh
&&
dev
->
is_res_read
)
return
true
;
return
false
;
}
static
bool
is_res_streaming
(
struct
tm6000_core
*
dev
,
struct
tm6000_fh
*
fh
)
{
/* Is the current fh handling it? if so, that's OK */
if
(
dev
->
resources
==
fh
)
return
true
;
return
false
;
}
static
int
res_locked
(
struct
tm6000_core
*
dev
)
static
bool
res_get
(
struct
tm6000_core
*
dev
,
struct
tm6000_fh
*
fh
,
bool
is_res_read
)
{
return
(
dev
->
resources
);
/* Is the current fh handling it? if so, that's OK */
if
(
dev
->
resources
==
fh
&&
dev
->
is_res_read
==
is_res_read
)
return
true
;
/* is it free? */
if
(
dev
->
resources
)
return
false
;
/* grab it */
dev
->
resources
=
fh
;
dev
->
is_res_read
=
is_res_read
;
dprintk
(
dev
,
V4L2_DEBUG_RES_LOCK
,
"res: get
\n
"
);
return
true
;
}
static
void
res_free
(
struct
tm6000_core
*
dev
,
struct
tm6000_fh
*
fh
)
{
dev
->
resources
=
0
;
/* Is the current fh handling it? if so, that's OK */
if
(
dev
->
resources
!=
fh
)
return
;
dev
->
resources
=
NULL
;
dprintk
(
dev
,
V4L2_DEBUG_RES_LOCK
,
"res: put
\n
"
);
}
...
...
@@ -981,7 +1005,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
if
(
i
!=
fh
->
type
)
return
-
EINVAL
;
if
(
!
res_get
(
dev
,
fh
))
if
(
!
res_get
(
dev
,
fh
,
false
))
return
-
EBUSY
;
return
(
videobuf_streamon
(
&
fh
->
vb_vidq
));
}
...
...
@@ -1310,7 +1334,7 @@ tm6000_read(struct file *file, char __user *data, size_t count, loff_t *pos)
struct
tm6000_fh
*
fh
=
file
->
private_data
;
if
(
fh
->
type
==
V4L2_BUF_TYPE_VIDEO_CAPTURE
)
{
if
(
res_locked
(
fh
->
dev
))
if
(
!
res_get
(
fh
->
dev
,
fh
,
true
))
return
-
EBUSY
;
return
videobuf_read_stream
(
&
fh
->
vb_vidq
,
data
,
count
,
pos
,
0
,
...
...
@@ -1328,7 +1352,10 @@ tm6000_poll(struct file *file, struct poll_table_struct *wait)
if
(
V4L2_BUF_TYPE_VIDEO_CAPTURE
!=
fh
->
type
)
return
POLLERR
;
if
(
res_get
(
fh
->
dev
,
fh
))
{
if
(
!!
is_res_streaming
(
fh
->
dev
,
fh
))
return
POLLERR
;
if
(
!
is_res_read
(
fh
->
dev
,
fh
))
{
/* streaming capture */
if
(
list_empty
(
&
fh
->
vb_vidq
.
stream
))
return
POLLERR
;
...
...
@@ -1356,6 +1383,7 @@ static int tm6000_release(struct file *file)
dev
->
users
--
;
res_free
(
dev
,
fh
);
if
(
!
dev
->
users
)
{
tm6000_uninit_isoc
(
dev
);
videobuf_mmap_free
(
&
fh
->
vb_vidq
);
...
...
drivers/staging/tm6000/tm6000.h
浏览文件 @
9efd85df
...
...
@@ -189,7 +189,9 @@ struct tm6000_core {
int
users
;
/* various device info */
unsigned
int
resources
;
struct
tm6000_fh
*
resources
;
/* Points to fh that is streaming */
bool
is_res_read
;
struct
video_device
*
vfd
;
struct
tm6000_dmaqueue
vidq
;
struct
v4l2_device
v4l2_dev
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录