diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-01-16 16:34:20 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 10:25:29 +0100 |
commit | 62932df8fb20ba2fb53a95fa52445eba22e821fe (patch) | |
tree | 335178d7438395a68a453a9c23624b3e9fc5ec40 /sound/pci/emu10k1 | |
parent | 8b7547f95cbe8a5940df62ed730646fdfcba5fda (diff) |
[ALSA] semaphore -> mutex (PCI 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/pci/emu10k1')
-rw-r--r-- | sound/pci/emu10k1/emu10k1_main.c | 5 | ||||
-rw-r--r-- | sound/pci/emu10k1/emufx.c | 22 | ||||
-rw-r--r-- | sound/pci/emu10k1/memory.c | 26 |
3 files changed, 29 insertions, 24 deletions
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 3c7043b7d4c9..103a3f7708b7 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c @@ -36,6 +36,8 @@ #include <linux/pci.h> #include <linux/slab.h> #include <linux/vmalloc.h> +#include <linux/mutex.h> + #include <sound/core.h> #include <sound/emu10k1.h> @@ -1097,8 +1099,7 @@ int __devinit snd_emu10k1_create(struct snd_card *card, spin_lock_init(&emu->voice_lock); spin_lock_init(&emu->synth_lock); spin_lock_init(&emu->memblk_lock); - init_MUTEX(&emu->ptb_lock); - init_MUTEX(&emu->fx8010.lock); + mutex_init(&emu->fx8010.lock); INIT_LIST_HEAD(&emu->mapped_link_head); INIT_LIST_HEAD(&emu->mapped_order_link_head); emu->pci = pci; diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 509837252735..dfba00230d4d 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -32,6 +32,8 @@ #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/init.h> +#include <linux/mutex.h> + #include <sound/core.h> #include <sound/emu10k1.h> @@ -874,7 +876,7 @@ static int snd_emu10k1_icode_poke(struct snd_emu10k1 *emu, { int err = 0; - down(&emu->fx8010.lock); + mutex_lock(&emu->fx8010.lock); if ((err = snd_emu10k1_verify_controls(emu, icode)) < 0) goto __error; strlcpy(emu->fx8010.name, icode->name, sizeof(emu->fx8010.name)); @@ -897,7 +899,7 @@ static int snd_emu10k1_icode_poke(struct snd_emu10k1 *emu, else snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg); __error: - up(&emu->fx8010.lock); + mutex_unlock(&emu->fx8010.lock); return err; } @@ -906,7 +908,7 @@ static int snd_emu10k1_icode_peek(struct snd_emu10k1 *emu, { int err; - down(&emu->fx8010.lock); + mutex_lock(&emu->fx8010.lock); strlcpy(icode->name, emu->fx8010.name, sizeof(icode->name)); /* ok, do the main job */ err = snd_emu10k1_gpr_peek(emu, icode); @@ -916,7 +918,7 @@ static int snd_emu10k1_icode_peek(struct snd_emu10k1 *emu, err = snd_emu10k1_code_peek(emu, icode); if (err >= 0) err = snd_emu10k1_list_controls(emu, icode); - up(&emu->fx8010.lock); + mutex_unlock(&emu->fx8010.lock); return err; } @@ -932,7 +934,7 @@ static int snd_emu10k1_ipcm_poke(struct snd_emu10k1 *emu, if (ipcm->channels > 32) return -EINVAL; pcm = &emu->fx8010.pcm[ipcm->substream]; - down(&emu->fx8010.lock); + mutex_lock(&emu->fx8010.lock); spin_lock_irq(&emu->reg_lock); if (pcm->opened) { err = -EBUSY; @@ -962,7 +964,7 @@ static int snd_emu10k1_ipcm_poke(struct snd_emu10k1 *emu, } __error: spin_unlock_irq(&emu->reg_lock); - up(&emu->fx8010.lock); + mutex_unlock(&emu->fx8010.lock); return err; } @@ -976,7 +978,7 @@ static int snd_emu10k1_ipcm_peek(struct snd_emu10k1 *emu, if (ipcm->substream >= EMU10K1_FX8010_PCM_COUNT) return -EINVAL; pcm = &emu->fx8010.pcm[ipcm->substream]; - down(&emu->fx8010.lock); + mutex_lock(&emu->fx8010.lock); spin_lock_irq(&emu->reg_lock); ipcm->channels = pcm->channels; ipcm->tram_start = pcm->tram_start; @@ -992,7 +994,7 @@ static int snd_emu10k1_ipcm_peek(struct snd_emu10k1 *emu, ipcm->res1 = ipcm->res2 = 0; ipcm->pad = 0; spin_unlock_irq(&emu->reg_lock); - up(&emu->fx8010.lock); + mutex_unlock(&emu->fx8010.lock); return err; } @@ -2308,9 +2310,9 @@ static int snd_emu10k1_fx8010_ioctl(struct snd_hwdep * hw, struct file *file, un return -EPERM; if (get_user(addr, (unsigned int __user *)argp)) return -EFAULT; - down(&emu->fx8010.lock); + mutex_lock(&emu->fx8010.lock); res = snd_emu10k1_fx8010_tram_setup(emu, addr); - up(&emu->fx8010.lock); + mutex_unlock(&emu->fx8010.lock); return res; case SNDRV_EMU10K1_IOCTL_STOP: if (!capable(CAP_SYS_ADMIN)) diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c index 68c795c03109..e7ec98649f04 100644 --- a/sound/pci/emu10k1/memory.c +++ b/sound/pci/emu10k1/memory.c @@ -24,6 +24,8 @@ #include <sound/driver.h> #include <linux/pci.h> #include <linux/time.h> +#include <linux/mutex.h> + #include <sound/core.h> #include <sound/emu10k1.h> @@ -302,10 +304,10 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst hdr = emu->memhdr; snd_assert(hdr, return NULL); - down(&hdr->block_mutex); + mutex_lock(&hdr->block_mutex); blk = search_empty(emu, runtime->dma_bytes); if (blk == NULL) { - up(&hdr->block_mutex); + mutex_unlock(&hdr->block_mutex); return NULL; } /* fill buffer addresses but pointers are not stored so that @@ -318,14 +320,14 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst if (idx >= sgbuf->pages) { printk(KERN_ERR "emu: pages overflow! (%d-%d) for %d\n", blk->first_page, blk->last_page, sgbuf->pages); - up(&hdr->block_mutex); + mutex_unlock(&hdr->block_mutex); return NULL; } #endif addr = sgbuf->table[idx].addr; if (! is_valid_page(emu, addr)) { printk(KERN_ERR "emu: failure page = %d\n", idx); - up(&hdr->block_mutex); + mutex_unlock(&hdr->block_mutex); return NULL; } emu->page_addr_table[page] = addr; @@ -337,10 +339,10 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst err = snd_emu10k1_memblk_map(emu, blk); if (err < 0) { __snd_util_mem_free(hdr, (struct snd_util_memblk *)blk); - up(&hdr->block_mutex); + mutex_unlock(&hdr->block_mutex); return NULL; } - up(&hdr->block_mutex); + mutex_unlock(&hdr->block_mutex); return (struct snd_util_memblk *)blk; } @@ -369,19 +371,19 @@ snd_emu10k1_synth_alloc(struct snd_emu10k1 *hw, unsigned int size) struct snd_emu10k1_memblk *blk; struct snd_util_memhdr *hdr = hw->memhdr; - down(&hdr->block_mutex); + mutex_lock(&hdr->block_mutex); blk = (struct snd_emu10k1_memblk *)__snd_util_mem_alloc(hdr, size); if (blk == NULL) { - up(&hdr->block_mutex); + mutex_unlock(&hdr->block_mutex); return NULL; } if (synth_alloc_pages(hw, blk)) { __snd_util_mem_free(hdr, (struct snd_util_memblk *)blk); - up(&hdr->block_mutex); + mutex_unlock(&hdr->block_mutex); return NULL; } snd_emu10k1_memblk_map(hw, blk); - up(&hdr->block_mutex); + mutex_unlock(&hdr->block_mutex); return (struct snd_util_memblk *)blk; } @@ -396,14 +398,14 @@ snd_emu10k1_synth_free(struct snd_emu10k1 *emu, struct snd_util_memblk *memblk) struct snd_emu10k1_memblk *blk = (struct snd_emu10k1_memblk *)memblk; unsigned long flags; - down(&hdr->block_mutex); + mutex_lock(&hdr->block_mutex); spin_lock_irqsave(&emu->memblk_lock, flags); if (blk->mapped_page >= 0) unmap_memblk(emu, blk); spin_unlock_irqrestore(&emu->memblk_lock, flags); synth_free_pages(emu, blk); __snd_util_mem_free(hdr, memblk); - up(&hdr->block_mutex); + mutex_unlock(&hdr->block_mutex); return 0; } |