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 | |
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')
-rw-r--r-- | sound/core/hwdep.c | 43 | ||||
-rw-r--r-- | sound/core/info.c | 27 | ||||
-rw-r--r-- | sound/core/info_oss.c | 13 | ||||
-rw-r--r-- | sound/core/init.c | 2 | ||||
-rw-r--r-- | sound/core/memalloc.c | 22 | ||||
-rw-r--r-- | sound/core/oss/mixer_oss.c | 14 | ||||
-rw-r--r-- | sound/core/oss/pcm_oss.c | 30 | ||||
-rw-r--r-- | sound/core/pcm.c | 40 | ||||
-rw-r--r-- | sound/core/pcm_native.c | 12 | ||||
-rw-r--r-- | sound/core/rawmidi.c | 57 | ||||
-rw-r--r-- | sound/core/seq/oss/seq_oss.c | 27 | ||||
-rw-r--r-- | sound/core/seq/seq_clientmgr.c | 40 | ||||
-rw-r--r-- | sound/core/seq/seq_clientmgr.h | 2 | ||||
-rw-r--r-- | sound/core/seq/seq_device.c | 53 | ||||
-rw-r--r-- | sound/core/seq/seq_instr.c | 6 | ||||
-rw-r--r-- | sound/core/seq/seq_midi.c | 20 | ||||
-rw-r--r-- | sound/core/seq/seq_ports.c | 12 | ||||
-rw-r--r-- | sound/core/seq/seq_queue.c | 6 | ||||
-rw-r--r-- | sound/core/seq/seq_queue.h | 2 | ||||
-rw-r--r-- | sound/core/sound.c | 23 | ||||
-rw-r--r-- | sound/core/sound_oss.c | 23 | ||||
-rw-r--r-- | sound/core/timer.c | 77 |
22 files changed, 281 insertions, 270 deletions
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 618c43be0bc..2524e66eccd 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; diff --git a/sound/core/info.c b/sound/core/info.c index af123e3bdb2..2582b74d319 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -31,6 +31,7 @@ #include <sound/version.h> #include <linux/proc_fs.h> #include <linux/devfs_fs_kernel.h> +#include <linux/mutex.h> #include <stdarg.h> /* @@ -68,7 +69,7 @@ int snd_info_check_reserved_words(const char *str) return 1; } -static DECLARE_MUTEX(info_mutex); +static DEFINE_MUTEX(info_mutex); struct snd_info_private_data { struct snd_info_buffer *rbuffer; @@ -265,11 +266,11 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) struct proc_dir_entry *p; int mode, err; - down(&info_mutex); + mutex_lock(&info_mutex); p = PDE(inode); entry = p == NULL ? NULL : (struct snd_info_entry *)p->data; if (entry == NULL || entry->disconnected) { - up(&info_mutex); + mutex_unlock(&info_mutex); return -ENODEV; } if (!try_module_get(entry->module)) { @@ -361,13 +362,13 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) break; } file->private_data = data; - up(&info_mutex); + mutex_unlock(&info_mutex); if (entry->content == SNDRV_INFO_CONTENT_TEXT && (mode == O_RDONLY || mode == O_RDWR)) { if (entry->c.text.read) { - down(&entry->access); + mutex_lock(&entry->access); entry->c.text.read(entry, data->rbuffer); - up(&entry->access); + mutex_unlock(&entry->access); } } return 0; @@ -375,7 +376,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file) __error: module_put(entry->module); __error1: - up(&info_mutex); + mutex_unlock(&info_mutex); return err; } @@ -747,7 +748,7 @@ static struct snd_info_entry *snd_info_create_entry(const char *name) } entry->mode = S_IFREG | S_IRUGO; entry->content = SNDRV_INFO_CONTENT_TEXT; - init_MUTEX(&entry->access); + mutex_init(&entry->access); return entry; } @@ -896,10 +897,10 @@ int snd_info_register(struct snd_info_entry * entry) snd_assert(entry != NULL, return -ENXIO); root = entry->parent == NULL ? snd_proc_root : entry->parent->p; - down(&info_mutex); + mutex_lock(&info_mutex); p = snd_create_proc_entry(entry->name, entry->mode, root); if (!p) { - up(&info_mutex); + mutex_unlock(&info_mutex); return -ENOMEM; } p->owner = entry->module; @@ -908,7 +909,7 @@ int snd_info_register(struct snd_info_entry * entry) p->size = entry->size; p->data = entry; entry->p = p; - up(&info_mutex); + mutex_unlock(&info_mutex); return 0; } @@ -929,9 +930,9 @@ int snd_info_unregister(struct snd_info_entry * entry) snd_assert(entry->p != NULL, return -ENXIO); root = entry->parent == NULL ? snd_proc_root : entry->parent->p; snd_assert(root, return -ENXIO); - down(&info_mutex); + mutex_lock(&info_mutex); snd_remove_proc_entry(root, entry->p); - up(&info_mutex); + mutex_unlock(&info_mutex); snd_info_free_entry(entry); return 0; } diff --git a/sound/core/info_oss.c b/sound/core/info_oss.c index 820f4772e44..f9ce854b3d1 100644 --- a/sound/core/info_oss.c +++ b/sound/core/info_oss.c @@ -28,6 +28,7 @@ #include <sound/info.h> #include <sound/version.h> #include <linux/utsname.h> +#include <linux/mutex.h> #if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) @@ -35,7 +36,7 @@ * OSS compatible part */ -static DECLARE_MUTEX(strings); +static DEFINE_MUTEX(strings); static char *snd_sndstat_strings[SNDRV_CARDS][SNDRV_OSS_INFO_DEV_COUNT]; static struct snd_info_entry *snd_sndstat_proc_entry; @@ -45,7 +46,7 @@ int snd_oss_info_register(int dev, int num, char *string) snd_assert(dev >= 0 && dev < SNDRV_OSS_INFO_DEV_COUNT, return -ENXIO); snd_assert(num >= 0 && num < SNDRV_CARDS, return -ENXIO); - down(&strings); + mutex_lock(&strings); if (string == NULL) { if ((x = snd_sndstat_strings[num][dev]) != NULL) { kfree(x); @@ -54,12 +55,12 @@ int snd_oss_info_register(int dev, int num, char *string) } else { x = kstrdup(string, GFP_KERNEL); if (x == NULL) { - up(&strings); + mutex_unlock(&strings); return -ENOMEM; } } snd_sndstat_strings[num][dev] = x; - up(&strings); + mutex_unlock(&strings); return 0; } @@ -71,7 +72,7 @@ static int snd_sndstat_show_strings(struct snd_info_buffer *buf, char *id, int d char *str; snd_iprintf(buf, "\n%s:", id); - down(&strings); + mutex_lock(&strings); for (idx = 0; idx < SNDRV_CARDS; idx++) { str = snd_sndstat_strings[idx][dev]; if (str) { @@ -82,7 +83,7 @@ static int snd_sndstat_show_strings(struct snd_info_buffer *buf, char *id, int d snd_iprintf(buf, "%i: %s\n", idx, str); } } - up(&strings); + mutex_unlock(&strings); if (ok < 0) snd_iprintf(buf, " NOT ENABLED IN CONFIG\n"); return ok; diff --git a/sound/core/init.c b/sound/core/init.c index 75816688607..17fbd6c14fb 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -145,7 +145,7 @@ struct snd_card *snd_card_new(int idx, const char *xid, init_waitqueue_head(&card->shutdown_sleep); INIT_WORK(&card->free_workq, snd_card_free_thread, card); #ifdef CONFIG_PM - init_MUTEX(&card->power_lock); + mutex_init(&card->power_lock); init_waitqueue_head(&card->power_sleep); #endif /* the control interface cannot be accessed from the user space until */ diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 19b3dcbb09c..9f2b88cb587 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -31,7 +31,7 @@ #include <asm/uaccess.h> #include <linux/dma-mapping.h> #include <linux/moduleparam.h> -#include <asm/semaphore.h> +#include <linux/mutex.h> #include <sound/memalloc.h> #ifdef CONFIG_SBUS #include <asm/sbus.h> @@ -54,7 +54,7 @@ int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab); /* */ -static DECLARE_MUTEX(list_mutex); +static DEFINE_MUTEX(list_mutex); static LIST_HEAD(mem_list_head); /* buffer preservation list */ @@ -440,7 +440,7 @@ size_t snd_dma_get_reserved_buf(struct snd_dma_buffer *dmab, unsigned int id) snd_assert(dmab, return 0); - down(&list_mutex); + mutex_lock(&list_mutex); list_for_each(p, &mem_list_head) { mem = list_entry(p, struct snd_mem_list, list); if (mem->id == id && @@ -452,11 +452,11 @@ size_t snd_dma_get_reserved_buf(struct snd_dma_buffer *dmab, unsigned int id) if (dmab->dev.dev == NULL) dmab->dev.dev = dev; kfree(mem); - up(&list_mutex); + mutex_unlock(&list_mutex); return dmab->bytes; } } - up(&list_mutex); + mutex_unlock(&list_mutex); return 0; } @@ -477,11 +477,11 @@ int snd_dma_reserve_buf(struct snd_dma_buffer *dmab, unsigned int id) mem = kmalloc(sizeof(*mem), GFP_KERNEL); if (! mem) return -ENOMEM; - down(&list_mutex); + mutex_lock(&list_mutex); mem->buffer = *dmab; mem->id = id; list_add_tail(&mem->list, &mem_list_head); - up(&list_mutex); + mutex_unlock(&list_mutex); return 0; } @@ -493,7 +493,7 @@ static void free_all_reserved_pages(void) struct list_head *p; struct snd_mem_list *mem; - down(&list_mutex); + mutex_lock(&list_mutex); while (! list_empty(&mem_list_head)) { p = mem_list_head.next; mem = list_entry(p, struct snd_mem_list, list); @@ -501,7 +501,7 @@ static void free_all_reserved_pages(void) snd_dma_free_pages(&mem->buffer); kfree(mem); } - up(&list_mutex); + mutex_unlock(&list_mutex); } @@ -522,7 +522,7 @@ static int snd_mem_proc_read(char *page, char **start, off_t off, int devno; static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG", "SBUS" }; - down(&list_mutex); + mutex_lock(&list_mutex); len += snprintf(page + len, count - len, "pages : %li bytes (%li pages per %likB)\n", pages * PAGE_SIZE, pages, PAGE_SIZE / 1024); @@ -537,7 +537,7 @@ static int snd_mem_proc_read(char *page, char **start, off_t off, " addr = 0x%lx, size = %d bytes\n", (unsigned long)mem->buffer.addr, (int)mem->buffer.bytes); } - up(&list_mutex); + mutex_unlock(&list_mutex); return len; } diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index f08e65a2bff..9c68bc3f97a 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c @@ -1095,7 +1095,7 @@ static void snd_mixer_oss_proc_read(struct snd_info_entry *entry, struct snd_mixer_oss *mixer = entry->private_data; int i; - down(&mixer->reg_mutex); + mutex_lock(&mixer->reg_mutex); for (i = 0; i < SNDRV_OSS_MAX_MIXERS; i++) { struct slot *p; @@ -1110,7 +1110,7 @@ static void snd_mixer_oss_proc_read(struct snd_info_entry *entry, else snd_iprintf(buffer, "\"\" 0\n"); } - up(&mixer->reg_mutex); + mutex_unlock(&mixer->reg_mutex); } static void snd_mixer_oss_proc_write(struct snd_info_entry *entry, @@ -1134,9 +1134,9 @@ static void snd_mixer_oss_proc_write(struct snd_info_entry *entry, cptr = snd_info_get_str(str, cptr, sizeof(str)); if (! *str) { /* remove the entry */ - down(&mixer->reg_mutex); + mutex_lock(&mixer->reg_mutex); mixer_slot_clear(&mixer->slots[ch]); - up(&mixer->reg_mutex); + mutex_unlock(&mixer->reg_mutex); continue; } snd_info_get_str(idxstr, cptr, sizeof(idxstr)); @@ -1145,7 +1145,7 @@ static void snd_mixer_oss_proc_write(struct snd_info_entry *entry, snd_printk(KERN_ERR "mixer_oss: invalid index %d\n", idx); continue; } - down(&mixer->reg_mutex); + mutex_lock(&mixer->reg_mutex); slot = (struct slot *)mixer->slots[ch].private_data; if (slot && slot->assigned && slot->assigned->index == idx && ! strcmp(slot->assigned->name, str)) @@ -1168,7 +1168,7 @@ static void snd_mixer_oss_proc_write(struct snd_info_entry *entry, kfree(tbl); } __unlock: - up(&mixer->reg_mutex); + mutex_unlock(&mixer->reg_mutex); } } @@ -1288,7 +1288,7 @@ static int snd_mixer_oss_notify_handler(struct snd_card *card, int cmd) mixer = kcalloc(2, sizeof(*mixer), GFP_KERNEL); if (mixer == NULL) return -ENOMEM; - init_MUTEX(&mixer->reg_mutex); + mutex_init(&mixer->reg_mutex); sprintf(name, "mixer%i%i", card->number, 0); if ((err = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER, card, 0, diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index bc24d028f51..f8302b703a3 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -1643,10 +1643,10 @@ static struct snd_pcm_oss_setup *snd_pcm_oss_look_for_setup(struct snd_pcm *pcm, const char *ptr, *ptrl; struct snd_pcm_oss_setup *setup; - down(&pcm->streams[stream].oss.setup_mutex); + mutex_lock(&pcm->streams[stream].oss.setup_mutex); for (setup = pcm->streams[stream].oss.setup_list; setup; setup = setup->next) { if (!strcmp(setup->task_name, task_name)) { - up(&pcm->streams[stream].oss.setup_mutex); + mutex_unlock(&pcm->streams[stream].oss.setup_mutex); return setup; } } @@ -1662,12 +1662,12 @@ static struct snd_pcm_oss_setup *snd_pcm_oss_look_for_setup(struct snd_pcm *pcm, } for (setup = pcm->streams[stream].oss.setup_list; setup; setup = setup->next) { if (!strcmp(setup->task_name, ptrl)) { - up(&pcm->streams[stream].oss.setup_mutex); + mutex_unlock(&pcm->streams[stream].oss.setup_mutex); return setup; } } __not_found: - up(&pcm->streams[stream].oss.setup_mutex); + mutex_unlock(&pcm->streams[stream].oss.setup_mutex); return NULL; } @@ -1895,7 +1895,7 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) init_waitqueue_entry(&wait, current); add_wait_queue(&pcm->open_wait, &wait); - down(&pcm->open_mutex); + mutex_lock(&pcm->open_mutex); while (1) { err = snd_pcm_oss_open_file(file, pcm, &pcm_oss_file, iminor(inode), psetup, csetup); @@ -1909,16 +1909,16 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) } else break; set_current_state(TASK_INTERRUPTIBLE); - up(&pcm->open_mutex); + mutex_unlock(&pcm->open_mutex); schedule(); - down(&pcm->open_mutex); + mutex_lock(&pcm->open_mutex); if (signal_pending(current)) { err = -ERESTARTSYS; break; } } remove_wait_queue(&pcm->open_wait, &wait); - up(&pcm->open_mutex); + mutex_unlock(&pcm->open_mutex); if (err < 0) goto __error; return err; @@ -1944,9 +1944,9 @@ static int snd_pcm_oss_release(struct inode *inode, struct file *file) snd_assert(substream != NULL, return -ENXIO); pcm = substream->pcm; snd_pcm_oss_sync(pcm_oss_file); - down(&pcm->open_mutex); + mutex_lock(&pcm->open_mutex); snd_pcm_oss_release_file(pcm_oss_file); - up(&pcm->open_mutex); + mutex_unlock(&pcm->open_mutex); wake_up(&pcm->open_wait); module_put(pcm->card->module); snd_card_file_remove(pcm->card, file); @@ -2293,7 +2293,7 @@ static void snd_pcm_oss_proc_read(struct snd_info_entry *entry, { struct snd_pcm_str *pstr = entry->private_data; struct snd_pcm_oss_setup *setup = pstr->oss.setup_list; - down(&pstr->oss.setup_mutex); + mutex_lock(&pstr->oss.setup_mutex); while (setup) { snd_iprintf(buffer, "%s %u %u%s%s%s%s%s%s\n", setup->task_name, @@ -2307,7 +2307,7 @@ static void snd_pcm_oss_proc_read(struct snd_info_entry *entry, setup->nosilence ? " no-silence" : ""); setup = setup->next; } - up(&pstr->oss.setup_mutex); + mutex_unlock(&pstr->oss.setup_mutex); } static void snd_pcm_oss_proc_free_setup_list(struct snd_pcm_str * pstr) @@ -2337,12 +2337,12 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry, struct snd_pcm_oss_setup *setup, *setup1, template; while (!snd_info_get_line(buffer, line, sizeof(line))) { - down(&pstr->oss.setup_mutex); + mutex_lock(&pstr->oss.setup_mutex); memset(&template, 0, sizeof(template)); ptr = snd_info_get_str(task_name, line, sizeof(task_name)); if (!strcmp(task_name, "clear") || !strcmp(task_name, "erase")) { snd_pcm_oss_proc_free_setup_list(pstr); - up(&pstr->oss.setup_mutex); + mutex_unlock(&pstr->oss.setup_mutex); continue; } for (setup = pstr->oss.setup_list; setup; setup = setup->next) { @@ -2394,7 +2394,7 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry, } if (setup) *setup = template; - up(&pstr->oss.setup_mutex); + mutex_unlock(&pstr->oss.setup_mutex); } } diff --git a/sound/core/pcm.c b/sound/core/pcm.c index d92c3ce4a4c..f903d1bd74d 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -23,6 +23,7 @@ #include <linux/init.h> #include <linux/slab.h> #include <linux/time.h> +#include <linux/mutex.h> #include <sound/core.h> #include <sound/minors.h> #include <sound/pcm.h> @@ -35,7 +36,7 @@ MODULE_LICENSE("GPL"); static LIST_HEAD(snd_pcm_devices); static LIST_HEAD(snd_pcm_notify_list); -static DECLARE_MUTEX(register_mutex); +static DEFINE_MUTEX(register_mutex); static int snd_pcm_free(struct snd_pcm *pcm); static int snd_pcm_dev_free(struct snd_device *device); @@ -67,7 +68,7 @@ static int snd_pcm_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_PCM_DEVICES) { if (snd_pcm_search(card, device)) @@ -76,7 +77,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card, } if (device == SNDRV_PCM_DEVICES) device = -1; - up(®ister_mutex); + mutex_unlock(®ister_mutex); if (put_user(device, (int __user *)arg)) return -EFAULT; return 0; @@ -100,7 +101,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card, return -EINVAL; if (get_user(subdevice, &info->subdevice)) return -EFAULT; - down(®ister_mutex); + mutex_lock(®ister_mutex); pcm = snd_pcm_search(card, device); if (pcm == NULL) { err = -ENXIO; @@ -125,7 +126,7 @@ static int snd_pcm_control_ioctl(struct snd_card *card, } err = snd_pcm_info_user(substream, info); _error: - up(®ister_mutex); + mutex_unlock(®ister_mutex); return err; } case SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE: @@ -262,6 +263,7 @@ static const char *snd_pcm_state_name(snd_pcm_state_t state) #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) #include <linux/soundcard.h> + static const char *snd_pcm_oss_format_name(int format) { switch (format) { @@ -624,7 +626,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) struct snd_pcm_substream *substream, *prev; #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) - init_MUTEX(&pstr->oss.setup_mutex); + mutex_init(&pstr->oss.setup_mutex); #endif pstr->stream = stream; pstr->pcm = pcm; @@ -718,7 +720,7 @@ int snd_pcm_new(struct snd_card *card, char *id, int device, snd_pcm_free(pcm); return err; } - init_MUTEX(&pcm->open_mutex); + mutex_init(&pcm->open_mutex); init_waitqueue_head(&pcm->open_wait); if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) { snd_pcm_free(pcm); @@ -904,9 +906,9 @@ static int snd_pcm_dev_register(struct snd_device *device) struct snd_pcm *pcm = device->device_data; snd_assert(pcm != NULL && device != NULL, return -ENXIO); - down(®ister_mutex); + mutex_lock(®ister_mutex); if (snd_pcm_search(pcm->card, pcm->device)) { - up(®ister_mutex); + mutex_unlock(®ister_mutex); return -EBUSY; } list_add_tail(&pcm->list, &snd_pcm_devices); @@ -930,7 +932,7 @@ static int snd_pcm_dev_register(struct snd_device *device) pcm, str)) < 0) { list_del(&pcm->list); - up(®ister_mutex); + mutex_unlock(®ister_mutex); return err; } for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) @@ -941,7 +943,7 @@ static int snd_pcm_dev_register(struct snd_device *device) notify = list_entry(list, struct snd_pcm_notify, list); notify->n_register(pcm); } - up(®ister_mutex); + mutex_unlock(®ister_mutex); return 0; } @@ -952,7 +954,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) struct snd_pcm_substream *substream; int cidx; - down(®ister_mutex); + mutex_lock(®ister_mutex); list_del_init(&pcm->list); for (cidx = 0; cidx < 2; cidx++) for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) @@ -963,7 +965,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) notify = list_entry(list, struct snd_pcm_notify, list); notify->n_disconnect(pcm); } - up(®ister_mutex); + mutex_unlock(®ister_mutex); return 0; } @@ -975,7 +977,7 @@ static int snd_pcm_dev_unregister(struct snd_device *device) struct snd_pcm *pcm = device->device_data; snd_assert(pcm != NULL, return -ENXIO); - down(®ister_mutex); + mutex_lock(®ister_mutex); list_del(&pcm->list); for (cidx = 0; cidx < 2; cidx++) { devtype = -1; @@ -996,7 +998,7 @@ static int snd_pcm_dev_unregister(struct snd_device *device) notify = list_entry(list, struct snd_pcm_notify, list); notify->n_unregister(pcm); } - up(®ister_mutex); + mutex_unlock(®ister_mutex); return snd_pcm_free(pcm); } @@ -1005,7 +1007,7 @@ int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree) struct list_head *p; snd_assert(notify != NULL && notify->n_register != NULL && notify->n_unregister != NULL, return -EINVAL); - down(®ister_mutex); + mutex_lock(®ister_mutex); if (nfree) { list_del(¬ify->list); list_for_each(p, &snd_pcm_devices) @@ -1016,7 +1018,7 @@ int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree) list_for_each(p, &snd_pcm_devices) notify->n_register(list_entry(p, struct snd_pcm, list)); } - up(®ister_mutex); + mutex_unlock(®ister_mutex); return 0; } @@ -1031,7 +1033,7 @@ static void snd_pcm_proc_read(struct snd_info_entry *entry, struct list_head *p; struct snd_pcm *pcm; - down(®ister_mutex); + mutex_lock(®ister_mutex); list_for_each(p, &snd_pcm_devices) { pcm = list_entry(p, struct snd_pcm, list); snd_iprintf(buffer, "%02i-%02i: %s : %s", @@ -1044,7 +1046,7 @@ static void snd_pcm_proc_read(struct snd_info_entry *entry, pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count); snd_iprintf(buffer, "\n"); } - up(®ister_mutex); + mutex_unlock(®ister_mutex); } static struct snd_info_entry *snd_pcm_proc_entry = NULL; diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index f3d5de7b55a..ce1956a5528 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -2112,7 +2112,7 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) } init_waitqueue_entry(&wait, current); add_wait_queue(&pcm->open_wait, &wait); - down(&pcm->open_mutex); + mutex_lock(&pcm->open_mutex); while (1) { err = snd_pcm_open_file(file, pcm, stream, &pcm_file); if (err >= 0) @@ -2125,16 +2125,16 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) } else break; set_current_state(TASK_INTERRUPTIBLE); - up(&pcm->open_mutex); + mutex_unlock(&pcm->open_mutex); schedule(); - down(&pcm->open_mutex); + mutex_lock(&pcm->open_mutex); if (signal_pending(current)) { err = -ERESTARTSYS; break; } } remove_wait_queue(&pcm->open_wait, &wait); - up(&pcm->open_mutex); + mutex_unlock(&pcm->open_mutex); if (err < 0) goto __error; return err; @@ -2160,9 +2160,9 @@ static int snd_pcm_release(struct inode *inode, struct file *file) pcm = substream->pcm; snd_pcm_drop(substream); fasync_helper(-1, file, 0, &substream->runtime->fasync); - down(&pcm->open_mutex); + mutex_lock(&pcm->open_mutex); snd_pcm_release_file(pcm_file); - up(&pcm->open_mutex); + mutex_unlock(&pcm->open_mutex); wake_up(&pcm->open_wait); module_put(pcm->card->module); snd_card_file_remove(pcm->card, file); diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index d4d124e2192..6b7a3677429 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c @@ -28,6 +28,7 @@ #include <linux/slab.h> #include <linux/time.h> #include <linux/wait.h> +#include <linux/mutex.h> #include <linux/moduleparam.h> #include <linux/delay.h> #include <linux/wait.h> @@ -57,7 +58,7 @@ static int sn |