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.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.c')
-rw-r--r-- | sound/core/sound.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sound/core/sound.c b/sound/core/sound.c index a8eda02bcf1c..df4ab94d006e 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <sound/initval.h> | 33 | #include <sound/initval.h> |
34 | #include <linux/kmod.h> | 34 | #include <linux/kmod.h> |
35 | #include <linux/devfs_fs_kernel.h> | 35 | #include <linux/devfs_fs_kernel.h> |
36 | #include <linux/mutex.h> | ||
36 | 37 | ||
37 | #define SNDRV_OS_MINORS 256 | 38 | #define SNDRV_OS_MINORS 256 |
38 | 39 | ||
@@ -61,7 +62,7 @@ MODULE_ALIAS_CHARDEV_MAJOR(CONFIG_SND_MAJOR); | |||
61 | int snd_ecards_limit; | 62 | int snd_ecards_limit; |
62 | 63 | ||
63 | static struct snd_minor *snd_minors[SNDRV_OS_MINORS]; | 64 | static struct snd_minor *snd_minors[SNDRV_OS_MINORS]; |
64 | static DECLARE_MUTEX(sound_mutex); | 65 | static DEFINE_MUTEX(sound_mutex); |
65 | 66 | ||
66 | extern struct class *sound_class; | 67 | extern struct class *sound_class; |
67 | 68 | ||
@@ -122,13 +123,13 @@ void *snd_lookup_minor_data(unsigned int minor, int type) | |||
122 | 123 | ||
123 | if (minor > ARRAY_SIZE(snd_minors)) | 124 | if (minor > ARRAY_SIZE(snd_minors)) |
124 | return NULL; | 125 | return NULL; |
125 | down(&sound_mutex); | 126 | mutex_lock(&sound_mutex); |
126 | mreg = snd_minors[minor]; | 127 | mreg = snd_minors[minor]; |
127 | if (mreg && mreg->type == type) | 128 | if (mreg && mreg->type == type) |
128 | private_data = mreg->private_data; | 129 | private_data = mreg->private_data; |
129 | else | 130 | else |
130 | private_data = NULL; | 131 | private_data = NULL; |
131 | up(&sound_mutex); | 132 | mutex_unlock(&sound_mutex); |
132 | return private_data; | 133 | return private_data; |
133 | } | 134 | } |
134 | 135 | ||
@@ -256,7 +257,7 @@ int snd_register_device(int type, struct snd_card *card, int dev, | |||
256 | preg->f_ops = f_ops; | 257 | preg->f_ops = f_ops; |
257 | preg->private_data = private_data; | 258 | preg->private_data = private_data; |
258 | strcpy(preg->name, name); | 259 | strcpy(preg->name, name); |
259 | down(&sound_mutex); | 260 | mutex_lock(&sound_mutex); |
260 | #ifdef CONFIG_SND_DYNAMIC_MINORS | 261 | #ifdef CONFIG_SND_DYNAMIC_MINORS |
261 | minor = snd_find_free_minor(); | 262 | minor = snd_find_free_minor(); |
262 | #else | 263 | #else |
@@ -265,7 +266,7 @@ int snd_register_device(int type, struct snd_card *card, int dev, | |||
265 | minor = -EBUSY; | 266 | minor = -EBUSY; |
266 | #endif | 267 | #endif |
267 | if (minor < 0) { | 268 | if (minor < 0) { |
268 | up(&sound_mutex); | 269 | mutex_unlock(&sound_mutex); |
269 | kfree(preg); | 270 | kfree(preg); |
270 | return minor; | 271 | return minor; |
271 | } | 272 | } |
@@ -276,7 +277,7 @@ int snd_register_device(int type, struct snd_card *card, int dev, | |||
276 | device = card->dev; | 277 | device = card->dev; |
277 | class_device_create(sound_class, NULL, MKDEV(major, minor), device, "%s", name); | 278 | class_device_create(sound_class, NULL, MKDEV(major, minor), device, "%s", name); |
278 | 279 | ||
279 | up(&sound_mutex); | 280 | mutex_unlock(&sound_mutex); |
280 | return 0; | 281 | return 0; |
281 | } | 282 | } |
282 | 283 | ||
@@ -297,7 +298,7 @@ int snd_unregister_device(int type, struct snd_card *card, int dev) | |||
297 | struct snd_minor *mptr; | 298 | struct snd_minor *mptr; |
298 | 299 | ||
299 | cardnum = card ? card->number : -1; | 300 | cardnum = card ? card->number : -1; |
300 | down(&sound_mutex); | 301 | mutex_lock(&sound_mutex); |
301 | for (minor = 0; minor < ARRAY_SIZE(snd_minors); ++minor) | 302 | for (minor = 0; minor < ARRAY_SIZE(snd_minors); ++minor) |
302 | if ((mptr = snd_minors[minor]) != NULL && | 303 | if ((mptr = snd_minors[minor]) != NULL && |
303 | mptr->type == type && | 304 | mptr->type == type && |
@@ -305,7 +306,7 @@ int snd_unregister_device(int type, struct snd_card *card, int dev) | |||
305 | mptr->device == dev) | 306 | mptr->device == dev) |
306 | break; | 307 | break; |
307 | if (minor == ARRAY_SIZE(snd_minors)) { | 308 | if (minor == ARRAY_SIZE(snd_minors)) { |
308 | up(&sound_mutex); | 309 | mutex_unlock(&sound_mutex); |
309 | return -EINVAL; | 310 | return -EINVAL; |
310 | } | 311 | } |
311 | 312 | ||
@@ -315,7 +316,7 @@ int snd_unregister_device(int type, struct snd_card *card, int dev) | |||
315 | class_device_destroy(sound_class, MKDEV(major, minor)); | 316 | class_device_destroy(sound_class, MKDEV(major, minor)); |
316 | 317 | ||
317 | snd_minors[minor] = NULL; | 318 | snd_minors[minor] = NULL; |
318 | up(&sound_mutex); | 319 | mutex_unlock(&sound_mutex); |
319 | kfree(mptr); | 320 | kfree(mptr); |
320 | return 0; | 321 | return 0; |
321 | } | 322 | } |
@@ -354,7 +355,7 @@ static void snd_minor_info_read(struct snd_info_entry *entry, struct snd_info_bu | |||
354 | int minor; | 355 | int minor; |
355 | struct snd_minor *mptr; | 356 | struct snd_minor *mptr; |
356 | 357 | ||
357 | down(&sound_mutex); | 358 | mutex_lock(&sound_mutex); |
358 | for (minor = 0; minor < SNDRV_OS_MINORS; ++minor) { | 359 | for (minor = 0; minor < SNDRV_OS_MINORS; ++minor) { |
359 | if (!(mptr = snd_minors[minor])) | 360 | if (!(mptr = snd_minors[minor])) |
360 | continue; | 361 | continue; |
@@ -371,7 +372,7 @@ static void snd_minor_info_read(struct snd_info_entry *entry, struct snd_info_bu | |||
371 | snd_iprintf(buffer, "%3i: : %s\n", minor, | 372 | snd_iprintf(buffer, "%3i: : %s\n", minor, |
372 | snd_device_type_name(mptr->type)); | 373 | snd_device_type_name(mptr->type)); |
373 | } | 374 | } |
374 | up(&sound_mutex); | 375 | mutex_unlock(&sound_mutex); |
375 | } | 376 | } |
376 | 377 | ||
377 | int __init snd_minor_info_init(void) | 378 | int __init snd_minor_info_init(void) |