diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-01-16 16:29:08 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 10:24:50 +0100 |
commit | 1a60d4c5a0c4028559585a74e48593b16e1ca9b2 (patch) | |
tree | f03f8dfcd554f8ebbb295522dc46dfe4d110a484 /sound/core/hwdep.c | |
parent | f0283f45a04d5cf31512e5e390a38504d97e7a97 (diff) | |
download | linux-stable-1a60d4c5a0c4028559585a74e48593b16e1ca9b2.tar.gz linux-stable-1a60d4c5a0c4028559585a74e48593b16e1ca9b2.tar.bz2 linux-stable-1a60d4c5a0c4028559585a74e48593b16e1ca9b2.zip |
[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/hwdep.c')
-rw-r--r-- | sound/core/hwdep.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 618c43be0bc3..2524e66eccdd 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -25,6 +25,7 @@ #include <linux/smp_lock.h> #include <linux/slab.h> #include <linux/time.h> +#include <linux/mutex.h> #include <sound/core.h> #include <sound/control.h> #include <sound/minors.h> @@ -36,7 +37,7 @@ MODULE_DESCRIPTION("Hardware dependent layer"); MODULE_LICENSE("GPL"); static LIST_HEAD(snd_hwdep_devices); -static DECLARE_MUTEX(register_mutex); +static DEFINE_MUTEX(register_mutex); static int snd_hwdep_free(struct snd_hwdep *hwdep); static int snd_hwdep_dev_free(struct snd_device *device); @@ -111,7 +112,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) init_waitqueue_entry(&wait, current); add_wait_queue(&hw->open_wait, &wait); - down(&hw->open_mutex); + mutex_lock(&hw->open_mutex); while (1) { if (hw->exclusive && hw->used > 0) { err = -EBUSY; @@ -128,9 +129,9 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) } else break; set_current_state(TASK_INTERRUPTIBLE); - up(&hw->open_mutex); + mutex_unlock(&hw->open_mutex); schedule(); - down(&hw->open_mutex); + mutex_lock(&hw->open_mutex); if (signal_pending(current)) { err = -ERESTARTSYS; break; @@ -147,7 +148,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) hw->ops.release(hw, file); } } - up(&hw->open_mutex); + mutex_unlock(&hw->open_mutex); if (err < 0) module_put(hw->card->module); return err; @@ -157,7 +158,7 @@ static int snd_hwdep_release(struct inode *inode, struct file * file) { int err = -ENXIO; struct snd_hwdep *hw = file->private_data; - down(&hw->open_mutex); + mutex_lock(&hw->open_mutex); if (hw->ops.release) { err = hw->ops.release(hw, file); wake_up(&hw->open_wait); @@ -165,7 +166,7 @@ static int snd_hwdep_release(struct inode *inode, struct file * file) if (hw->used > 0) hw->used--; snd_card_file_remove(hw->card, file); - up(&hw->open_mutex); + mutex_unlock(&hw->open_mutex); module_put(hw->card->module); return err; } @@ -272,7 +273,7 @@ static int snd_hwdep_control_ioctl(struct snd_card *card, if (get_user(device, (int __user *)arg)) return -EFAULT; - down(®ister_mutex); + mutex_lock(®ister_mutex); device = device < 0 ? 0 : device + 1; while (device < SNDRV_MINOR_HWDEPS) { if (snd_hwdep_search(card, device)) @@ -281,7 +282,7 @@ static int snd_hwdep_control_ioctl(struct snd_card *card, } if (device >= SNDRV_MINOR_HWDEPS) device = -1; - up(®ister_mutex); + mutex_unlock(®ister_mutex); if (put_user(device, (int __user *)arg)) return -EFAULT; return 0; @@ -294,13 +295,13 @@ static int snd_hwdep_control_ioctl(struct snd_card *card, if (get_user(device, &info->device)) return -EFAULT; - down(®ister_mutex); + mutex_lock(®ister_mutex); hwdep = snd_hwdep_search(card, device); if (hwdep) err = snd_hwdep_info(hwdep, info); else err = -ENXIO; - up(®ister_mutex); + mutex_unlock(®ister_mutex); return err; } } @@ -375,7 +376,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device, return err; } init_waitqueue_head(&hwdep->open_wait); - init_MUTEX(&hwdep->open_mutex); + mutex_init(&hwdep->open_mutex); *rhwdep = hwdep; return 0; } @@ -401,9 +402,9 @@ static int snd_hwdep_dev_register(struct snd_device *device) int err; char name[32]; - down(®ister_mutex); + mutex_lock(®ister_mutex); if (snd_hwdep_search(hwdep->card, hwdep->device)) { - up(®ister_mutex); + mutex_unlock(®ister_mutex); return -EBUSY; } list_add_tail(&hwdep->list, &snd_hwdep_devices); @@ -414,7 +415,7 @@ static int snd_hwdep_dev_register(struct snd_device *device) snd_printk(KERN_ERR "unable to register hardware dependent device %i:%i\n", hwdep->card->number, hwdep->device); list_del(&hwdep->list); - up(®ister_mutex); + mutex_unlock(®ister_mutex); return err; } #ifdef CONFIG_SND_OSSEMUL @@ -434,7 +435,7 @@ static int snd_hwdep_dev_register(struct snd_device *device) } } #endif - up(®ister_mutex); + mutex_unlock(®ister_mutex); return 0; } @@ -443,9 +444,9 @@ static int snd_hwdep_dev_unregister(struct snd_device *device) struct snd_hwdep *hwdep = device->device_data; snd_assert(hwdep != NULL, return -ENXIO); - down(®ister_mutex); + mutex_lock(®ister_mutex); if (snd_hwdep_search(hwdep->card, hwdep->device) != hwdep) { - up(®ister_mutex); + mutex_unlock(®ister_mutex); return -EINVAL; } #ifdef CONFIG_SND_OSSEMUL @@ -454,7 +455,7 @@ static int snd_hwdep_dev_unregister(struct snd_device *device) #endif snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device); list_del(&hwdep->list); - up(®ister_mutex); + mutex_unlock(®ister_mutex); return snd_hwdep_free(hwdep); } @@ -469,13 +470,13 @@ static void snd_hwdep_proc_read(struct snd_info_entry *entry, struct list_head *p; struct snd_hwdep *hwdep; - down(®ister_mutex); + mutex_lock(®ister_mutex); list_for_each(p, &snd_hwdep_devices) { hwdep = list_entry(p, struct snd_hwdep, list); snd_iprintf(buffer, "%02i-%02i: %s\n", hwdep->card->number, hwdep->device, hwdep->name); } - up(®ister_mutex); + mutex_unlock(®ister_mutex); } static struct snd_info_entry *snd_hwdep_proc_entry; |