Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
c1935b4d
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c1935b4d
编写于
4月 04, 2005
作者:
J
Jaroslav Kysela
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ALSA] timer - added tread semaphore
Timer Midlevel Signed-off-by:
N
Jaroslav Kysela
<
perex@suse.cz
>
上级
54ab87e6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
20 deletion
+37
-20
sound/core/timer.c
sound/core/timer.c
+37
-20
未找到文件。
sound/core/timer.c
浏览文件 @
c1935b4d
...
...
@@ -69,6 +69,7 @@ typedef struct {
struct
timespec
tstamp
;
/* trigger tstamp */
wait_queue_head_t
qchange_sleep
;
struct
fasync_struct
*
fasync
;
struct
semaphore
tread_sem
;
}
snd_timer_user_t
;
/* list of timers */
...
...
@@ -1208,6 +1209,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)
return
-
ENOMEM
;
spin_lock_init
(
&
tu
->
qlock
);
init_waitqueue_head
(
&
tu
->
qchange_sleep
);
init_MUTEX
(
&
tu
->
tread_sem
);
tu
->
ticks
=
1
;
tu
->
queue_size
=
128
;
tu
->
queue
=
(
snd_timer_read_t
*
)
kmalloc
(
tu
->
queue_size
*
sizeof
(
snd_timer_read_t
),
GFP_KERNEL
);
...
...
@@ -1454,18 +1456,23 @@ static int snd_timer_user_tselect(struct file *file, snd_timer_select_t __user *
snd_timer_user_t
*
tu
;
snd_timer_select_t
tselect
;
char
str
[
32
];
int
err
;
int
err
=
0
;
tu
=
file
->
private_data
;
if
(
tu
->
timeri
)
down
(
&
tu
->
tread_sem
);
if
(
tu
->
timeri
)
{
snd_timer_close
(
tu
->
timeri
);
if
(
copy_from_user
(
&
tselect
,
_tselect
,
sizeof
(
tselect
)))
return
-
EFAULT
;
tu
->
timeri
=
NULL
;
}
if
(
copy_from_user
(
&
tselect
,
_tselect
,
sizeof
(
tselect
)))
{
err
=
-
EFAULT
;
goto
__err
;
}
sprintf
(
str
,
"application %i"
,
current
->
pid
);
if
(
tselect
.
id
.
dev_class
!=
SNDRV_TIMER_CLASS_SLAVE
)
tselect
.
id
.
dev_sclass
=
SNDRV_TIMER_SCLASS_APPLICATION
;
if
((
err
=
snd_timer_open
(
&
tu
->
timeri
,
str
,
&
tselect
.
id
,
current
->
pid
))
<
0
)
return
err
;
goto
__
err
;
if
(
tu
->
queue
)
{
kfree
(
tu
->
queue
);
...
...
@@ -1477,23 +1484,27 @@ static int snd_timer_user_tselect(struct file *file, snd_timer_select_t __user *
}
if
(
tu
->
tread
)
{
tu
->
tqueue
=
(
snd_timer_tread_t
*
)
kmalloc
(
tu
->
queue_size
*
sizeof
(
snd_timer_tread_t
),
GFP_KERNEL
);
if
(
tu
->
tqueue
==
NULL
)
{
snd_timer_close
(
tu
->
timeri
);
return
-
ENOMEM
;
}
if
(
tu
->
tqueue
==
NULL
)
err
=
-
ENOMEM
;
}
else
{
tu
->
queue
=
(
snd_timer_read_t
*
)
kmalloc
(
tu
->
queue_size
*
sizeof
(
snd_timer_read_t
),
GFP_KERNEL
);
if
(
tu
->
queue
==
NULL
)
{
snd_timer_close
(
tu
->
timeri
);
return
-
ENOMEM
;
}
if
(
tu
->
queue
==
NULL
)
err
=
-
ENOMEM
;
}
tu
->
timeri
->
flags
|=
SNDRV_TIMER_IFLG_FAST
;
tu
->
timeri
->
callback
=
tu
->
tread
?
snd_timer_user_tinterrupt
:
snd_timer_user_interrupt
;
tu
->
timeri
->
ccallback
=
snd_timer_user_ccallback
;
tu
->
timeri
->
callback_data
=
(
void
*
)
tu
;
return
0
;
if
(
err
<
0
)
{
snd_timer_close
(
tu
->
timeri
);
tu
->
timeri
=
NULL
;
}
else
{
tu
->
timeri
->
flags
|=
SNDRV_TIMER_IFLG_FAST
;
tu
->
timeri
->
callback
=
tu
->
tread
?
snd_timer_user_tinterrupt
:
snd_timer_user_interrupt
;
tu
->
timeri
->
ccallback
=
snd_timer_user_ccallback
;
tu
->
timeri
->
callback_data
=
(
void
*
)
tu
;
}
__err:
up
(
&
tu
->
tread_sem
);
return
err
;
}
static
int
snd_timer_user_info
(
struct
file
*
file
,
snd_timer_info_t
__user
*
_info
)
...
...
@@ -1685,11 +1696,17 @@ static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, unsigned l
{
int
xarg
;
if
(
tu
->
timeri
)
/* too late */
down
(
&
tu
->
tread_sem
);
if
(
tu
->
timeri
)
{
/* too late */
up
(
&
tu
->
tread_sem
);
return
-
EBUSY
;
if
(
get_user
(
xarg
,
p
))
}
if
(
get_user
(
xarg
,
p
))
{
up
(
&
tu
->
tread_sem
);
return
-
EFAULT
;
}
tu
->
tread
=
xarg
?
1
:
0
;
up
(
&
tu
->
tread_sem
);
return
0
;
}
case
SNDRV_TIMER_IOCTL_GINFO
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录