diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-01-16 10:29:08 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 04:24:50 -0500 |
commit | 1a60d4c5a0c4028559585a74e48593b16e1ca9b2 (patch) | |
tree | f03f8dfcd554f8ebbb295522dc46dfe4d110a484 /sound/core/sound_oss.c | |
parent | f0283f45a04d5cf31512e5e390a38504d97e7a97 (diff) |
[ALSA] semaphore -> mutex (core part)
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/sound_oss.c')
-rw-r--r-- | sound/core/sound_oss.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index d0be32b517c..6b4a4bccd8f 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c | |||
@@ -34,11 +34,12 @@ | |||
34 | #include <sound/minors.h> | 34 | #include <sound/minors.h> |
35 | #include <sound/info.h> | 35 | #include <sound/info.h> |
36 | #include <linux/sound.h> | 36 | #include <linux/sound.h> |
37 | #include <linux/mutex.h> | ||
37 | 38 | ||
38 | #define SNDRV_OSS_MINORS 128 | 39 | #define SNDRV_OSS_MINORS 128 |
39 | 40 | ||
40 | static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS]; | 41 | static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS]; |
41 | static DECLARE_MUTEX(sound_oss_mutex); | 42 | static DEFINE_MUTEX(sound_oss_mutex); |
42 | 43 | ||
43 | void *snd_lookup_oss_minor_data(unsigned int minor, int type) | 44 | void *snd_lookup_oss_minor_data(unsigned int minor, int type) |
44 | { | 45 | { |
@@ -47,13 +48,13 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type) | |||
47 | 48 | ||
48 | if (minor > ARRAY_SIZE(snd_oss_minors)) | 49 | if (minor > ARRAY_SIZE(snd_oss_minors)) |
49 | return NULL; | 50 | return NULL; |
50 | down(&sound_oss_mutex); | 51 | mutex_lock(&sound_oss_mutex); |
51 | mreg = snd_oss_minors[minor]; | 52 | mreg = snd_oss_minors[minor]; |
52 | if (mreg && mreg->type == type) | 53 | if (mreg && mreg->type == type) |
53 | private_data = mreg->private_data; | 54 | private_data = mreg->private_data; |
54 | else | 55 | else |
55 | private_data = NULL; | 56 | private_data = NULL; |
56 | up(&sound_oss_mutex); | 57 | mutex_unlock(&sound_oss_mutex); |
57 | return private_data; | 58 | return private_data; |
58 | } | 59 | } |
59 | 60 | ||
@@ -117,7 +118,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, | |||
117 | preg->device = dev; | 118 | preg->device = dev; |
118 | preg->f_ops = f_ops; | 119 | preg->f_ops = f_ops; |
119 | preg->private_data = private_data; | 120 | preg->private_data = private_data; |
120 | down(&sound_oss_mutex); | 121 | mutex_lock(&sound_oss_mutex); |
121 | snd_oss_minors[minor] = preg; | 122 | snd_oss_minors[minor] = preg; |
122 | minor_unit = SNDRV_MINOR_OSS_DEVICE(minor); | 123 | minor_unit = SNDRV_MINOR_OSS_DEVICE(minor); |
123 | switch (minor_unit) { | 124 | switch (minor_unit) { |
@@ -143,7 +144,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, | |||
143 | goto __end; | 144 | goto __end; |
144 | snd_oss_minors[track2] = preg; | 145 | snd_oss_minors[track2] = preg; |
145 | } | 146 | } |
146 | up(&sound_oss_mutex); | 147 | mutex_unlock(&sound_oss_mutex); |
147 | return 0; | 148 | return 0; |
148 | 149 | ||
149 | __end: | 150 | __end: |
@@ -152,7 +153,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, | |||
152 | if (register1 >= 0) | 153 | if (register1 >= 0) |
153 | unregister_sound_special(register1); | 154 | unregister_sound_special(register1); |
154 | snd_oss_minors[minor] = NULL; | 155 | snd_oss_minors[minor] = NULL; |
155 | up(&sound_oss_mutex); | 156 | mutex_unlock(&sound_oss_mutex); |
156 | kfree(preg); | 157 | kfree(preg); |
157 | return -EBUSY; | 158 | return -EBUSY; |
158 | } | 159 | } |
@@ -168,10 +169,10 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev) | |||
168 | return 0; | 169 | return 0; |
169 | if (minor < 0) | 170 | if (minor < 0) |
170 | return minor; | 171 | return minor; |
171 | down(&sound_oss_mutex); | 172 | mutex_lock(&sound_oss_mutex); |
172 | mptr = snd_oss_minors[minor]; | 173 | mptr = snd_oss_minors[minor]; |
173 | if (mptr == NULL) { | 174 | if (mptr == NULL) { |
174 | up(&sound_oss_mutex); | 175 | mutex_unlock(&sound_oss_mutex); |
175 | return -ENOENT; | 176 | return -ENOENT; |
176 | } | 177 | } |
177 | unregister_sound_special(minor); | 178 | unregister_sound_special(minor); |
@@ -191,7 +192,7 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev) | |||
191 | snd_oss_minors[track2] = NULL; | 192 | snd_oss_minors[track2] = NULL; |
192 | } | 193 | } |
193 | snd_oss_minors[minor] = NULL; | 194 | snd_oss_minors[minor] = NULL; |
194 | up(&sound_oss_mutex); | 195 | mutex_unlock(&sound_oss_mutex); |
195 | kfree(mptr); | 196 | kfree(mptr); |
196 | return 0; | 197 | return 0; |
197 | } | 198 | } |
@@ -229,7 +230,7 @@ static void snd_minor_info_oss_read(struct snd_info_entry *entry, | |||
229 | int minor; | 230 | int minor; |
230 | struct snd_minor *mptr; | 231 | struct snd_minor *mptr; |
231 | 232 | ||
232 | down(&sound_oss_mutex); | 233 | mutex_lock(&sound_oss_mutex); |
233 | for (minor = 0; minor < SNDRV_OSS_MINORS; ++minor) { | 234 | for (minor = 0; minor < SNDRV_OSS_MINORS; ++minor) { |
234 | if (!(mptr = snd_oss_minors[minor])) | 235 | if (!(mptr = snd_oss_minors[minor])) |
235 | continue; | 236 | continue; |
@@ -241,7 +242,7 @@ static void snd_minor_info_oss_read(struct snd_info_entry *entry, | |||
241 | snd_iprintf(buffer, "%3i: : %s\n", minor, | 242 | snd_iprintf(buffer, "%3i: : %s\n", minor, |
242 | snd_oss_device_type_name(mptr->type)); | 243 | snd_oss_device_type_name(mptr->type)); |
243 | } | 244 | } |
244 | up(&sound_oss_mutex); | 245 | mutex_unlock(&sound_oss_mutex); |
245 | } | 246 | } |
246 | 247 | ||
247 | 248 | ||