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
dc4ff5bf
Commit
dc4ff5bf
authored
Aug 18, 2003
by
Andrew Morton
Committed by
Linus Torvalds
Aug 18, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] add locking to global list in ymfpci.c
This driver has a global list of devices which has no locking.
parent
0f9f751c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
sound/oss/ymfpci.c
sound/oss/ymfpci.c
+11
-1
No files found.
sound/oss/ymfpci.c
View file @
dc4ff5bf
...
...
@@ -99,6 +99,7 @@ static void ymfpci_disable_dsp(ymfpci_t *unit);
static
void
ymfpci_download_image
(
ymfpci_t
*
codec
);
static
void
ymf_memload
(
ymfpci_t
*
unit
);
static
spinlock_t
ymf_devs_lock
=
SPIN_LOCK_UNLOCKED
;
static
LIST_HEAD
(
ymf_devs
);
/*
...
...
@@ -1912,12 +1913,14 @@ static int ymf_open(struct inode *inode, struct file *file)
}
unit
=
NULL
;
/* gcc warns */
spin_lock
(
&
ymf_devs_lock
);
list_for_each
(
list
,
&
ymf_devs
)
{
unit
=
list_entry
(
list
,
ymfpci_t
,
ymf_devs
);
if
(((
unit
->
dev_audio
^
minor
)
&
~
0x0F
)
==
0
)
break
;
}
if
(
list
==
&
ymf_devs
)
spin_unlock
(
&
ymf_devs_lock
);
if
(
unit
==
NULL
)
return
-
ENODEV
;
down
(
&
unit
->
open_sem
);
...
...
@@ -2021,15 +2024,18 @@ static int ymf_open_mixdev(struct inode *inode, struct file *file)
ymfpci_t
*
unit
;
int
i
;
spin_lock
(
&
ymf_devs_lock
);
list_for_each
(
list
,
&
ymf_devs
)
{
unit
=
list_entry
(
list
,
ymfpci_t
,
ymf_devs
);
for
(
i
=
0
;
i
<
NR_AC97
;
i
++
)
{
if
(
unit
->
ac97_codec
[
i
]
!=
NULL
&&
unit
->
ac97_codec
[
i
]
->
dev_mixer
==
minor
)
{
spin_unlock
(
&
ymf_devs_lock
);
goto
match
;
}
}
}
spin_unlock
(
&
ymf_devs_lock
);
return
-
ENODEV
;
match:
...
...
@@ -2607,7 +2613,9 @@ static int __devinit ymf_probe_one(struct pci_dev *pcidev, const struct pci_devi
#endif
/* CONFIG_SOUND_YMFPCI_LEGACY */
/* put it into driver list */
spin_lock
(
&
ymf_devs_lock
);
list_add_tail
(
&
codec
->
ymf_devs
,
&
ymf_devs
);
spin_unlock
(
&
ymf_devs_lock
);
pci_set_drvdata
(
pcidev
,
codec
);
return
0
;
...
...
@@ -2639,7 +2647,9 @@ static void __devexit ymf_remove_one(struct pci_dev *pcidev)
ymfpci_t
*
codec
=
pci_get_drvdata
(
pcidev
);
/* remove from list of devices */
spin_lock
(
&
ymf_devs_lock
);
list_del
(
&
codec
->
ymf_devs
);
spin_unlock
(
&
ymf_devs_lock
);
unregister_sound_mixer
(
codec
->
ac97_codec
[
0
]
->
dev_mixer
);
ac97_release_codec
(
codec
->
ac97_codec
[
0
]);
...
...
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