From 1a60d4c5a0c4028559585a74e48593b16e1ca9b2 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Mon, 16 Jan 2006 16:29:08 +0100 Subject: [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 Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- sound/core/sound_oss.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'sound/core/sound_oss.c') diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index d0be32b517c1..6b4a4bccd8fe 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c @@ -34,11 +34,12 @@ #include #include #include +#include #define SNDRV_OSS_MINORS 128 static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS]; -static DECLARE_MUTEX(sound_oss_mutex); +static DEFINE_MUTEX(sound_oss_mutex); void *snd_lookup_oss_minor_data(unsigned int minor, int type) { @@ -47,13 +48,13 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type) if (minor > ARRAY_SIZE(snd_oss_minors)) return NULL; - down(&sound_oss_mutex); + mutex_lock(&sound_oss_mutex); mreg = snd_oss_minors[minor]; if (mreg && mreg->type == type) private_data = mreg->private_data; else private_data = NULL; - up(&sound_oss_mutex); + mutex_unlock(&sound_oss_mutex); return private_data; } @@ -117,7 +118,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, preg->device = dev; preg->f_ops = f_ops; preg->private_data = private_data; - down(&sound_oss_mutex); + mutex_lock(&sound_oss_mutex); snd_oss_minors[minor] = preg; minor_unit = SNDRV_MINOR_OSS_DEVICE(minor); switch (minor_unit) { @@ -143,7 +144,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, goto __end; snd_oss_minors[track2] = preg; } - up(&sound_oss_mutex); + mutex_unlock(&sound_oss_mutex); return 0; __end: @@ -152,7 +153,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, if (register1 >= 0) unregister_sound_special(register1); snd_oss_minors[minor] = NULL; - up(&sound_oss_mutex); + mutex_unlock(&sound_oss_mutex); kfree(preg); return -EBUSY; } @@ -168,10 +169,10 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev) return 0; if (minor < 0) return minor; - down(&sound_oss_mutex); + mutex_lock(&sound_oss_mutex); mptr = snd_oss_minors[minor]; if (mptr == NULL) { - up(&sound_oss_mutex); + mutex_unlock(&sound_oss_mutex); return -ENOENT; } unregister_sound_special(minor); @@ -191,7 +192,7 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev) snd_oss_minors[track2] = NULL; } snd_oss_minors[minor] = NULL; - up(&sound_oss_mutex); + mutex_unlock(&sound_oss_mutex); kfree(mptr); return 0; } @@ -229,7 +230,7 @@ static void snd_minor_info_oss_read(struct snd_info_entry *entry, int minor; struct snd_minor *mptr; - down(&sound_oss_mutex); + mutex_lock(&sound_oss_mutex); for (minor = 0; minor < SNDRV_OSS_MINORS; ++minor) { if (!(mptr = snd_oss_minors[minor])) continue; @@ -241,7 +242,7 @@ static void snd_minor_info_oss_read(struct snd_info_entry *entry, snd_iprintf(buffer, "%3i: : %s\n", minor, snd_oss_device_type_name(mptr->type)); } - up(&sound_oss_mutex); + mutex_unlock(&sound_oss_mutex); } -- cgit v1.2.3