]> err.no Git - linux-2.6/commitdiff
[ALSA] semaphore -> mutex (driver part)
authorIngo Molnar <mingo@elte.hu>
Mon, 16 Jan 2006 15:31:42 +0000 (16:31 +0100)
committerJaroslav Kysela <perex@suse.cz>
Wed, 22 Mar 2006 09:24:57 +0000 (10:24 +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>
22 files changed:
include/sound/emux_synth.h
include/sound/i2c.h
include/sound/opl3.h
include/sound/soundfont.h
include/sound/util_mem.h
include/sound/vx_core.h
sound/drivers/opl3/opl3_lib.c
sound/drivers/opl3/opl3_seq.c
sound/drivers/opl3/opl3_synth.c
sound/drivers/opl4/opl4_lib.c
sound/drivers/opl4/opl4_local.h
sound/drivers/opl4/opl4_proc.c
sound/drivers/opl4/opl4_seq.c
sound/drivers/vx/vx_core.c
sound/drivers/vx/vx_mixer.c
sound/i2c/i2c.c
sound/synth/emux/emux.c
sound/synth/emux/emux_oss.c
sound/synth/emux/emux_proc.c
sound/synth/emux/emux_seq.c
sound/synth/emux/soundfont.c
sound/synth/util_mem.c

index b2d6b2acc7c7dd1350a7b511691aec9233fbf170..d8cb51b86c20c1347e0281a0c45b4c99b4206439 100644 (file)
@@ -113,7 +113,7 @@ struct snd_emux {
        struct snd_emux_voice *voices;  /* Voices (EMU 'channel') */
        int use_time;   /* allocation counter */
        spinlock_t voice_lock;  /* Lock for voice access */
-       struct semaphore register_mutex;
+       struct mutex register_mutex;
        int client;             /* For the sequencer client */
        int ports[SNDRV_EMUX_MAX_PORTS];        /* The ports for this device */
        struct snd_emux_port *portptrs[SNDRV_EMUX_MAX_PORTS];
index 81eb23ed761fa1490eaf6a620d8eaa479820f282..d125ff8c85e851888b82fee527d9aebb004bed6b 100644 (file)
@@ -55,7 +55,7 @@ struct snd_i2c_bus {
        struct snd_card *card;  /* card which I2C belongs to */
        char name[32];          /* some useful label */
 
-       struct semaphore lock_mutex;
+       struct mutex lock_mutex;
 
        struct snd_i2c_bus *master;     /* master bus when SCK/SCL is shared */
        struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */
@@ -84,17 +84,17 @@ int snd_i2c_device_free(struct snd_i2c_device *device);
 static inline void snd_i2c_lock(struct snd_i2c_bus *bus)
 {
        if (bus->master)
-               down(&bus->master->lock_mutex);
+               mutex_lock(&bus->master->lock_mutex);
        else
-               down(&bus->lock_mutex);
+               mutex_lock(&bus->lock_mutex);
 }
 
 static inline void snd_i2c_unlock(struct snd_i2c_bus *bus)
 {
        if (bus->master)
-               up(&bus->master->lock_mutex);
+               mutex_unlock(&bus->master->lock_mutex);
        else
-               up(&bus->lock_mutex);
+               mutex_unlock(&bus->lock_mutex);
 }
 
 int snd_i2c_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count);
index 83392641cb474546763cbfe3c0ea7301c36be381..444907166f9796766eb79ce35e45aa1ee77f92dd 100644 (file)
@@ -53,6 +53,7 @@
 
 #include "driver.h"
 #include <linux/time.h>
+#include <linux/mutex.h>
 #include "core.h"
 #include "hwdep.h"
 #include "timer.h"
@@ -312,7 +313,7 @@ struct snd_opl3 {
        int sys_timer_status;           /* system timer run status */
        spinlock_t sys_timer_lock;      /* Lock for system timer access */
 #endif
-       struct semaphore access_mutex;  /* locking */
+       struct mutex access_mutex;      /* locking */
 };
 
 /* opl3.c */
index 61a010c65d0278d4c82711b7f6651b7204de6168..f95d99ba7f7473028b497932cda5493805f0b6c0 100644 (file)
@@ -93,7 +93,7 @@ struct snd_sf_list {
        int sample_locked;      /* locked time for sample */
        struct snd_sf_callback callback;        /* callback functions */
        int presets_locked;
-       struct semaphore presets_mutex;
+       struct mutex presets_mutex;
        spinlock_t lock;
        struct snd_util_memhdr *memhdr;
 };
index 69944bbb5445fb9476af87e40e5e2285b6e21733..a1fb706b59a6ec2855fefb8fa4b6596c9aeda2ff 100644 (file)
@@ -1,5 +1,7 @@
 #ifndef __SOUND_UTIL_MEM_H
 #define __SOUND_UTIL_MEM_H
+
+#include <linux/mutex.h>
 /*
  *  Copyright (C) 2000 Takashi Iwai <tiwai@suse.de>
  *
@@ -40,7 +42,7 @@ struct snd_util_memhdr {
        int nblocks;                    /* # of allocated blocks */
        unsigned int used;              /* used memory size */
        int block_extra_size;           /* extra data size of chunk */
-       struct semaphore block_mutex;   /* lock */
+       struct mutex block_mutex;       /* lock */
 };
 
 /*
index 5fd6f3305e0d38de164bc9621a50d5c0c58a8ff1..9821a6194caae33ebb72dabe803a83a0b6b91e15 100644 (file)
@@ -206,7 +206,7 @@ struct vx_core {
        int audio_monitor[4];                   /* playback hw-monitor level */
        unsigned char audio_monitor_active[4];  /* playback hw-monitor mute/unmute */
 
-       struct semaphore mixer_mutex;
+       struct mutex mixer_mutex;
 
        const struct firmware *firmware[4]; /* loaded firmware data */
 };
index 1e0c76b9acfc93fb2cac57ae0c150090ebfb1f1e..4f85569767742be4c4e090d5f353e685120939a9 100644 (file)
@@ -358,7 +358,7 @@ int snd_opl3_new(struct snd_card *card,
        opl3->hardware = hardware;
        spin_lock_init(&opl3->reg_lock);
        spin_lock_init(&opl3->timer_lock);
-       init_MUTEX(&opl3->access_mutex);
+       mutex_init(&opl3->access_mutex);
 
        if ((err = snd_device_new(card, SNDRV_DEV_CODEC, opl3, &ops)) < 0) {
                snd_opl3_free(opl3);
index c4ead790008a32ac66c3b35eff538f6dabae1fa8..e26556d500e599efef4a075a5d923a87b79fa539 100644 (file)
@@ -52,13 +52,13 @@ int snd_opl3_synth_setup(struct snd_opl3 * opl3)
 {
        int idx;
 
-       down(&opl3->access_mutex);
+       mutex_lock(&opl3->access_mutex);
        if (opl3->used) {
-               up(&opl3->access_mutex);
+               mutex_unlock(&opl3->access_mutex);
                return -EBUSY;
        }
        opl3->used++;
-       up(&opl3->access_mutex);
+       mutex_unlock(&opl3->access_mutex);
 
        snd_opl3_reset(opl3);
 
@@ -91,9 +91,9 @@ void snd_opl3_synth_cleanup(struct snd_opl3 * opl3)
        spin_unlock_irqrestore(&opl3->sys_timer_lock, flags);
 
        snd_opl3_reset(opl3);
-       down(&opl3->access_mutex);
+       mutex_lock(&opl3->access_mutex);
        opl3->used--;
-       up(&opl3->access_mutex);
+       mutex_unlock(&opl3->access_mutex);
 }
 
 static int snd_opl3_synth_use(void *private_data, struct snd_seq_port_subscribe * info)
index 3534a0e3342a9168da851e16d3a323f73465572f..6db503f025b3a79ca5f3c44148fb04e9b3b8ecc2 100644 (file)
@@ -76,13 +76,13 @@ int snd_opl3_open(struct snd_hwdep * hw, struct file *file)
 {
        struct snd_opl3 *opl3 = hw->private_data;
 
-       down(&opl3->access_mutex);
+       mutex_lock(&opl3->access_mutex);
        if (opl3->used) {
-               up(&opl3->access_mutex);
+               mutex_unlock(&opl3->access_mutex);
                return -EAGAIN;
        }
        opl3->used++;
-       up(&opl3->access_mutex);
+       mutex_unlock(&opl3->access_mutex);
 
        return 0;
 }
@@ -179,9 +179,9 @@ int snd_opl3_release(struct snd_hwdep * hw, struct file *file)
        struct snd_opl3 *opl3 = hw->private_data;
 
        snd_opl3_reset(opl3);
-       down(&opl3->access_mutex);
+       mutex_lock(&opl3->access_mutex);
        opl3->used--;
-       up(&opl3->access_mutex);
+       mutex_unlock(&opl3->access_mutex);
 
        return 0;
 }
index ddfc10d04be2ee44357114751a97b584b968e3a7..4bc860ae02deecb655b87946ec87ceee54ecfe10 100644 (file)
@@ -214,7 +214,7 @@ int snd_opl4_create(struct snd_card *card,
        opl4->fm_port = fm_port;
        opl4->pcm_port = pcm_port;
        spin_lock_init(&opl4->reg_lock);
-       init_MUTEX(&opl4->access_mutex);
+       mutex_init(&opl4->access_mutex);
 
        err = snd_opl4_detect(opl4);
        if (err < 0) {
index 7e088a4a2f4c5603ceacdf47468657664a94f2ce..470e5a758a0236d4c1604daeb2645fa23a328f83 100644 (file)
@@ -182,7 +182,7 @@ struct snd_opl4 {
        struct snd_info_entry *proc_entry;
        int memory_access;
 #endif
-       struct semaphore access_mutex;
+       struct mutex access_mutex;
 
 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
        int used;
index f4b4e74fcc18564acc2fdf8f5af9d91a90a8b2b0..e552ec34166fed892e7043e18e8f96e6b84c0620 100644 (file)
@@ -28,13 +28,13 @@ static int snd_opl4_mem_proc_open(struct snd_info_entry *entry,
 {
        struct snd_opl4 *opl4 = entry->private_data;
 
-       down(&opl4->access_mutex);
+       mutex_lock(&opl4->access_mutex);
        if (opl4->memory_access) {
-               up(&opl4->access_mutex);
+               mutex_unlock(&opl4->access_mutex);
                return -EBUSY;
        }
        opl4->memory_access++;
-       up(&opl4->access_mutex);
+       mutex_unlock(&opl4->access_mutex);
        return 0;
 }
 
@@ -43,9 +43,9 @@ static int snd_opl4_mem_proc_release(struct snd_info_entry *entry,
 {
        struct snd_opl4 *opl4 = entry->private_data;
 
-       down(&opl4->access_mutex);
+       mutex_lock(&opl4->access_mutex);
        opl4->memory_access--;
-       up(&opl4->access_mutex);
+       mutex_unlock(&opl4->access_mutex);
        return 0;
 }
 
index e3480326e735a115916a1490627e08d9574edade..dc0dcdc6c3139e0fa7a58dd05f407da62f4ba2aa 100644 (file)
@@ -62,10 +62,10 @@ static int snd_opl4_seq_use(void *private_data, struct snd_seq_port_subscribe *i
        struct snd_opl4 *opl4 = private_data;
        int err;
 
-       down(&opl4->access_mutex);
+       mutex_lock(&opl4->access_mutex);
 
        if (opl4->used) {
-               up(&opl4->access_mutex);
+               mutex_unlock(&opl4->access_mutex);
                return -EBUSY;
        }
        opl4->used++;
@@ -73,12 +73,12 @@ static int snd_opl4_seq_use(void *private_data, struct snd_seq_port_subscribe *i
        if (info->sender.client != SNDRV_SEQ_CLIENT_SYSTEM) {
                err = snd_opl4_seq_use_inc(opl4);
                if (err < 0) {
-                       up(&opl4->access_mutex);
+                       mutex_unlock(&opl4->access_mutex);
                        return err;
                }
        }
 
-       up(&opl4->access_mutex);
+       mutex_unlock(&opl4->access_mutex);
 
        snd_opl4_synth_reset(opl4);
        return 0;
@@ -90,9 +90,9 @@ static int snd_opl4_seq_unuse(void *private_data, struct snd_seq_port_subscribe
 
        snd_opl4_synth_shutdown(opl4);
 
-       down(&opl4->access_mutex);
+       mutex_lock(&opl4->access_mutex);
        opl4->used--;
-       up(&opl4->access_mutex);
+       mutex_unlock(&opl4->access_mutex);
 
        if (info->sender.client != SNDRV_SEQ_CLIENT_SYSTEM)
                snd_opl4_seq_use_dec(opl4);
index 43f615d7a545ca4be36757157a091fbddc769003..fa4a2b5c2d8d19ea82f2ce0e70e2abf36c7f5003 100644 (file)
@@ -778,7 +778,7 @@ struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw,
        chip->type = hw->type;
        chip->ops = ops;
        tasklet_init(&chip->tq, vx_interrupt, (unsigned long)chip);
-       init_MUTEX(&chip->mixer_mutex);
+       mutex_init(&chip->mixer_mutex);
 
        chip->card = card;
        card->private_data = chip;
index 8ec2c605d2f05c24058438417e1454fc6e3dccac..c1d7fcdd1973ec54fba500d752cdf94d832f682f 100644 (file)
@@ -427,10 +427,10 @@ static int vx_output_level_get(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
 {
        struct vx_core *chip = snd_kcontrol_chip(kcontrol);
        int codec = kcontrol->id.index;
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        ucontrol->value.integer.value[0] = chip->output_level[codec][0];
        ucontrol->value.integer.value[1] = chip->output_level[codec][1];
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
        return 0;
 }
 
@@ -438,7 +438,7 @@ static int vx_output_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
 {
        struct vx_core *chip = snd_kcontrol_chip(kcontrol);
        int codec = kcontrol->id.index;
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        if (ucontrol->value.integer.value[0] != chip->output_level[codec][0] ||
            ucontrol->value.integer.value[1] != chip->output_level[codec][1]) {
                vx_set_analog_output_level(chip, codec,
@@ -446,10 +446,10 @@ static int vx_output_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
                                           ucontrol->value.integer.value[1]);
                chip->output_level[codec][0] = ucontrol->value.integer.value[0];
                chip->output_level[codec][1] = ucontrol->value.integer.value[1];
-               up(&chip->mixer_mutex);
+               mutex_unlock(&chip->mixer_mutex);
                return 1;
        }
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
        return 0;
 }
 
@@ -502,14 +502,14 @@ static int vx_audio_src_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
 static int vx_audio_src_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct vx_core *chip = snd_kcontrol_chip(kcontrol);
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        if (chip->audio_source_target != ucontrol->value.enumerated.item[0]) {
                chip->audio_source_target = ucontrol->value.enumerated.item[0];
                vx_sync_audio_source(chip);
-               up(&chip->mixer_mutex);
+               mutex_unlock(&chip->mixer_mutex);
                return 1;
        }
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
        return 0;
 }
 
@@ -550,14 +550,14 @@ static int vx_clock_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
 static int vx_clock_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct vx_core *chip = snd_kcontrol_chip(kcontrol);
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        if (chip->clock_mode != ucontrol->value.enumerated.item[0]) {
                chip->clock_mode = ucontrol->value.enumerated.item[0];
                vx_set_clock(chip, chip->freq);
-               up(&chip->mixer_mutex);
+               mutex_unlock(&chip->mixer_mutex);
                return 1;
        }
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
        return 0;
 }
 
@@ -587,10 +587,10 @@ static int vx_audio_gain_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
        int audio = kcontrol->private_value & 0xff;
        int capture = (kcontrol->private_value >> 8) & 1;
 
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        ucontrol->value.integer.value[0] = chip->audio_gain[capture][audio];
        ucontrol->value.integer.value[1] = chip->audio_gain[capture][audio+1];
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
        return 0;
 }
 
@@ -600,15 +600,15 @@ static int vx_audio_gain_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
        int audio = kcontrol->private_value & 0xff;
        int capture = (kcontrol->private_value >> 8) & 1;
 
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        if (ucontrol->value.integer.value[0] != chip->audio_gain[capture][audio] ||
            ucontrol->value.integer.value[1] != chip->audio_gain[capture][audio+1]) {
                vx_set_audio_gain(chip, audio, capture, ucontrol->value.integer.value[0]);
                vx_set_audio_gain(chip, audio+1, capture, ucontrol->value.integer.value[1]);
-               up(&chip->mixer_mutex);
+               mutex_unlock(&chip->mixer_mutex);
                return 1;
        }
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
        return 0;
 }
 
@@ -617,10 +617,10 @@ static int vx_audio_monitor_get(struct snd_kcontrol *kcontrol, struct snd_ctl_el
        struct vx_core *chip = snd_kcontrol_chip(kcontrol);
        int audio = kcontrol->private_value & 0xff;
 
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        ucontrol->value.integer.value[0] = chip->audio_monitor[audio];
        ucontrol->value.integer.value[1] = chip->audio_monitor[audio+1];
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
        return 0;
 }
 
@@ -629,17 +629,17 @@ static int vx_audio_monitor_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
        struct vx_core *chip = snd_kcontrol_chip(kcontrol);
        int audio = kcontrol->private_value & 0xff;
 
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        if (ucontrol->value.integer.value[0] != chip->audio_monitor[audio] ||
            ucontrol->value.integer.value[1] != chip->audio_monitor[audio+1]) {
                vx_set_monitor_level(chip, audio, ucontrol->value.integer.value[0],
                                     chip->audio_monitor_active[audio]);
                vx_set_monitor_level(chip, audio+1, ucontrol->value.integer.value[1],
                                     chip->audio_monitor_active[audio+1]);
-               up(&chip->mixer_mutex);
+               mutex_unlock(&chip->mixer_mutex);
                return 1;
        }
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
        return 0;
 }
 
@@ -657,10 +657,10 @@ static int vx_audio_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
        struct vx_core *chip = snd_kcontrol_chip(kcontrol);
        int audio = kcontrol->private_value & 0xff;
 
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        ucontrol->value.integer.value[0] = chip->audio_active[audio];
        ucontrol->value.integer.value[1] = chip->audio_active[audio+1];
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
        return 0;
 }
 
@@ -669,15 +669,15 @@ static int vx_audio_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_va
        struct vx_core *chip = snd_kcontrol_chip(kcontrol);
        int audio = kcontrol->private_value & 0xff;
 
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        if (ucontrol->value.integer.value[0] != chip->audio_active[audio] ||
            ucontrol->value.integer.value[1] != chip->audio_active[audio+1]) {
                vx_set_audio_switch(chip, audio, ucontrol->value.integer.value[0]);
                vx_set_audio_switch(chip, audio+1, ucontrol->value.integer.value[1]);
-               up(&chip->mixer_mutex);
+               mutex_unlock(&chip->mixer_mutex);
                return 1;
        }
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
        return 0;
 }
 
@@ -686,10 +686,10 @@ static int vx_monitor_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
        struct vx_core *chip = snd_kcontrol_chip(kcontrol);
        int audio = kcontrol->private_value & 0xff;
 
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        ucontrol->value.integer.value[0] = chip->audio_monitor_active[audio];
        ucontrol->value.integer.value[1] = chip->audio_monitor_active[audio+1];
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
        return 0;
 }
 
@@ -698,17 +698,17 @@ static int vx_monitor_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
        struct vx_core *chip = snd_kcontrol_chip(kcontrol);
        int audio = kcontrol->private_value & 0xff;
 
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        if (ucontrol->value.integer.value[0] != chip->audio_monitor_active[audio] ||
            ucontrol->value.integer.value[1] != chip->audio_monitor_active[audio+1]) {
                vx_set_monitor_level(chip, audio, chip->audio_monitor[audio],
                                     ucontrol->value.integer.value[0]);
                vx_set_monitor_level(chip, audio+1, chip->audio_monitor[audio+1],
                                     ucontrol->value.integer.value[1]);
-               up(&chip->mixer_mutex);
+               mutex_unlock(&chip->mixer_mutex);
                return 1;
        }
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
        return 0;
 }
 
@@ -756,12 +756,12 @@ static int vx_iec958_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
 {
        struct vx_core *chip = snd_kcontrol_chip(kcontrol);
 
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        ucontrol->value.iec958.status[0] = (chip->uer_bits >> 0) & 0xff;
        ucontrol->value.iec958.status[1] = (chip->uer_bits >> 8) & 0xff;
        ucontrol->value.iec958.status[2] = (chip->uer_bits >> 16) & 0xff;
        ucontrol->value.iec958.status[3] = (chip->uer_bits >> 24) & 0xff;
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
         return 0;
 }
 
@@ -783,14 +783,14 @@ static int vx_iec958_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_valu
              (ucontrol->value.iec958.status[1] << 8) |
              (ucontrol->value.iec958.status[2] << 16) |
              (ucontrol->value.iec958.status[3] << 24);
-       down(&chip->mixer_mutex);
+       mutex_lock(&chip->mixer_mutex);
        if (chip->uer_bits != val) {
                chip->uer_bits = val;
                vx_set_iec958_status(chip, val);
-               up(&chip->mixer_mutex);
+               mutex_unlock(&chip->mixer_mutex);
                return 1;
        }
-       up(&chip->mixer_mutex);
+       mutex_unlock(&chip->mixer_mutex);
        return 0;
 }
 
index c4e1f2c23ced404a2202b83fc2ddbe0188869d7d..edfe76fb007461dc425acd8663e40d8193950174 100644 (file)
@@ -88,7 +88,7 @@ int snd_i2c_bus_create(struct snd_card *card, const char *name,
        bus = kzalloc(sizeof(*bus), GFP_KERNEL);
        if (bus == NULL)
                return -ENOMEM;
-       init_MUTEX(&bus->lock_mutex);
+       mutex_init(&bus->lock_mutex);
        INIT_LIST_HEAD(&bus->devices);
        INIT_LIST_HEAD(&bus->buses);
        bus->card = card;
index 7c8e328fae6274142c9253c7baf556af86e92792..fc733bbf4487319588c96e2678cde9292651cc2d 100644 (file)
@@ -45,7 +45,7 @@ int snd_emux_new(struct snd_emux **remu)
                return -ENOMEM;
 
        spin_lock_init(&emu->voice_lock);
-       init_MUTEX(&emu->register_mutex);
+       mutex_init(&emu->register_mutex);
 
        emu->client = -1;
 #ifdef CONFIG_SND_SEQUENCER_OSS
index dfbfcfbe5dd26ccbd4c6cda719bf7b51e849b3c9..3436816727c8190ff0f5e5960c38f62c7c01e886 100644 (file)
@@ -117,10 +117,10 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure)
        emu = closure;
        snd_assert(arg != NULL && emu != NULL, return -ENXIO);
 
-       down(&emu->register_mutex);
+       mutex_lock(&emu->register_mutex);
 
        if (!snd_emux_inc_count(emu)) {
-               up(&emu->register_mutex);
+               mutex_unlock(&emu->register_mutex);
                return -EFAULT;
        }
 
@@ -134,7 +134,7 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure)
        if (p == NULL) {
                snd_printk("can't create port\n");
                snd_emux_dec_count(emu);
-               up(&emu->register_mutex);
+               mutex_unlock(&emu->register_mutex);
                return -ENOMEM;
        }
 
@@ -148,7 +148,7 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure)
 
        snd_emux_reset_port(p);
 
-       up(&emu->register_mutex);
+       mutex_unlock(&emu->register_mutex);
        return 0;
 }
 
@@ -191,13 +191,13 @@ snd_emux_close_seq_oss(struct snd_seq_oss_arg *arg)
        emu = p->emu;
        snd_assert(emu != NULL, return -ENXIO);
 
-       down(&emu->register_mutex);
+       mutex_lock(&emu->register_mutex);
        snd_emux_sounds_off_all(p);
        snd_soundfont_close_check(emu->sflist, SF_CLIENT_NO(p->chset.port));
        snd_seq_event_port_detach(p->chset.client, p->chset.port);
        snd_emux_dec_count(emu);
 
-       up(&emu->register_mutex);
+       mutex_unlock(&emu->register_mutex);
        return 0;
 }
 
index a70a179f694739c8d2e995be39804f34eb4c657b..1ba68ce302793c411867a3d8a7bc0b26f837b7d0 100644 (file)
@@ -37,7 +37,7 @@ snd_emux_proc_info_read(struct snd_info_entry *entry,
        int i;
 
        emu = entry->private_data;
-       down(&emu->register_mutex);
+       mutex_lock(&emu->register_mutex);
        if (emu->name)
                snd_iprintf(buf, "Device: %s\n", emu->name);
        snd_iprintf(buf, "Ports: %d\n", emu->num_ports);
@@ -56,13 +56,13 @@ snd_emux_proc_info_read(struct snd_info_entry *entry,
                snd_iprintf(buf, "Memory Size: 0\n");
        }
        if (emu->sflist) {
-               down(&emu->sflist->presets_mutex);
+               mutex_lock(&emu->sflist->presets_mutex);
                snd_iprintf(buf, "SoundFonts: %d\n", emu->sflist->fonts_size);
                snd_iprintf(buf, "Instruments: %d\n", emu->sflist->zone_counter);
                snd_iprintf(buf, "Samples: %d\n", emu->sflist->sample_counter);
                snd_iprintf(buf, "Locked Instruments: %d\n", emu->sflist->zone_locked);
                snd_iprintf(buf, "Locked Samples: %d\n", emu->sflist->sample_locked);
-               up(&emu->sflist->presets_mutex);
+               mutex_unlock(&emu->sflist->presets_mutex);
        }
 #if 0  /* debug */
        if (emu->voices[0].state != SNDRV_EMUX_ST_OFF && emu->voices[0].ch >= 0) {
@@ -103,7 +103,7 @@ snd_emux_proc_info_read(struct snd_info_entry *entry,
                snd_iprintf(buf, "sample_mode=%x, rate=%x\n", vp->reg.sample_mode, vp->reg.rate_offset);
        }
 #endif
-       up(&emu->register_mutex);
+       mutex_unlock(&emu->register_mutex);
 }
 
 
index 1a973d7a90f8a302fd453f9c808597a9a41dd75f..8f00f07701c460437d848996dea949e89cb254e8 100644 (file)
@@ -123,12 +123,12 @@ snd_emux_detach_seq(struct snd_emux *emu)
        if (emu->voices)
                snd_emux_terminate_all(emu);
                
-       down(&emu->register_mutex);
+       mutex_lock(&emu->register_mutex);
        if (emu->client >= 0) {
                snd_seq_delete_kernel_client(emu->client);
                emu->client = -1;
        }
-       up(&emu->register_mutex);
+       mutex_unlock(&emu->register_mutex);
 }
 
 
@@ -311,10 +311,10 @@ snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info)
        emu = p->emu;
        snd_assert(emu != NULL, return -EINVAL);
 
-       down(&emu->register_mutex);
+       mutex_lock(&emu->register_mutex);
        snd_emux_init_port(p);
        snd_emux_inc_count(emu);
-       up(&emu->register_mutex);
+       mutex_unlock(&emu->register_mutex);
        return 0;
 }
 
@@ -332,10 +332,10 @@ snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info)
        emu = p->emu;
        snd_assert(emu != NULL, return -EINVAL);
 
-       down(&emu->register_mutex);
+       mutex_lock(&emu->register_mutex);
        snd_emux_sounds_off_all(p);
        snd_emux_dec_count(emu);
-       up(&emu->register_mutex);
+       mutex_unlock(&emu->register_mutex);
        return 0;
 }
 
index 4c5754d4a2e800db960d98b51257bd2972257b18..32c27162dfb60ade704ca6f9a75288f33062dce4 100644 (file)
@@ -79,7 +79,7 @@ static void
 lock_preset(struct snd_sf_list *sflist)
 {
        unsigned long flags;
-       down(&sflist->presets_mutex);
+       mutex_lock(&sflist->presets_mutex);
        spin_lock_irqsave(&sflist->lock, flags);
        sflist->presets_locked = 1;
        spin_unlock_irqrestore(&sflist->lock, flags);
@@ -96,7 +96,7 @@ unlock_preset(struct snd_sf_list *sflist)
        spin_lock_irqsave(&sflist->lock, flags);
        sflist->presets_locked = 0;
        spin_unlock_irqrestore(&sflist->lock, flags);
-       up(&sflist->presets_mutex);
+       mutex_unlock(&sflist->presets_mutex);
 }
 
 
@@ -1390,7 +1390,7 @@ snd_sf_new(struct snd_sf_callback *callback, struct snd_util_memhdr *hdr)
        if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL)
                return NULL;
 
-       init_MUTEX(&sflist->presets_mutex);
+       mutex_init(&sflist->presets_mutex);
        spin_lock_init(&sflist->lock);
        sflist->memhdr = hdr;
 
index 217e8e552a429bd3ac6dce249b50c366cbb95dfa..1d9b11f345f891525c00040202fc1adceb534b15 100644 (file)
@@ -18,6 +18,7 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
+#include <linux/mutex.h>
 #include <sound/driver.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -42,7 +43,7 @@ snd_util_memhdr_new(int memsize)
        if (hdr == NULL)
                return NULL;
        hdr->size = memsize;
-       init_MUTEX(&hdr->block_mutex);
+       mutex_init(&hdr->block_mutex);
        INIT_LIST_HEAD(&hdr->block);
 
        return hdr;
@@ -136,9 +137,9 @@ struct snd_util_memblk *
 snd_util_mem_alloc(struct snd_util_memhdr *hdr, int size)
 {
        struct snd_util_memblk *blk;
-       down(&hdr->block_mutex);
+       mutex_lock(&hdr->block_mutex);
        blk = __snd_util_mem_alloc(hdr, size);
-       up(&hdr->block_mutex);
+       mutex_unlock(&hdr->block_mutex);
        return blk;
 }
 
@@ -163,9 +164,9 @@ int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk)
 {
        snd_assert(hdr && blk, return -EINVAL);
 
-       down(&hdr->block_mutex);
+       mutex_lock(&hdr->block_mutex);
        __snd_util_mem_free(hdr, blk);
-       up(&hdr->block_mutex);
+       mutex_unlock(&hdr->block_mutex);
        return 0;
 }
 
@@ -175,9 +176,9 @@ int snd_util_mem_free(struct snd_util_memhdr *hdr, struct snd_util_memblk *blk)
 int snd_util_mem_avail(struct snd_util_memhdr *hdr)
 {
        unsigned int size;
-       down(&hdr->block_mutex);
+       mutex_lock(&hdr->block_mutex);
        size = hdr->size - hdr->used;
-       up(&hdr->block_mutex);
+       mutex_unlock(&hdr->block_mutex);
        return size;
 }