Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
3f225c07
Commit
3f225c07
authored
Nov 10, 2009
by
Takashi Iwai
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/ctl-pid-lock' into topic/core-change
parents
b7fe750f
25d27ede
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
include/sound/control.h
include/sound/control.h
+3
-2
sound/core/control.c
sound/core/control.c
+3
-4
sound/core/pcm.c
sound/core/pcm.c
+1
-1
sound/core/rawmidi.c
sound/core/rawmidi.c
+1
-1
No files found.
include/sound/control.h
View file @
3f225c07
...
...
@@ -56,7 +56,6 @@ struct snd_kcontrol_new {
struct
snd_kcontrol_volatile
{
struct
snd_ctl_file
*
owner
;
/* locked */
pid_t
owner_pid
;
unsigned
int
access
;
/* access rights */
};
...
...
@@ -87,10 +86,12 @@ struct snd_kctl_event {
#define snd_kctl_event(n) list_entry(n, struct snd_kctl_event, list)
struct
pid
;
struct
snd_ctl_file
{
struct
list_head
list
;
/* list of all control files */
struct
snd_card
*
card
;
pid_t
pid
;
struct
pid
*
pid
;
int
prefer_pcm_subdevice
;
int
prefer_rawmidi_subdevice
;
wait_queue_head_t
change_sleep
;
...
...
sound/core/control.c
View file @
3f225c07
...
...
@@ -75,7 +75,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
ctl
->
card
=
card
;
ctl
->
prefer_pcm_subdevice
=
-
1
;
ctl
->
prefer_rawmidi_subdevice
=
-
1
;
ctl
->
pid
=
current
->
pid
;
ctl
->
pid
=
get_pid
(
task_pid
(
current
))
;
file
->
private_data
=
ctl
;
write_lock_irqsave
(
&
card
->
ctl_files_rwlock
,
flags
);
list_add_tail
(
&
ctl
->
list
,
&
card
->
ctl_files
);
...
...
@@ -125,6 +125,7 @@ static int snd_ctl_release(struct inode *inode, struct file *file)
control
->
vd
[
idx
].
owner
=
NULL
;
up_write
(
&
card
->
controls_rwsem
);
snd_ctl_empty_read_queue
(
ctl
);
put_pid
(
ctl
->
pid
);
kfree
(
ctl
);
module_put
(
card
->
module
);
snd_card_file_remove
(
card
,
file
);
...
...
@@ -672,7 +673,7 @@ static int snd_ctl_elem_info(struct snd_ctl_file *ctl,
info
->
access
|=
SNDRV_CTL_ELEM_ACCESS_LOCK
;
if
(
vd
->
owner
==
ctl
)
info
->
access
|=
SNDRV_CTL_ELEM_ACCESS_OWNER
;
info
->
owner
=
vd
->
owner_pid
;
info
->
owner
=
pid_vnr
(
vd
->
owner
->
pid
)
;
}
else
{
info
->
owner
=
-
1
;
}
...
...
@@ -827,7 +828,6 @@ static int snd_ctl_elem_lock(struct snd_ctl_file *file,
result
=
-
EBUSY
;
else
{
vd
->
owner
=
file
;
vd
->
owner_pid
=
current
->
pid
;
result
=
0
;
}
}
...
...
@@ -858,7 +858,6 @@ static int snd_ctl_elem_unlock(struct snd_ctl_file *file,
result
=
-
EPERM
;
else
{
vd
->
owner
=
NULL
;
vd
->
owner_pid
=
0
;
result
=
0
;
}
}
...
...
sound/core/pcm.c
View file @
3f225c07
...
...
@@ -809,7 +809,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
card
=
pcm
->
card
;
read_lock
(
&
card
->
ctl_files_rwlock
);
list_for_each_entry
(
kctl
,
&
card
->
ctl_files
,
list
)
{
if
(
kctl
->
pid
==
current
->
pid
)
{
if
(
kctl
->
pid
==
task_pid
(
current
)
)
{
prefer_subdevice
=
kctl
->
prefer_pcm_subdevice
;
if
(
prefer_subdevice
!=
-
1
)
break
;
...
...
sound/core/rawmidi.c
View file @
3f225c07
...
...
@@ -413,7 +413,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
subdevice
=
-
1
;
read_lock
(
&
card
->
ctl_files_rwlock
);
list_for_each_entry
(
kctl
,
&
card
->
ctl_files
,
list
)
{
if
(
kctl
->
pid
==
current
->
pid
)
{
if
(
kctl
->
pid
==
task_pid
(
current
)
)
{
subdevice
=
kctl
->
prefer_rawmidi_subdevice
;
if
(
subdevice
!=
-
1
)
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment