Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
65b3864b
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看板
提交
65b3864b
编写于
3月 24, 2009
作者:
T
Takashi Iwai
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'topic/ctl-list-cleanup' into for-linus
上级
bafdb727
118dd6bf
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
30 deletion
+18
-30
include/sound/core.h
include/sound/core.h
+3
-3
sound/core/init.c
sound/core/init.c
+15
-27
未找到文件。
include/sound/core.h
浏览文件 @
65b3864b
...
...
@@ -97,9 +97,9 @@ struct snd_device {
struct
snd_monitor_file
{
struct
file
*
file
;
struct
snd_monitor_file
*
next
;
const
struct
file_operations
*
disconnected_f_op
;
struct
list_head
shutdown_list
;
struct
list_head
shutdown_list
;
/* still need to shutdown */
struct
list_head
list
;
/* link of monitor files */
};
/* main structure for soundcard */
...
...
@@ -134,7 +134,7 @@ struct snd_card {
struct
snd_info_entry
*
proc_id
;
/* the card id */
struct
proc_dir_entry
*
proc_root_link
;
/* number link to real id */
struct
snd_monitor_file
*
files
;
/* all files associated to this card */
struct
list_head
files_list
;
/* all files associated to this card */
struct
snd_shutdown_f_ops
*
s_f_ops
;
/* file operations in the shutdown
state */
spinlock_t
files_lock
;
/* lock the files for this card */
...
...
sound/core/init.c
浏览文件 @
65b3864b
...
...
@@ -208,6 +208,7 @@ int snd_card_create(int idx, const char *xid,
INIT_LIST_HEAD
(
&
card
->
controls
);
INIT_LIST_HEAD
(
&
card
->
ctl_files
);
spin_lock_init
(
&
card
->
files_lock
);
INIT_LIST_HEAD
(
&
card
->
files_list
);
init_waitqueue_head
(
&
card
->
shutdown_sleep
);
#ifdef CONFIG_PM
mutex_init
(
&
card
->
power_lock
);
...
...
@@ -274,6 +275,7 @@ static int snd_disconnect_release(struct inode *inode, struct file *file)
list_for_each_entry
(
_df
,
&
shutdown_files
,
shutdown_list
)
{
if
(
_df
->
file
==
file
)
{
df
=
_df
;
list_del_init
(
&
df
->
shutdown_list
);
break
;
}
}
...
...
@@ -362,8 +364,7 @@ int snd_card_disconnect(struct snd_card *card)
/* phase 2: replace file->f_op with special dummy operations */
spin_lock
(
&
card
->
files_lock
);
mfile
=
card
->
files
;
while
(
mfile
)
{
list_for_each_entry
(
mfile
,
&
card
->
files_list
,
list
)
{
file
=
mfile
->
file
;
/* it's critical part, use endless loop */
...
...
@@ -376,8 +377,6 @@ int snd_card_disconnect(struct snd_card *card)
mfile
->
file
->
f_op
=
&
snd_shutdown_f_ops
;
fops_get
(
mfile
->
file
->
f_op
);
mfile
=
mfile
->
next
;
}
spin_unlock
(
&
card
->
files_lock
);
...
...
@@ -457,7 +456,7 @@ int snd_card_free_when_closed(struct snd_card *card)
return
ret
;
spin_lock
(
&
card
->
files_lock
);
if
(
card
->
files
==
NULL
)
if
(
list_empty
(
&
card
->
files_list
)
)
free_now
=
1
;
else
card
->
free_on_last_close
=
1
;
...
...
@@ -477,7 +476,7 @@ int snd_card_free(struct snd_card *card)
return
ret
;
/* wait, until all devices are ready for the free operation */
wait_event
(
card
->
shutdown_sleep
,
card
->
files
==
NULL
);
wait_event
(
card
->
shutdown_sleep
,
list_empty
(
&
card
->
files_list
)
);
snd_card_do_free
(
card
);
return
0
;
}
...
...
@@ -824,15 +823,13 @@ int snd_card_file_add(struct snd_card *card, struct file *file)
return
-
ENOMEM
;
mfile
->
file
=
file
;
mfile
->
disconnected_f_op
=
NULL
;
mfile
->
next
=
NULL
;
spin_lock
(
&
card
->
files_lock
);
if
(
card
->
shutdown
)
{
spin_unlock
(
&
card
->
files_lock
);
kfree
(
mfile
);
return
-
ENODEV
;
}
mfile
->
next
=
card
->
files
;
card
->
files
=
mfile
;
list_add
(
&
mfile
->
list
,
&
card
->
files_list
);
spin_unlock
(
&
card
->
files_lock
);
return
0
;
}
...
...
@@ -854,29 +851,20 @@ EXPORT_SYMBOL(snd_card_file_add);
*/
int
snd_card_file_remove
(
struct
snd_card
*
card
,
struct
file
*
file
)
{
struct
snd_monitor_file
*
mfile
,
*
pfile
=
NULL
;
struct
snd_monitor_file
*
mfile
,
*
found
=
NULL
;
int
last_close
=
0
;
spin_lock
(
&
card
->
files_lock
);
mfile
=
card
->
files
;
while
(
mfile
)
{
list_for_each_entry
(
mfile
,
&
card
->
files_list
,
list
)
{
if
(
mfile
->
file
==
file
)
{
if
(
pfile
)
pfile
->
next
=
mfile
->
next
;
else
card
->
files
=
mfile
->
next
;
list_del
(
&
mfile
->
list
);
if
(
mfile
->
disconnected_f_op
)
fops_put
(
mfile
->
disconnected_f_op
);
found
=
mfile
;
break
;
}
pfile
=
mfile
;
mfile
=
mfile
->
next
;
}
if
(
mfile
&&
mfile
->
disconnected_f_op
)
{
fops_put
(
mfile
->
disconnected_f_op
);
spin_lock
(
&
shutdown_lock
);
list_del
(
&
mfile
->
shutdown_list
);
spin_unlock
(
&
shutdown_lock
);
}
if
(
card
->
files
==
NULL
)
if
(
list_empty
(
&
card
->
files_list
)
)
last_close
=
1
;
spin_unlock
(
&
card
->
files_lock
);
if
(
last_close
)
{
...
...
@@ -884,11 +872,11 @@ int snd_card_file_remove(struct snd_card *card, struct file *file)
if
(
card
->
free_on_last_close
)
snd_card_do_free
(
card
);
}
if
(
!
mfile
)
{
if
(
!
found
)
{
snd_printk
(
KERN_ERR
"ALSA card file remove problem (%p)
\n
"
,
file
);
return
-
ENOENT
;
}
kfree
(
mfile
);
kfree
(
found
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录