[ALSA] semaphore -> mutex (ISA part)
authorIngo Molnar <mingo@elte.hu>
Mon, 16 Jan 2006 15:33:08 +0000 (16:33 +0100)
committerJaroslav Kysela <perex@suse.cz>
Wed, 22 Mar 2006 09:25:03 +0000 (10:25 +0100)
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>
12 files changed:
include/sound/ad1848.h
include/sound/cs4231.h
include/sound/gus.h
include/sound/sb16_csp.h
sound/isa/ad1848/ad1848_lib.c
sound/isa/cs423x/cs4231_lib.c
sound/isa/cs423x/cs4236_lib.c
sound/isa/gus/gus_dma.c
sound/isa/gus/gus_main.c
sound/isa/gus/gus_mem.c
sound/isa/gus/gus_synth.c
sound/isa/sb/sb16_csp.c

index 1a2759f3a292b66d9bbc2f21514cd9a92d23e80a..57af1fe7b30998327847ac1cff7c003ac5ef407c 100644 (file)
@@ -154,7 +154,7 @@ struct snd_ad1848 {
 #endif
 
        spinlock_t reg_lock;
-       struct semaphore open_mutex;
+       struct mutex open_mutex;
 };
 
 /* exported functions */
index ac6a5d8820888c1926c92c052c74add01c3f30a3..60b5b92a131985a6a62da67ee07afc3491665f53 100644 (file)
@@ -248,8 +248,8 @@ struct snd_cs4231 {
        unsigned int c_dma_size;
 
        spinlock_t reg_lock;
-       struct semaphore mce_mutex;
-       struct semaphore open_mutex;
+       struct mutex mce_mutex;
+       struct mutex open_mutex;
 
        int (*rate_constraint) (struct snd_pcm_runtime *runtime);
        void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr);
index 63da50fae7733e025206cb4968045f970e75df44..68a664ab97f391e18eb55922952c31993cf51ecc 100644 (file)
@@ -209,7 +209,7 @@ struct snd_gf1_mem {
        struct snd_gf1_bank_info banks_16[4];
        struct snd_gf1_mem_block *first;
        struct snd_gf1_mem_block *last;
-       struct semaphore memory_mutex;
+       struct mutex memory_mutex;
 };
 
 struct snd_gf1_dma_block {
@@ -467,8 +467,8 @@ struct snd_gus_card {
        spinlock_t dma_lock;
        spinlock_t pcm_volume_level_lock;
        spinlock_t uart_cmd_lock;
-       struct semaphore dma_mutex;
-       struct semaphore register_mutex;
+       struct mutex dma_mutex;
+       struct mutex register_mutex;
 };
 
 /* I/O functions for GF1/InterWave chip - gus_io.c */
index 3b44d4b370f5fe2fd6eb3108c5eab67fba7e1f06..caf6fe21514dca62c1005a1ee9cc79210f545b35 100644 (file)
@@ -158,7 +158,7 @@ struct snd_sb_csp {
        struct snd_kcontrol *qsound_switch;
        struct snd_kcontrol *qsound_space;
 
-       struct semaphore access_mutex;  /* locking */
+       struct mutex access_mutex;      /* locking */
 };
 
 int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
index b78530d7ea90c984309908a5c36b8fd36e6178ed..d4b0e580557ede576820ecfe9f429f2121e0043c 100644 (file)
@@ -387,9 +387,9 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode)
 {
        unsigned long flags;
 
-       down(&chip->open_mutex);
+       mutex_lock(&chip->open_mutex);
        if (chip->mode & AD1848_MODE_OPEN) {
-               up(&chip->open_mutex);
+               mutex_unlock(&chip->open_mutex);
                return -EAGAIN;
        }
        snd_ad1848_mce_down(chip);
@@ -432,7 +432,7 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode)
        spin_unlock_irqrestore(&chip->reg_lock, flags);
 
        chip->mode = mode;
-       up(&chip->open_mutex);
+       mutex_unlock(&chip->open_mutex);
 
        return 0;
 }
@@ -441,9 +441,9 @@ static void snd_ad1848_close(struct snd_ad1848 *chip)
 {
        unsigned long flags;
 
-       down(&chip->open_mutex);
+       mutex_lock(&chip->open_mutex);
        if (!chip->mode) {
-               up(&chip->open_mutex);
+               mutex_unlock(&chip->open_mutex);
                return;
        }
        /* disable IRQ */
@@ -471,7 +471,7 @@ static void snd_ad1848_close(struct snd_ad1848 *chip)
        spin_unlock_irqrestore(&chip->reg_lock, flags);
 
        chip->mode = 0;
-       up(&chip->open_mutex);
+       mutex_unlock(&chip->open_mutex);
 }
 
 /*
@@ -889,7 +889,7 @@ int snd_ad1848_create(struct snd_card *card,
        if (chip == NULL)
                return -ENOMEM;
        spin_lock_init(&chip->reg_lock);
-       init_MUTEX(&chip->open_mutex);
+       mutex_init(&chip->open_mutex);
        chip->card = card;
        chip->port = port;
        chip->irq = -1;
index eab7eb59b5f73eb0c544ad6821e7c61537c6056c..823db8246701933d8837f4ddbcff3e505052f52e 100644 (file)
@@ -531,7 +531,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip,
        unsigned long flags;
        int full_calib = 1;
 
-       down(&chip->mce_mutex);
+       mutex_lock(&chip->mce_mutex);
        snd_cs4231_calibrate_mute(chip, 1);
        if (chip->hardware == CS4231_HW_CS4231A ||
            (chip->hardware & CS4231_HW_CS4232_MASK)) {
@@ -560,7 +560,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip,
                snd_cs4231_mce_down(chip);
        }
        snd_cs4231_calibrate_mute(chip, 0);
-       up(&chip->mce_mutex);
+       mutex_unlock(&chip->mce_mutex);
 }
 
 static void snd_cs4231_capture_format(struct snd_cs4231 *chip,
@@ -570,7 +570,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip,
        unsigned long flags;
        int full_calib = 1;
 
-       down(&chip->mce_mutex);
+       mutex_lock(&chip->mce_mutex);
        snd_cs4231_calibrate_mute(chip, 1);
        if (chip->hardware == CS4231_HW_CS4231A ||
            (chip->hardware & CS4231_HW_CS4232_MASK)) {
@@ -603,7 +603,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip,
                snd_cs4231_mce_down(chip);
        }
        snd_cs4231_calibrate_mute(chip, 0);
-       up(&chip->mce_mutex);
+       mutex_unlock(&chip->mce_mutex);
 }
 
 /*
@@ -709,15 +709,15 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode)
 {
        unsigned long flags;
 
-       down(&chip->open_mutex);
+       mutex_lock(&chip->open_mutex);
        if ((chip->mode & mode) ||
            ((chip->mode & CS4231_MODE_OPEN) && chip->single_dma)) {
-               up(&chip->open_mutex);
+               mutex_unlock(&chip->open_mutex);
                return -EAGAIN;
        }
        if (chip->mode & CS4231_MODE_OPEN) {
                chip->mode |= mode;
-               up(&chip->open_mutex);
+               mutex_unlock(&chip->open_mutex);
                return 0;
        }
        /* ok. now enable and ack CODEC IRQ */
@@ -737,7 +737,7 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode)
        spin_unlock_irqrestore(&chip->reg_lock, flags);
 
        chip->mode = mode;
-       up(&chip->open_mutex);
+       mutex_unlock(&chip->open_mutex);
        return 0;
 }
 
@@ -745,10 +745,10 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode)
 {
        unsigned long flags;
 
-       down(&chip->open_mutex);
+       mutex_lock(&chip->open_mutex);
        chip->mode &= ~mode;
        if (chip->mode & CS4231_MODE_OPEN) {
-               up(&chip->open_mutex);
+               mutex_unlock(&chip->open_mutex);
                return;
        }
        snd_cs4231_calibrate_mute(chip, 1);
@@ -785,7 +785,7 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode)
        snd_cs4231_calibrate_mute(chip, 0);
 
        chip->mode = 0;
-       up(&chip->open_mutex);
+       mutex_unlock(&chip->open_mutex);
 }
 
 /*
@@ -1408,8 +1408,8 @@ static int snd_cs4231_new(struct snd_card *card,
        chip->hwshare = hwshare;
 
        spin_lock_init(&chip->reg_lock);
-       init_MUTEX(&chip->mce_mutex);
-       init_MUTEX(&chip->open_mutex);
+       mutex_init(&chip->mce_mutex);
+       mutex_init(&chip->open_mutex);
        chip->card = card;
        chip->rate_constraint = snd_cs4231_xrate;
        chip->set_playback_format = snd_cs4231_playback_format;
@@ -1538,8 +1538,8 @@ int snd_cs4231_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm)
                return err;
 
        spin_lock_init(&chip->reg_lock);
-       init_MUTEX(&chip->mce_mutex);
-       init_MUTEX(&chip->open_mutex);
+       mutex_init(&chip->mce_mutex);
+       mutex_init(&chip->open_mutex);
 
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cs4231_playback_ops);
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cs4231_capture_ops);
index e36981d64ec5d2aedc43a7b5ddccf4100ec77f42..1125ddb2b1aa8219756fd20447e305b0cbd4b56c 100644 (file)
@@ -841,7 +841,7 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
        
        enable = ucontrol->value.integer.value[0] & 1;
 
-       down(&chip->mce_mutex);
+       mutex_lock(&chip->mce_mutex);
        snd_cs4231_mce_up(chip);
        spin_lock_irqsave(&chip->reg_lock, flags);
        val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1);
@@ -854,7 +854,7 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
        snd_cs4236_ctrl_out(chip, 4, val);
        spin_unlock_irqrestore(&chip->reg_lock, flags);
        snd_cs4231_mce_down(chip);
-       up(&chip->mce_mutex);
+       mutex_unlock(&chip->mce_mutex);
 
 #if 0
        printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
index 930f4bc56f34c44a4a1de70d975761b1d83fed15..44ee5d3674a1691b2d4f6803f2ca3d8a474e562a 100644 (file)
@@ -149,10 +149,10 @@ static void snd_gf1_dma_interrupt(struct snd_gus_card * gus)
 
 int snd_gf1_dma_init(struct snd_gus_card * gus)
 {
-       down(&gus->dma_mutex);
+       mutex_lock(&gus->dma_mutex);
        gus->gf1.dma_shared++;
        if (gus->gf1.dma_shared > 1) {
-               up(&gus->dma_mutex);
+               mutex_unlock(&gus->dma_mutex);
                return 0;
        }
        gus->gf1.interrupt_handler_dma_write = snd_gf1_dma_interrupt;
@@ -160,7 +160,7 @@ int snd_gf1_dma_init(struct snd_gus_card * gus)
        gus->gf1.dma_data_pcm_last =
        gus->gf1.dma_data_synth = 
        gus->gf1.dma_data_synth_last = NULL;
-       up(&gus->dma_mutex);
+       mutex_unlock(&gus->dma_mutex);
        return 0;
 }
 
@@ -168,7 +168,7 @@ int snd_gf1_dma_done(struct snd_gus_card * gus)
 {
        struct snd_gf1_dma_block *block;
 
-       down(&gus->dma_mutex);
+       mutex_lock(&gus->dma_mutex);
        gus->gf1.dma_shared--;
        if (!gus->gf1.dma_shared) {
                snd_dma_disable(gus->gf1.dma1);
@@ -185,7 +185,7 @@ int snd_gf1_dma_done(struct snd_gus_card * gus)
                gus->gf1.dma_data_pcm_last =
                gus->gf1.dma_data_synth_last = NULL;
        }
-       up(&gus->dma_mutex);
+       mutex_unlock(&gus->dma_mutex);
        return 0;
 }
 
index 6d15b3d18a8752b1550b40da5977d1c855883ba5..53eeaf37007d15a79ce443d17dc2fc11af6bfeb6 100644 (file)
@@ -225,7 +225,7 @@ int snd_gus_create(struct snd_card *card,
        spin_lock_init(&gus->dma_lock);
        spin_lock_init(&gus->pcm_volume_level_lock);
        spin_lock_init(&gus->uart_cmd_lock);
-       init_MUTEX(&gus->dma_mutex);
+       mutex_init(&gus->dma_mutex);
        if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, gus, &ops)) < 0) {
                snd_gus_free(gus);
                return err;
index e8bdb860a19fc03278e928a8621677eea801f7a1..3c0d27aa08b306a34ad40fc41b470f086b0bc62e 100644 (file)
@@ -34,9 +34,9 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
 void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup)
 {
        if (!xup) {
-               down(&alloc->memory_mutex);
+               mutex_lock(&alloc->memory_mutex);
        } else {
-               up(&alloc->memory_mutex);
+               mutex_unlock(&alloc->memory_mutex);
        }
 }
 
@@ -59,7 +59,7 @@ static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc,
                                alloc->first = nblock;
                        else
                                nblock->prev->next = nblock;
-                       up(&alloc->memory_mutex);
+                       mutex_unlock(&alloc->memory_mutex);
                        return NULL;
                }
                pblock = pblock->next;
@@ -80,7 +80,7 @@ int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * blo
 {
        if (block->share) {     /* ok.. shared block */
                block->share--;
-               up(&alloc->memory_mutex);
+               mutex_unlock(&alloc->memory_mutex);
                return 0;
        }
        if (alloc->first == block) {
@@ -244,7 +244,7 @@ int snd_gf1_mem_init(struct snd_gus_card * gus)
 #endif
 
        alloc = &gus->gf1.mem_alloc;
-       init_MUTEX(&alloc->memory_mutex);
+       mutex_init(&alloc->memory_mutex);
        alloc->first = alloc->last = NULL;
        if (!gus->gf1.memory)
                return 0;
@@ -299,7 +299,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
 
        gus = entry->private_data;
        alloc = &gus->gf1.mem_alloc;
-       down(&alloc->memory_mutex);
+       mutex_lock(&alloc->memory_mutex);
        snd_iprintf(buffer, "8-bit banks       : \n    ");
        for (i = 0; i < 4; i++)
                snd_iprintf(buffer, "0x%06x (%04ik)%s", alloc->banks_8[i].address, alloc->banks_8[i].size >> 10, i + 1 < 4 ? "," : "");
@@ -343,7 +343,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
        }
        snd_iprintf(buffer, "  Total: memory = %i, used = %i, free = %i\n",
                    total, used, total - used);
-       up(&alloc->memory_mutex);
+       mutex_unlock(&alloc->memory_mutex);
 #if 0
        ultra_iprintf(buffer, "  Verify: free = %i, max 8-bit block = %i, max 16-bit block = %i\n",
                      ultra_memory_free_size(card, &card->gf1.mem_alloc),
index 85a1b051f09a4f1010d61a1fce26236f4fab4719..2767cc187ae39ead9a75ec865c098c1552091cad 100644 (file)
@@ -55,9 +55,9 @@ static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe *
 
        if (info->voices > 32)
                return -EINVAL;
-       down(&gus->register_mutex);
+       mutex_lock(&gus->register_mutex);
        if (!snd_gus_use_inc(gus)) {
-               up(&gus->register_mutex);
+               mutex_unlock(&gus->register_mutex);
                return -EFAULT;
        }
        for (idx = 0; idx < info->voices; idx++) {
@@ -65,12 +65,12 @@ static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe *
                if (voice == NULL) {
                        snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port);
                        snd_gus_use_dec(gus);
-                       up(&gus->register_mutex);
+                       mutex_unlock(&gus->register_mutex);
                        return -EBUSY;
                }
                voice->index = idx;
        }
-       up(&gus->register_mutex);
+       mutex_unlock(&gus->register_mutex);
        return 0;
 }
 
@@ -79,10 +79,10 @@ static int snd_gus_synth_unuse(void *private_data, struct snd_seq_port_subscribe
        struct snd_gus_port * port = private_data;
        struct snd_gus_card * gus = port->gus;
 
-       down(&gus->register_mutex);
+       mutex_lock(&gus->register_mutex);
        snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port);
        snd_gus_use_dec(gus);
-       up(&gus->register_mutex);
+       mutex_unlock(&gus->register_mutex);
        return 0;
 }
 
@@ -223,7 +223,7 @@ static int snd_gus_synth_new_device(struct snd_seq_device *dev)
        if (gus == NULL)
                return -EINVAL;
 
-       init_MUTEX(&gus->register_mutex);
+       mutex_init(&gus->register_mutex);
        gus->gf1.seq_client = -1;
        
        /* allocate new client */
index 9c2b5efbacbf518035e55d2f6895b280cc101766..9703c68e4e0803e5c7fe0259b7ec7cff8d46604b 100644 (file)
@@ -138,7 +138,7 @@ int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep)
        p->ops.csp_stop = snd_sb_csp_stop;
        p->ops.csp_qsound_transfer = snd_sb_csp_qsound_transfer;
 
-       init_MUTEX(&p->access_mutex);
+       mutex_init(&p->access_mutex);
        sprintf(hw->name, "CSP v%d.%d", (version >> 4), (version & 0x0f));
        hw->iface = SNDRV_HWDEP_IFACE_SB16CSP;
        hw->private_data = p;
@@ -265,13 +265,13 @@ static int snd_sb_csp_release(struct snd_hwdep * hw, struct file *file)
  */
 static int snd_sb_csp_use(struct snd_sb_csp * p)
 {
-       down(&p->access_mutex);
+       mutex_lock(&p->access_mutex);
        if (p->used) {
-               up(&p->access_mutex);
+               mutex_unlock(&p->access_mutex);
                return -EAGAIN;
        }
        p->used++;
-       up(&p->access_mutex);
+       mutex_unlock(&p->access_mutex);
 
        return 0;
 
@@ -282,9 +282,9 @@ static int snd_sb_csp_use(struct snd_sb_csp * p)
  */
 static int snd_sb_csp_unuse(struct snd_sb_csp * p)
 {
-       down(&p->access_mutex);
+       mutex_lock(&p->access_mutex);
        p->used--;
-       up(&p->access_mutex);
+       mutex_unlock(&p->access_mutex);
 
        return 0;
 }