From: Ingo Molnar 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 Cc: Jaroslav Kysela Cc: Takashi Iwai Signed-off-by: Andrew Morton --- include/sound/ad1848.h | 2 - include/sound/core.h | 8 ++-- include/sound/cs4231.h | 4 +- include/sound/emux_synth.h | 2 - include/sound/gus.h | 6 +-- include/sound/hwdep.h | 2 - include/sound/i2c.h | 10 ++--- include/sound/info.h | 2 - include/sound/mixer_oss.h | 2 - include/sound/opl3.h | 3 + include/sound/pcm.h | 2 - include/sound/pcm_oss.h | 2 - include/sound/rawmidi.h | 4 +- include/sound/sb16_csp.h | 2 - include/sound/seq_instr.h | 2 - include/sound/soundfont.h | 2 - sound/arm/aaci.c | 10 ++--- sound/arm/aaci.h | 2 - sound/core/hwdep.c | 14 +++---- sound/core/info.c | 6 +-- sound/core/init.c | 2 - sound/core/oss/mixer_oss.c | 14 +++---- sound/core/oss/pcm_oss.c | 30 ++++++++-------- sound/core/pcm.c | 4 +- sound/core/pcm_native.c | 12 +++--- sound/core/rawmidi.c | 24 ++++++------- sound/core/seq/seq_clientmgr.c | 40 +++++++++++----------- sound/core/seq/seq_clientmgr.h | 2 - sound/core/seq/seq_device.c | 20 +++++------ sound/core/seq/seq_instr.c | 6 +-- sound/core/seq/seq_ports.c | 12 +++--- sound/core/seq/seq_queue.c | 6 +-- sound/core/seq/seq_queue.h | 2 - sound/core/timer.c | 16 ++++---- sound/drivers/opl3/opl3_lib.c | 2 - sound/drivers/opl3/opl3_seq.c | 10 ++--- sound/drivers/opl3/opl3_synth.c | 10 ++--- sound/drivers/opl4/opl4_lib.c | 2 - sound/drivers/opl4/opl4_local.h | 2 - sound/drivers/opl4/opl4_proc.c | 10 ++--- sound/drivers/opl4/opl4_seq.c | 12 +++--- sound/i2c/i2c.c | 2 - sound/isa/ad1848/ad1848_lib.c | 14 +++---- sound/isa/cs423x/cs4231_lib.c | 30 ++++++++-------- sound/isa/cs423x/cs4236_lib.c | 4 +- sound/isa/gus/gus_dma.c | 10 ++--- sound/isa/gus/gus_main.c | 2 - sound/isa/gus/gus_mem.c | 14 +++---- sound/isa/gus/gus_synth.c | 14 +++---- sound/isa/sb/sb16_csp.c | 12 +++--- sound/oss/cs4281/cs4281m.c | 54 +++++++++++++++--------------- sound/oss/emu10k1/hwaccess.h | 2 - sound/oss/emu10k1/main.c | 2 - sound/oss/emu10k1/midi.c | 14 +++---- sound/pcmcia/vx/vxp_mixer.c | 12 +++--- sound/sparc/cs4231.c | 34 +++++++++--------- sound/synth/emux/emux.c | 2 - sound/synth/emux/emux_oss.c | 12 +++--- sound/synth/emux/emux_proc.c | 8 ++-- sound/synth/emux/emux_seq.c | 12 +++--- sound/synth/emux/soundfont.c | 6 +-- sound/usb/usx2y/usbusx2y.c | 2 - sound/usb/usx2y/usbusx2y.h | 2 - sound/usb/usx2y/usbusx2yaudio.c | 8 ++-- sound/usb/usx2y/usx2yhwdeppcm.c | 12 +++--- 65 files changed, 305 insertions(+), 304 deletions(-) diff -puN include/sound/ad1848.h~sem2mutex-sound-2 include/sound/ad1848.h --- 25/include/sound/ad1848.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/ad1848.h Fri Jan 13 15:51:17 2006 @@ -154,7 +154,7 @@ struct snd_ad1848 { #endif spinlock_t reg_lock; - struct semaphore open_mutex; + struct mutex open_mutex; }; /* exported functions */ diff -puN include/sound/core.h~sem2mutex-sound-2 include/sound/core.h --- 25/include/sound/core.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/core.h Fri Jan 13 15:51:17 2006 @@ -23,7 +23,7 @@ */ #include /* wake_up() */ -#include /* struct semaphore */ +#include /* struct mutex */ #include /* struct rw_semaphore */ #include /* struct workqueue_struct */ #include /* pm_message_t */ @@ -137,7 +137,7 @@ struct snd_card { #ifdef CONFIG_PM unsigned int power_state; /* power state */ - struct semaphore power_lock; /* power lock */ + struct mutex power_lock; /* power lock */ wait_queue_head_t power_sleep; #endif @@ -150,12 +150,12 @@ struct snd_card { #ifdef CONFIG_PM static inline void snd_power_lock(struct snd_card *card) { - down(&card->power_lock); + mutex_lock(&card->power_lock); } static inline void snd_power_unlock(struct snd_card *card) { - up(&card->power_lock); + mutex_unlock(&card->power_lock); } static inline unsigned int snd_power_get_state(struct snd_card *card) diff -puN include/sound/cs4231.h~sem2mutex-sound-2 include/sound/cs4231.h --- 25/include/sound/cs4231.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/cs4231.h Fri Jan 13 15:51:17 2006 @@ -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); diff -puN include/sound/emux_synth.h~sem2mutex-sound-2 include/sound/emux_synth.h --- 25/include/sound/emux_synth.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/emux_synth.h Fri Jan 13 15:51:17 2006 @@ -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]; diff -puN include/sound/gus.h~sem2mutex-sound-2 include/sound/gus.h --- 25/include/sound/gus.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/gus.h Fri Jan 13 15:51:17 2006 @@ -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 */ diff -puN include/sound/hwdep.h~sem2mutex-sound-2 include/sound/hwdep.h --- 25/include/sound/hwdep.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/hwdep.h Fri Jan 13 15:51:17 2006 @@ -60,7 +60,7 @@ struct snd_hwdep { void *private_data; void (*private_free) (struct snd_hwdep *hwdep); - struct semaphore open_mutex; + struct mutex open_mutex; int used; unsigned int dsp_loaded; unsigned int exclusive: 1; diff -puN include/sound/i2c.h~sem2mutex-sound-2 include/sound/i2c.h --- 25/include/sound/i2c.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/i2c.h Fri Jan 13 15:51:17 2006 @@ -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_d 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); diff -puN include/sound/info.h~sem2mutex-sound-2 include/sound/info.h --- 25/include/sound/info.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/info.h Fri Jan 13 15:51:17 2006 @@ -84,7 +84,7 @@ struct snd_info_entry { void *private_data; void (*private_free)(struct snd_info_entry *entry); struct proc_dir_entry *p; - struct semaphore access; + struct mutex access; }; #if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS) diff -puN include/sound/mixer_oss.h~sem2mutex-sound-2 include/sound/mixer_oss.h --- 25/include/sound/mixer_oss.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/mixer_oss.h Fri Jan 13 15:51:17 2006 @@ -61,7 +61,7 @@ struct snd_mixer_oss { unsigned int active_index); void *private_data_recsrc; void (*private_free_recsrc)(struct snd_mixer_oss *mixer); - struct semaphore reg_mutex; + struct mutex reg_mutex; struct snd_info_entry *proc_entry; int oss_dev_alloc; /* --- */ diff -puN include/sound/opl3.h~sem2mutex-sound-2 include/sound/opl3.h --- 25/include/sound/opl3.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/opl3.h Fri Jan 13 15:51:17 2006 @@ -53,6 +53,7 @@ #include "driver.h" #include +#include #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 */ diff -puN include/sound/pcm.h~sem2mutex-sound-2 include/sound/pcm.h --- 25/include/sound/pcm.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/pcm.h Fri Jan 13 15:51:17 2006 @@ -420,7 +420,7 @@ struct snd_pcm { char id[64]; char name[80]; struct snd_pcm_str streams[2]; - struct semaphore open_mutex; + struct mutex open_mutex; wait_queue_head_t open_wait; void *private_data; void (*private_free) (struct snd_pcm *pcm); diff -puN include/sound/pcm_oss.h~sem2mutex-sound-2 include/sound/pcm_oss.h --- 25/include/sound/pcm_oss.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/pcm_oss.h Fri Jan 13 15:51:17 2006 @@ -73,7 +73,7 @@ struct snd_pcm_oss_substream { struct snd_pcm_oss_stream { struct snd_pcm_oss_setup *setup_list; /* setup list */ - struct semaphore setup_mutex; + struct mutex setup_mutex; struct snd_info_entry *proc_entry; }; diff -puN include/sound/rawmidi.h~sem2mutex-sound-2 include/sound/rawmidi.h --- 25/include/sound/rawmidi.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/rawmidi.h Fri Jan 13 15:51:17 2006 @@ -26,7 +26,7 @@ #include #include #include -#include +#include #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE) #include "seq_device.h" @@ -130,7 +130,7 @@ struct snd_rawmidi { void *private_data; void (*private_free) (struct snd_rawmidi *rmidi); - struct semaphore open_mutex; + struct mutex open_mutex; wait_queue_head_t open_wait; struct snd_info_entry *dev; diff -puN include/sound/sb16_csp.h~sem2mutex-sound-2 include/sound/sb16_csp.h --- 25/include/sound/sb16_csp.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/sb16_csp.h Fri Jan 13 15:51:17 2006 @@ -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); diff -puN include/sound/seq_instr.h~sem2mutex-sound-2 include/sound/seq_instr.h --- 25/include/sound/seq_instr.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/seq_instr.h Fri Jan 13 15:51:17 2006 @@ -64,7 +64,7 @@ struct snd_seq_kinstr_list { spinlock_t lock; spinlock_t ops_lock; - struct semaphore ops_mutex; + struct mutex ops_mutex; unsigned long ops_flags; }; diff -puN include/sound/soundfont.h~sem2mutex-sound-2 include/sound/soundfont.h --- 25/include/sound/soundfont.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/include/sound/soundfont.h Fri Jan 13 15:51:17 2006 @@ -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; }; diff -puN sound/arm/aaci.c~sem2mutex-sound-2 sound/arm/aaci.c --- 25/sound/arm/aaci.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/arm/aaci.c Fri Jan 13 15:51:17 2006 @@ -73,7 +73,7 @@ static void aaci_ac97_write(struct snd_a if (ac97->num >= 4) return; - down(&aaci->ac97_sem); + mutex_lock(&aaci->ac97_sem); aaci_ac97_select_codec(aaci, ac97); @@ -91,7 +91,7 @@ static void aaci_ac97_write(struct snd_a v = readl(aaci->base + AACI_SLFR); } while (v & (SLFR_1TXB|SLFR_2TXB)); - up(&aaci->ac97_sem); + mutex_unlock(&aaci->ac97_sem); } /* @@ -105,7 +105,7 @@ static unsigned short aaci_ac97_read(str if (ac97->num >= 4) return ~0; - down(&aaci->ac97_sem); + mutex_lock(&aaci->ac97_sem); aaci_ac97_select_codec(aaci, ac97); @@ -145,7 +145,7 @@ static unsigned short aaci_ac97_read(str v = ~0; } - up(&aaci->ac97_sem); + mutex_unlock(&aaci->ac97_sem); return v; } @@ -783,7 +783,7 @@ static struct aaci * __devinit aaci_init card->shortname, dev->res.start, dev->irq[0]); aaci = card->private_data; - init_MUTEX(&aaci->ac97_sem); + mutex_init(&aaci->ac97_sem); spin_lock_init(&aaci->lock); aaci->card = card; aaci->dev = dev; diff -puN sound/arm/aaci.h~sem2mutex-sound-2 sound/arm/aaci.h --- 25/sound/arm/aaci.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/arm/aaci.h Fri Jan 13 15:51:17 2006 @@ -227,7 +227,7 @@ struct aaci { unsigned int fifosize; /* AC'97 */ - struct semaphore ac97_sem; + struct mutex ac97_sem; ac97_bus_t *ac97_bus; u32 maincr; diff -puN sound/core/hwdep.c~sem2mutex-sound-2 sound/core/hwdep.c --- 25/sound/core/hwdep.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/hwdep.c Fri Jan 13 15:51:17 2006 @@ -112,7 +112,7 @@ static int snd_hwdep_open(struct inode * 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; @@ -129,9 +129,9 @@ static int snd_hwdep_open(struct inode * } 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; @@ -148,7 +148,7 @@ static int snd_hwdep_open(struct inode * hw->ops.release(hw, file); } } - up(&hw->open_mutex); + mutex_unlock(&hw->open_mutex); if (err < 0) module_put(hw->card->module); return err; @@ -158,7 +158,7 @@ static int snd_hwdep_release(struct inod { 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); @@ -166,7 +166,7 @@ static int snd_hwdep_release(struct inod 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; } @@ -376,7 +376,7 @@ int snd_hwdep_new(struct snd_card *card, return err; } init_waitqueue_head(&hwdep->open_wait); - init_MUTEX(&hwdep->open_mutex); + mutex_init(&hwdep->open_mutex); *rhwdep = hwdep; return 0; } diff -puN sound/core/info.c~sem2mutex-sound-2 sound/core/info.c --- 25/sound/core/info.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/info.c Fri Jan 13 15:51:17 2006 @@ -366,9 +366,9 @@ static int snd_info_entry_open(struct in 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; @@ -759,7 +759,7 @@ static struct snd_info_entry *snd_info_c } entry->mode = S_IFREG | S_IRUGO; entry->content = SNDRV_INFO_CONTENT_TEXT; - init_MUTEX(&entry->access); + mutex_init(&entry->access); return entry; } diff -puN sound/core/init.c~sem2mutex-sound-2 sound/core/init.c --- 25/sound/core/init.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/init.c Fri Jan 13 15:51:17 2006 @@ -145,7 +145,7 @@ struct snd_card *snd_card_new(int idx, c 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 -puN sound/core/oss/mixer_oss.c~sem2mutex-sound-2 sound/core/oss/mixer_oss.c --- 25/sound/core/oss/mixer_oss.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/oss/mixer_oss.c Fri Jan 13 15:51:17 2006 @@ -1095,7 +1095,7 @@ static void snd_mixer_oss_proc_read(stru 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(stru 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(str 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(str 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(str kfree(tbl); } __unlock: - up(&mixer->reg_mutex); + mutex_unlock(&mixer->reg_mutex); } } @@ -1288,7 +1288,7 @@ static int snd_mixer_oss_notify_handler( 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 -puN sound/core/oss/pcm_oss.c~sem2mutex-sound-2 sound/core/oss/pcm_oss.c --- 25/sound/core/oss/pcm_oss.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/oss/pcm_oss.c Fri Jan 13 15:51:17 2006 @@ -1631,10 +1631,10 @@ static struct snd_pcm_oss_setup *snd_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; } } @@ -1650,12 +1650,12 @@ static struct snd_pcm_oss_setup *snd_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; } @@ -1881,7 +1881,7 @@ static int snd_pcm_oss_open(struct inode 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); @@ -1895,16 +1895,16 @@ static int snd_pcm_oss_open(struct inode } 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; @@ -1930,9 +1930,9 @@ static int snd_pcm_oss_release(struct in 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); @@ -2277,7 +2277,7 @@ static void snd_pcm_oss_proc_read(struct { 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, @@ -2291,7 +2291,7 @@ static void snd_pcm_oss_proc_read(struct 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) @@ -2321,12 +2321,12 @@ static void snd_pcm_oss_proc_write(struc 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) { @@ -2378,7 +2378,7 @@ static void snd_pcm_oss_proc_write(struc } if (setup) *setup = template; - up(&pstr->oss.setup_mutex); + mutex_unlock(&pstr->oss.setup_mutex); } } diff -puN sound/core/pcm.c~sem2mutex-sound-2 sound/core/pcm.c --- 25/sound/core/pcm.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/pcm.c Fri Jan 13 15:51:17 2006 @@ -623,7 +623,7 @@ int snd_pcm_new_stream(struct snd_pcm *p 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; @@ -717,7 +717,7 @@ int snd_pcm_new(struct snd_card *card, c 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); diff -puN sound/core/pcm_native.c~sem2mutex-sound-2 sound/core/pcm_native.c --- 25/sound/core/pcm_native.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/pcm_native.c Fri Jan 13 15:51:17 2006 @@ -2112,7 +2112,7 @@ static int snd_pcm_open(struct file *fil } 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 *fil } 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 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 -puN sound/core/rawmidi.c~sem2mutex-sound-2 sound/core/rawmidi.c --- 25/sound/core/rawmidi.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/rawmidi.c Fri Jan 13 15:51:17 2006 @@ -250,7 +250,7 @@ int snd_rawmidi_kernel_open(struct snd_c goto __error1; } if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK)) - down(&rmidi->open_mutex); + mutex_lock(&rmidi->open_mutex); if (mode & SNDRV_RAWMIDI_LFLG_INPUT) { if (!(rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT)) { err = -ENXIO; @@ -360,7 +360,7 @@ int snd_rawmidi_kernel_open(struct snd_c soutput = NULL; } if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK)) - up(&rmidi->open_mutex); + mutex_unlock(&rmidi->open_mutex); if (rfile) { rfile->rmidi = rmidi; rfile->input = sinput; @@ -375,7 +375,7 @@ int snd_rawmidi_kernel_open(struct snd_c snd_rawmidi_runtime_free(soutput); module_put(rmidi->card->module); if (!(mode & SNDRV_RAWMIDI_LFLG_NOOPENLOCK)) - up(&rmidi->open_mutex); + mutex_unlock(&rmidi->open_mutex); __error1: return err; } @@ -423,7 +423,7 @@ static int snd_rawmidi_open(struct inode } init_waitqueue_entry(&wait, current); add_wait_queue(&rmidi->open_wait, &wait); - down(&rmidi->open_mutex); + mutex_lock(&rmidi->open_mutex); while (1) { subdevice = -1; down_read(&card->controls_rwsem); @@ -447,9 +447,9 @@ static int snd_rawmidi_open(struct inode } else break; set_current_state(TASK_INTERRUPTIBLE); - up(&rmidi->open_mutex); + mutex_unlock(&rmidi->open_mutex); schedule(); - down(&rmidi->open_mutex); + mutex_lock(&rmidi->open_mutex); if (signal_pending(current)) { err = -ERESTARTSYS; break; @@ -468,7 +468,7 @@ static int snd_rawmidi_open(struct inode snd_card_file_remove(card, file); kfree(rawmidi_file); } - up(&rmidi->open_mutex); + mutex_unlock(&rmidi->open_mutex); return err; } @@ -481,7 +481,7 @@ int snd_rawmidi_kernel_release(struct sn snd_assert(rfile != NULL, return -ENXIO); snd_assert(rfile->input != NULL || rfile->output != NULL, return -ENXIO); rmidi = rfile->rmidi; - down(&rmidi->open_mutex); + mutex_lock(&rmidi->open_mutex); if (rfile->input != NULL) { substream = rfile->input; rfile->input = NULL; @@ -515,7 +515,7 @@ int snd_rawmidi_kernel_release(struct sn } rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_opened--; } - up(&rmidi->open_mutex); + mutex_unlock(&rmidi->open_mutex); module_put(rmidi->card->module); return 0; } @@ -1315,7 +1315,7 @@ static void snd_rawmidi_proc_info_read(s rmidi = entry->private_data; snd_iprintf(buffer, "%s\n\n", rmidi->name); - down(&rmidi->open_mutex); + mutex_lock(&rmidi->open_mutex); if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT) { list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) { substream = list_entry(list, struct snd_rawmidi_substream, list); @@ -1356,7 +1356,7 @@ static void snd_rawmidi_proc_info_read(s } } } - up(&rmidi->open_mutex); + mutex_unlock(&rmidi->open_mutex); } /* @@ -1437,7 +1437,7 @@ int snd_rawmidi_new(struct snd_card *car } rmidi->card = card; rmidi->device = device; - init_MUTEX(&rmidi->open_mutex); + mutex_init(&rmidi->open_mutex); init_waitqueue_head(&rmidi->open_wait); if (id != NULL) strlcpy(rmidi->id, id, sizeof(rmidi->id)); diff -puN sound/core/seq/seq_clientmgr.c~sem2mutex-sound-2 sound/core/seq/seq_clientmgr.c --- 25/sound/core/seq/seq_clientmgr.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/seq/seq_clientmgr.c Fri Jan 13 15:51:17 2006 @@ -67,7 +67,7 @@ #define SNDRV_SEQ_LFLG_OPEN (SNDRV_SEQ_LFLG_INPUT|SNDRV_SEQ_LFLG_OUTPUT) static DEFINE_SPINLOCK(clients_lock); -static DECLARE_MUTEX(register_mutex); +static DEFINE_MUTEX(register_mutex); /* * client table @@ -237,7 +237,7 @@ static struct snd_seq_client *seq_create client->type = NO_CLIENT; snd_use_lock_init(&client->use_lock); rwlock_init(&client->ports_lock); - init_MUTEX(&client->ports_mutex); + mutex_init(&client->ports_mutex); INIT_LIST_HEAD(&client->ports_list_head); /* find free slot in the client table */ @@ -290,7 +290,7 @@ static int seq_free_client1(struct snd_s static void seq_free_client(struct snd_seq_client * client) { - down(®ister_mutex); + mutex_lock(®ister_mutex); switch (client->type) { case NO_CLIENT: snd_printk(KERN_WARNING "Seq: Trying to free unused client %d\n", @@ -306,7 +306,7 @@ static void seq_free_client(struct snd_s snd_printk(KERN_ERR "Seq: Trying to free client %d with undefined type = %d\n", client->number, client->type); } - up(®ister_mutex); + mutex_unlock(®ister_mutex); snd_seq_system_client_ev_client_exit(client->number); } @@ -322,11 +322,11 @@ static int snd_seq_open(struct inode *in struct snd_seq_client *client; struct snd_seq_user_client *user; - if (down_interruptible(®ister_mutex)) + if (mutex_lock_interruptible(®ister_mutex)) return -ERESTARTSYS; client = seq_create_client1(-1, SNDRV_SEQ_DEFAULT_EVENTS); if (client == NULL) { - up(®ister_mutex); + mutex_unlock(®ister_mutex); return -ENOMEM; /* failure code */ } @@ -346,14 +346,14 @@ static int snd_seq_open(struct inode *in if (user->fifo == NULL) { seq_free_client1(client); kfree(client); - up(®ister_mutex); + mutex_unlock(®ister_mutex); return -ENOMEM; } } usage_alloc(&client_usage, 1); client->type = USER_CLIENT; - up(®ister_mutex); + mutex_unlock(®ister_mutex); c = client->number; file->private_data = client; @@ -1743,7 +1743,7 @@ static int snd_seq_ioctl_get_queue_timer if (queue == NULL) return -EINVAL; - if (down_interruptible(&queue->timer_mutex)) { + if (mutex_lock_interruptible(&queue->timer_mutex)) { queuefree(queue); return -ERESTARTSYS; } @@ -1756,7 +1756,7 @@ static int snd_seq_ioctl_get_queue_timer timer.u.alsa.id = tmr->alsa_id; timer.u.alsa.resolution = tmr->preferred_resolution; } - up(&queue->timer_mutex); + mutex_unlock(&queue->timer_mutex); queuefree(queue); if (copy_to_user(arg, &timer, sizeof(timer))) @@ -1785,7 +1785,7 @@ static int snd_seq_ioctl_set_queue_timer q = queueptr(timer.queue); if (q == NULL) return -ENXIO; - if (down_interruptible(&q->timer_mutex)) { + if (mutex_lock_interruptible(&q->timer_mutex)) { queuefree(q); return -ERESTARTSYS; } @@ -1797,7 +1797,7 @@ static int snd_seq_ioctl_set_queue_timer tmr->preferred_resolution = timer.u.alsa.resolution; } result = snd_seq_queue_timer_open(timer.queue); - up(&q->timer_mutex); + mutex_unlock(&q->timer_mutex); queuefree(q); } else { return -EPERM; @@ -2230,7 +2230,7 @@ int snd_seq_create_kernel_client(struct if (card == NULL && client_index >= SNDRV_SEQ_GLOBAL_CLIENTS) return -EINVAL; - if (down_interruptible(®ister_mutex)) + if (mutex_lock_interruptible(®ister_mutex)) return -ERESTARTSYS; if (card) { @@ -2243,7 +2243,7 @@ int snd_seq_create_kernel_client(struct /* empty write queue as default */ client = seq_create_client1(client_index, 0); if (client == NULL) { - up(®ister_mutex); + mutex_unlock(®ister_mutex); return -EBUSY; /* failure code */ } usage_alloc(&client_usage, 1); @@ -2256,7 +2256,7 @@ int snd_seq_create_kernel_client(struct va_end(args); client->type = KERNEL_CLIENT; - up(®ister_mutex); + mutex_unlock(®ister_mutex); /* make others aware this new client */ snd_seq_system_client_ev_client_start(client->number); @@ -2464,7 +2464,7 @@ static void snd_seq_info_dump_ports(stru { struct list_head *l; - down(&client->ports_mutex); + mutex_lock(&client->ports_mutex); list_for_each(l, &client->ports_list_head) { struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list); snd_iprintf(buffer, " Port %3d : \"%s\" (%c%c%c%c)\n", @@ -2476,7 +2476,7 @@ static void snd_seq_info_dump_ports(stru snd_seq_info_dump_subscribers(buffer, &p->c_src, 1, " Connecting To: "); snd_seq_info_dump_subscribers(buffer, &p->c_dest, 0, " Connected From: "); } - up(&client->ports_mutex); + mutex_unlock(&client->ports_mutex); } @@ -2550,16 +2550,16 @@ int __init snd_sequencer_device_init(voi { int err; - if (down_interruptible(®ister_mutex)) + if (mutex_lock_interruptible(®ister_mutex)) return -ERESTARTSYS; if ((err = snd_register_device(SNDRV_DEVICE_TYPE_SEQUENCER, NULL, 0, &snd_seq_f_ops, NULL, "seq")) < 0) { - up(®ister_mutex); + mutex_unlock(®ister_mutex); return err; } - up(®ister_mutex); + mutex_unlock(®ister_mutex); return 0; } diff -puN sound/core/seq/seq_clientmgr.h~sem2mutex-sound-2 sound/core/seq/seq_clientmgr.h --- 25/sound/core/seq/seq_clientmgr.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/seq/seq_clientmgr.h Fri Jan 13 15:51:17 2006 @@ -58,7 +58,7 @@ struct snd_seq_client { int num_ports; /* number of ports */ struct list_head ports_list_head; rwlock_t ports_lock; - struct semaphore ports_mutex; + struct mutex ports_mutex; int convert32; /* convert 32->64bit */ /* output pool */ diff -puN sound/core/seq/seq_device.c~sem2mutex-sound-2 sound/core/seq/seq_device.c --- 25/sound/core/seq/seq_device.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/seq/seq_device.c Fri Jan 13 15:51:17 2006 @@ -70,7 +70,7 @@ struct ops_list { struct list_head dev_list; /* list of devices */ int num_devices; /* number of associated devices */ int num_init_devices; /* number of initialized devices */ - struct semaphore reg_mutex; + struct mutex reg_mutex; struct list_head list; /* next driver */ }; @@ -215,10 +215,10 @@ int snd_seq_device_new(struct snd_card * dev->status = SNDRV_SEQ_DEVICE_FREE; /* add this device to the list */ - down(&ops->reg_mutex); + mutex_lock(&ops->reg_mutex); list_add_tail(&dev->list, &ops->dev_list); ops->num_devices++; - up(&ops->reg_mutex); + mutex_unlock(&ops->reg_mutex); unlock_driver(ops); @@ -247,10 +247,10 @@ static int snd_seq_device_free(struct sn return -ENXIO; /* remove the device from the list */ - down(&ops->reg_mutex); + mutex_lock(&ops->reg_mutex); list_del(&dev->list); ops->num_devices--; - up(&ops->reg_mutex); + mutex_unlock(&ops->reg_mutex); free_device(dev, ops); if (dev->private_free) @@ -345,7 +345,7 @@ int snd_seq_device_register_driver(char return -EBUSY; } - down(&ops->reg_mutex); + mutex_lock(&ops->reg_mutex); /* copy driver operators */ ops->ops = *entry; ops->driver |= DRIVER_LOADED; @@ -356,7 +356,7 @@ int snd_seq_device_register_driver(char struct snd_seq_device *dev = list_entry(head, struct snd_seq_device, list); init_device(dev, ops); } - up(&ops->reg_mutex); + mutex_unlock(&ops->reg_mutex); unlock_driver(ops); snd_seq_autoload_unlock(); @@ -379,7 +379,7 @@ static struct ops_list * create_driver(c /* set up driver entry */ strlcpy(ops->id, id, sizeof(ops->id)); - init_MUTEX(&ops->reg_mutex); + mutex_init(&ops->reg_mutex); ops->driver = DRIVER_EMPTY; INIT_LIST_HEAD(&ops->dev_list); /* lock this instance */ @@ -415,7 +415,7 @@ int snd_seq_device_unregister_driver(cha } /* close and release all devices associated with this driver */ - down(&ops->reg_mutex); + mutex_lock(&ops->reg_mutex); ops->driver |= DRIVER_LOCKED; /* do not remove this driver recursively */ list_for_each(head, &ops->dev_list) { struct snd_seq_device *dev = list_entry(head, struct snd_seq_device, list); @@ -426,7 +426,7 @@ int snd_seq_device_unregister_driver(cha if (ops->num_init_devices > 0) snd_printk(KERN_ERR "free_driver: init_devices > 0!! (%d)\n", ops->num_init_devices); - up(&ops->reg_mutex); + mutex_unlock(&ops->reg_mutex); unlock_driver(ops); diff -puN sound/core/seq/seq_instr.c~sem2mutex-sound-2 sound/core/seq/seq_instr.c --- 25/sound/core/seq/seq_instr.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/seq/seq_instr.c Fri Jan 13 15:51:17 2006 @@ -36,7 +36,7 @@ static void snd_instr_lock_ops(struct sn if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) { spin_lock_irqsave(&list->ops_lock, list->ops_flags); } else { - down(&list->ops_mutex); + mutex_lock(&list->ops_mutex); } } @@ -45,7 +45,7 @@ static void snd_instr_unlock_ops(struct if (!(list->flags & SNDRV_SEQ_INSTR_FLG_DIRECT)) { spin_unlock_irqrestore(&list->ops_lock, list->ops_flags); } else { - up(&list->ops_mutex); + mutex_unlock(&list->ops_mutex); } } @@ -82,7 +82,7 @@ struct snd_seq_kinstr_list *snd_seq_inst return NULL; spin_lock_init(&list->lock); spin_lock_init(&list->ops_lock); - init_MUTEX(&list->ops_mutex); + mutex_init(&list->ops_mutex); list->owner = -1; return list; } diff -puN sound/core/seq/seq_ports.c~sem2mutex-sound-2 sound/core/seq/seq_ports.c --- 25/sound/core/seq/seq_ports.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/seq/seq_ports.c Fri Jan 13 15:51:17 2006 @@ -159,7 +159,7 @@ struct snd_seq_client_port *snd_seq_crea port_subs_info_init(&new_port->c_dest); num = port >= 0 ? port : 0; - down(&client->ports_mutex); + mutex_lock(&client->ports_mutex); write_lock_irqsave(&client->ports_lock, flags); list_for_each(l, &client->ports_list_head) { struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list); @@ -173,7 +173,7 @@ struct snd_seq_client_port *snd_seq_crea client->num_ports++; new_port->addr.port = num; /* store the port number in the port */ write_unlock_irqrestore(&client->ports_lock, flags); - up(&client->ports_mutex); + mutex_unlock(&client->ports_mutex); sprintf(new_port->name, "port-%d", num); return new_port; @@ -292,7 +292,7 @@ int snd_seq_delete_port(struct snd_seq_c struct list_head *l; struct snd_seq_client_port *found = NULL; - down(&client->ports_mutex); + mutex_lock(&client->ports_mutex); write_lock_irqsave(&client->ports_lock, flags); list_for_each(l, &client->ports_list_head) { struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list); @@ -305,7 +305,7 @@ int snd_seq_delete_port(struct snd_seq_c } } write_unlock_irqrestore(&client->ports_lock, flags); - up(&client->ports_mutex); + mutex_unlock(&client->ports_mutex); if (found) return port_delete(client, found); else @@ -321,7 +321,7 @@ int snd_seq_delete_all_ports(struct snd_ /* move the port list to deleted_list, and * clear the port list in the client data. */ - down(&client->ports_mutex); + mutex_lock(&client->ports_mutex); write_lock_irqsave(&client->ports_lock, flags); if (! list_empty(&client->ports_list_head)) { __list_add(&deleted_list, @@ -341,7 +341,7 @@ int snd_seq_delete_all_ports(struct snd_ snd_seq_system_client_ev_port_exit(port->addr.client, port->addr.port); port_delete(client, port); } - up(&client->ports_mutex); + mutex_unlock(&client->ports_mutex); return 0; } diff -puN sound/core/seq/seq_queue.c~sem2mutex-sound-2 sound/core/seq/seq_queue.c --- 25/sound/core/seq/seq_queue.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/seq/seq_queue.c Fri Jan 13 15:51:17 2006 @@ -119,7 +119,7 @@ static struct snd_seq_queue *queue_new(i spin_lock_init(&q->owner_lock); spin_lock_init(&q->check_lock); - init_MUTEX(&q->timer_mutex); + mutex_init(&q->timer_mutex); snd_use_lock_init(&q->use_lock); q->queue = -1; @@ -516,7 +516,7 @@ int snd_seq_queue_use(int queueid, int c queue = queueptr(queueid); if (queue == NULL) return -EINVAL; - down(&queue->timer_mutex); + mutex_lock(&queue->timer_mutex); if (use) { if (!test_and_set_bit(client, queue->clients_bitmap)) queue->clients++; @@ -531,7 +531,7 @@ int snd_seq_queue_use(int queueid, int c } else { snd_seq_timer_close(queue); } - up(&queue->timer_mutex); + mutex_unlock(&queue->timer_mutex); queuefree(queue); return 0; } diff -puN sound/core/seq/seq_queue.h~sem2mutex-sound-2 sound/core/seq/seq_queue.h --- 25/sound/core/seq/seq_queue.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/seq/seq_queue.h Fri Jan 13 15:51:17 2006 @@ -54,7 +54,7 @@ struct snd_seq_queue { /* clients which uses this queue (bitmap) */ DECLARE_BITMAP(clients_bitmap, SNDRV_SEQ_MAX_CLIENTS); unsigned int clients; /* users of this queue */ - struct semaphore timer_mutex; + struct mutex timer_mutex; snd_use_lock_t use_lock; }; diff -puN sound/core/timer.c~sem2mutex-sound-2 sound/core/timer.c --- 25/sound/core/timer.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/core/timer.c Fri Jan 13 15:51:17 2006 @@ -71,7 +71,7 @@ struct snd_timer_user { struct timespec tstamp; /* trigger tstamp */ wait_queue_head_t qchange_sleep; struct fasync_struct *fasync; - struct semaphore tread_sem; + struct mutex tread_sem; }; /* list of timers */ @@ -1270,7 +1270,7 @@ static int snd_timer_user_open(struct in return -ENOMEM; spin_lock_init(&tu->qlock); init_waitqueue_head(&tu->qchange_sleep); - init_MUTEX(&tu->tread_sem); + mutex_init(&tu->tread_sem); tu->ticks = 1; tu->queue_size = 128; tu->queue = kmalloc(tu->queue_size * sizeof(struct snd_timer_read), @@ -1533,7 +1533,7 @@ static int snd_timer_user_tselect(struct int err = 0; tu = file->private_data; - down(&tu->tread_sem); + mutex_lock(&tu->tread_sem); if (tu->timeri) { snd_timer_close(tu->timeri); tu->timeri = NULL; @@ -1577,7 +1577,7 @@ static int snd_timer_user_tselect(struct } __err: - up(&tu->tread_sem); + mutex_unlock(&tu->tread_sem); return err; } @@ -1798,17 +1798,17 @@ static long snd_timer_user_ioctl(struct { int xarg; - down(&tu->tread_sem); + mutex_lock(&tu->tread_sem); if (tu->timeri) { /* too late */ - up(&tu->tread_sem); + mutex_unlock(&tu->tread_sem); return -EBUSY; } if (get_user(xarg, p)) { - up(&tu->tread_sem); + mutex_unlock(&tu->tread_sem); return -EFAULT; } tu->tread = xarg ? 1 : 0; - up(&tu->tread_sem); + mutex_unlock(&tu->tread_sem); return 0; } case SNDRV_TIMER_IOCTL_GINFO: diff -puN sound/drivers/opl3/opl3_lib.c~sem2mutex-sound-2 sound/drivers/opl3/opl3_lib.c --- 25/sound/drivers/opl3/opl3_lib.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/drivers/opl3/opl3_lib.c Fri Jan 13 15:51:17 2006 @@ -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); diff -puN sound/drivers/opl3/opl3_seq.c~sem2mutex-sound-2 sound/drivers/opl3/opl3_seq.c --- 25/sound/drivers/opl3/opl3_seq.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/drivers/opl3/opl3_seq.c Fri Jan 13 15:51:17 2006 @@ -52,13 +52,13 @@ int snd_opl3_synth_setup(struct snd_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_o 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) diff -puN sound/drivers/opl3/opl3_synth.c~sem2mutex-sound-2 sound/drivers/opl3/opl3_synth.c --- 25/sound/drivers/opl3/opl3_synth.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/drivers/opl3/opl3_synth.c Fri Jan 13 15:51:17 2006 @@ -76,13 +76,13 @@ int snd_opl3_open(struct snd_hwdep * hw, { 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 * 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; } diff -puN sound/drivers/opl4/opl4_lib.c~sem2mutex-sound-2 sound/drivers/opl4/opl4_lib.c --- 25/sound/drivers/opl4/opl4_lib.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/drivers/opl4/opl4_lib.c Fri Jan 13 15:51:17 2006 @@ -214,7 +214,7 @@ int snd_opl4_create(struct snd_card *car 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) { diff -puN sound/drivers/opl4/opl4_local.h~sem2mutex-sound-2 sound/drivers/opl4/opl4_local.h --- 25/sound/drivers/opl4/opl4_local.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/drivers/opl4/opl4_local.h Fri Jan 13 15:51:17 2006 @@ -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; diff -puN sound/drivers/opl4/opl4_proc.c~sem2mutex-sound-2 sound/drivers/opl4/opl4_proc.c --- 25/sound/drivers/opl4/opl4_proc.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/drivers/opl4/opl4_proc.c Fri Jan 13 15:51:17 2006 @@ -28,13 +28,13 @@ static int snd_opl4_mem_proc_open(struct { 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(str { 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; } diff -puN sound/drivers/opl4/opl4_seq.c~sem2mutex-sound-2 sound/drivers/opl4/opl4_seq.c --- 25/sound/drivers/opl4/opl4_seq.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/drivers/opl4/opl4_seq.c Fri Jan 13 15:51:17 2006 @@ -62,10 +62,10 @@ static int snd_opl4_seq_use(void *privat 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 *privat 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 *priv 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); diff -puN sound/i2c/i2c.c~sem2mutex-sound-2 sound/i2c/i2c.c --- 25/sound/i2c/i2c.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/i2c/i2c.c Fri Jan 13 15:51:17 2006 @@ -88,7 +88,7 @@ int snd_i2c_bus_create(struct snd_card * 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; diff -puN sound/isa/ad1848/ad1848_lib.c~sem2mutex-sound-2 sound/isa/ad1848/ad1848_lib.c --- 25/sound/isa/ad1848/ad1848_lib.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/isa/ad1848/ad1848_lib.c Fri Jan 13 15:51:17 2006 @@ -387,9 +387,9 @@ static int snd_ad1848_open(struct snd_ad { 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_ad 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_ { 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_ 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 *c 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; diff -puN sound/isa/cs423x/cs4231_lib.c~sem2mutex-sound-2 sound/isa/cs423x/cs4231_lib.c --- 25/sound/isa/cs423x/cs4231_lib.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/isa/cs423x/cs4231_lib.c Fri Jan 13 15:51:17 2006 @@ -531,7 +531,7 @@ static void snd_cs4231_playback_format(s 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(s 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(st 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(st 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_cs { 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_cs 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_ { 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_ 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_car 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 *ch 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); diff -puN sound/isa/cs423x/cs4236_lib.c~sem2mutex-sound-2 sound/isa/cs423x/cs4236_lib.c --- 25/sound/isa/cs423x/cs4236_lib.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/isa/cs423x/cs4236_lib.c Fri Jan 13 15:51:17 2006 @@ -841,7 +841,7 @@ static int snd_cs4236_put_iec958_switch( 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( 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", diff -puN sound/isa/gus/gus_dma.c~sem2mutex-sound-2 sound/isa/gus/gus_dma.c --- 25/sound/isa/gus/gus_dma.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/isa/gus/gus_dma.c Fri Jan 13 15:51:17 2006 @@ -149,10 +149,10 @@ static void snd_gf1_dma_interrupt(struct 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->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 { 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->gf1.dma_data_pcm_last = gus->gf1.dma_data_synth_last = NULL; } - up(&gus->dma_mutex); + mutex_unlock(&gus->dma_mutex); return 0; } diff -puN sound/isa/gus/gus_main.c~sem2mutex-sound-2 sound/isa/gus/gus_main.c --- 25/sound/isa/gus/gus_main.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/isa/gus/gus_main.c Fri Jan 13 15:51:17 2006 @@ -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; diff -puN sound/isa/gus/gus_mem.c~sem2mutex-sound-2 sound/isa/gus/gus_mem.c --- 25/sound/isa/gus/gus_mem.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/isa/gus/gus_mem.c Fri Jan 13 15:51:17 2006 @@ -34,9 +34,9 @@ static void snd_gf1_mem_info_read(struct 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 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 { 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 #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 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_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), diff -puN sound/isa/gus/gus_synth.c~sem2mutex-sound-2 sound/isa/gus/gus_synth.c --- 25/sound/isa/gus/gus_synth.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/isa/gus/gus_synth.c Fri Jan 13 15:51:17 2006 @@ -55,9 +55,9 @@ static int snd_gus_synth_use(void *priva 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 *priva 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 *pri 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(stru if (gus == NULL) return -EINVAL; - init_MUTEX(&gus->register_mutex); + mutex_init(&gus->register_mutex); gus->gf1.seq_client = -1; /* allocate new client */ diff -puN sound/isa/sb/sb16_csp.c~sem2mutex-sound-2 sound/isa/sb/sb16_csp.c --- 25/sound/isa/sb/sb16_csp.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/isa/sb/sb16_csp.c Fri Jan 13 15:51:17 2006 @@ -138,7 +138,7 @@ int snd_sb_csp_new(struct snd_sb *chip, 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 */ 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_ */ 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; } diff -puN sound/oss/cs4281/cs4281m.c~sem2mutex-sound-2 sound/oss/cs4281/cs4281m.c --- 25/sound/oss/cs4281/cs4281m.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/oss/cs4281/cs4281m.c Fri Jan 13 15:51:17 2006 @@ -245,9 +245,9 @@ struct cs4281_state { void *tmpbuff; // tmp buffer for sample conversions unsigned ena; spinlock_t lock; - struct semaphore open_sem; - struct semaphore open_sem_adc; - struct semaphore open_sem_dac; + struct mutex open_sem; + struct mutex open_sem_adc; + struct mutex open_sem_dac; mode_t open_mode; wait_queue_head_t open_wait; wait_queue_head_t open_wait_adc; @@ -3598,20 +3598,20 @@ static int cs4281_release(struct inode * if (file->f_mode & FMODE_WRITE) { drain_dac(s, file->f_flags & O_NONBLOCK); - down(&s->open_sem_dac); + mutex_lock(&s->open_sem_dac); stop_dac(s); dealloc_dmabuf(s, &s->dma_dac); s->open_mode &= ~FMODE_WRITE; - up(&s->open_sem_dac); + mutex_unlock(&s->open_sem_dac); wake_up(&s->open_wait_dac); } if (file->f_mode & FMODE_READ) { drain_adc(s, file->f_flags & O_NONBLOCK); - down(&s->open_sem_adc); + mutex_lock(&s->open_sem_adc); stop_adc(s); dealloc_dmabuf(s, &s->dma_adc); s->open_mode &= ~FMODE_READ; - up(&s->open_sem_adc); + mutex_unlock(&s->open_sem_adc); wake_up(&s->open_wait_adc); } return 0; @@ -3651,33 +3651,33 @@ static int cs4281_open(struct inode *ino return -ENODEV; } if (file->f_mode & FMODE_WRITE) { - down(&s->open_sem_dac); + mutex_lock(&s->open_sem_dac); while (s->open_mode & FMODE_WRITE) { if (file->f_flags & O_NONBLOCK) { - up(&s->open_sem_dac); + mutex_unlock(&s->open_sem_dac); return -EBUSY; } - up(&s->open_sem_dac); + mutex_unlock(&s->open_sem_dac); interruptible_sleep_on(&s->open_wait_dac); if (signal_pending(current)) return -ERESTARTSYS; - down(&s->open_sem_dac); + mutex_lock(&s->open_sem_dac); } } if (file->f_mode & FMODE_READ) { - down(&s->open_sem_adc); + mutex_lock(&s->open_sem_adc); while (s->open_mode & FMODE_READ) { if (file->f_flags & O_NONBLOCK) { - up(&s->open_sem_adc); + mutex_unlock(&s->open_sem_adc); return -EBUSY; } - up(&s->open_sem_adc); + mutex_unlock(&s->open_sem_adc); interruptible_sleep_on(&s->open_wait_adc); if (signal_pending(current)) return -ERESTARTSYS; - down(&s->open_sem_adc); + mutex_lock(&s->open_sem_adc); } } s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); @@ -3691,7 +3691,7 @@ static int cs4281_open(struct inode *ino s->ena &= ~FMODE_READ; s->dma_adc.ossfragshift = s->dma_adc.ossmaxfrags = s->dma_adc.subdivision = 0; - up(&s->open_sem_adc); + mutex_unlock(&s->open_sem_adc); if (prog_dmabuf_adc(s)) { CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR @@ -3711,7 +3711,7 @@ static int cs4281_open(struct inode *ino s->ena &= ~FMODE_WRITE; s->dma_dac.ossfragshift = s->dma_dac.ossmaxfrags = s->dma_dac.subdivision = 0; - up(&s->open_sem_dac); + mutex_unlock(&s->open_sem_dac); if (prog_dmabuf_dac(s)) { CS_DBGOUT(CS_OPEN | CS_ERROR, 2, printk(KERN_ERR @@ -3978,17 +3978,17 @@ static int cs4281_midi_open(struct inode VALIDATE_STATE(s); file->private_data = s; // wait for device to become free - down(&s->open_sem); + mutex_lock(&s->open_sem); while (s->open_mode & (file->f_mode << FMODE_MIDI_SHIFT)) { if (file->f_flags & O_NONBLOCK) { - up(&s->open_sem); + mutex_unlock(&s->open_sem); return -EBUSY; } - up(&s->open_sem); + mutex_unlock(&s->open_sem); interruptible_sleep_on(&s->open_wait); if (signal_pending(current)) return -ERESTARTSYS; - down(&s->open_sem); + mutex_lock(&s->open_sem); } spin_lock_irqsave(&s->lock, flags); if (!(s->open_mode & (FMODE_MIDI_READ | FMODE_MIDI_WRITE))) { @@ -4018,7 +4018,7 @@ static int cs4281_midi_open(struct inode (file-> f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE); - up(&s->open_sem); + mutex_unlock(&s->open_sem); return nonseekable_open(inode, file); } @@ -4057,7 +4057,7 @@ static int cs4281_midi_release(struct in remove_wait_queue(&s->midi.owait, &wait); current->state = TASK_RUNNING; } - down(&s->open_sem); + mutex_lock(&s->open_sem); s->open_mode &= (~(file->f_mode << FMODE_MIDI_SHIFT)) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE); @@ -4067,7 +4067,7 @@ static int cs4281_midi_release(struct in del_timer(&s->midi.timer); } spin_unlock_irqrestore(&s->lock, flags); - up(&s->open_sem); + mutex_unlock(&s->open_sem); wake_up(&s->open_wait); return 0; } @@ -4300,9 +4300,9 @@ static int __devinit cs4281_probe(struct init_waitqueue_head(&s->open_wait_dac); init_waitqueue_head(&s->midi.iwait); init_waitqueue_head(&s->midi.owait); - init_MUTEX(&s->open_sem); - init_MUTEX(&s->open_sem_adc); - init_MUTEX(&s->open_sem_dac); + mutex_init(&s->open_sem); + mutex_init(&s->open_sem_adc); + mutex_init(&s->open_sem_dac); spin_lock_init(&s->lock); s->pBA0phys = pci_resource_start(pcidev, 0); s->pBA1phys = pci_resource_start(pcidev, 1); diff -puN sound/oss/emu10k1/hwaccess.h~sem2mutex-sound-2 sound/oss/emu10k1/hwaccess.h --- 25/sound/oss/emu10k1/hwaccess.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/oss/emu10k1/hwaccess.h Fri Jan 13 15:51:17 2006 @@ -181,7 +181,7 @@ struct emu10k1_card struct emu10k1_mpuout *mpuout; struct emu10k1_mpuin *mpuin; - struct semaphore open_sem; + struct mutex open_sem; mode_t open_mode; wait_queue_head_t open_wait; diff -puN sound/oss/emu10k1/main.c~sem2mutex-sound-2 sound/oss/emu10k1/main.c --- 25/sound/oss/emu10k1/main.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/oss/emu10k1/main.c Fri Jan 13 15:51:17 2006 @@ -1320,7 +1320,7 @@ static int __devinit emu10k1_probe(struc card->is_aps = (subsysvid == EMU_APS_SUBID); spin_lock_init(&card->lock); - init_MUTEX(&card->open_sem); + mutex_init(&card->open_sem); card->open_mode = 0; init_waitqueue_head(&card->open_wait); diff -puN sound/oss/emu10k1/midi.c~sem2mutex-sound-2 sound/oss/emu10k1/midi.c --- 25/sound/oss/emu10k1/midi.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/oss/emu10k1/midi.c Fri Jan 13 15:51:17 2006 @@ -110,21 +110,21 @@ match: #endif /* Wait for device to become free */ - down(&card->open_sem); + mutex_lock(&card->open_sem); while (card->open_mode & (file->f_mode << FMODE_MIDI_SHIFT)) { if (file->f_flags & O_NONBLOCK) { - up(&card->open_sem); + mutex_unlock(&card->open_sem); return -EBUSY; } - up(&card->open_sem); + mutex_unlock(&card->open_sem); interruptible_sleep_on(&card->open_wait); if (signal_pending(current)) { return -ERESTARTSYS; } - down(&card->open_sem); + mutex_lock(&card->open_sem); } if ((midi_dev = (struct emu10k1_mididevice *) kmalloc(sizeof(*midi_dev), GFP_KERNEL)) == NULL) @@ -183,7 +183,7 @@ match: card->open_mode |= (file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE); - up(&card->open_sem); + mutex_unlock(&card->open_sem); return nonseekable_open(inode, file); } @@ -234,9 +234,9 @@ static int emu10k1_midi_release(struct i kfree(midi_dev); - down(&card->open_sem); + mutex_lock(&card->open_sem); card->open_mode &= ~((file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE)); - up(&card->open_sem); + mutex_unlock(&card->open_sem); wake_up_interruptible(&card->open_wait); unlock_kernel(); diff -puN sound/pcmcia/vx/vxp_mixer.c~sem2mutex-sound-2 sound/pcmcia/vx/vxp_mixer.c --- 25/sound/pcmcia/vx/vxp_mixer.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/pcmcia/vx/vxp_mixer.c Fri Jan 13 15:51:17 2006 @@ -52,14 +52,14 @@ static int vx_mic_level_put(struct snd_k { struct vx_core *_chip = snd_kcontrol_chip(kcontrol); struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip; - down(&_chip->mixer_mutex); + mutex_lock(&_chip->mixer_mutex); if (chip->mic_level != ucontrol->value.integer.value[0]) { vx_set_mic_level(_chip, ucontrol->value.integer.value[0]); chip->mic_level = ucontrol->value.integer.value[0]; - up(&_chip->mixer_mutex); + mutex_unlock(&_chip->mixer_mutex); return 1; } - up(&_chip->mixer_mutex); + mutex_unlock(&_chip->mixer_mutex); return 0; } @@ -95,14 +95,14 @@ static int vx_mic_boost_put(struct snd_k { struct vx_core *_chip = snd_kcontrol_chip(kcontrol); struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip; - down(&_chip->mixer_mutex); + mutex_lock(&_chip->mixer_mutex); if (chip->mic_level != ucontrol->value.integer.value[0]) { vx_set_mic_boost(_chip, ucontrol->value.integer.value[0]); chip->mic_level = ucontrol->value.integer.value[0]; - up(&_chip->mixer_mutex); + mutex_unlock(&_chip->mixer_mutex); return 1; } - up(&_chip->mixer_mutex); + mutex_unlock(&_chip->mixer_mutex); return 0; } diff -puN sound/sparc/cs4231.c~sem2mutex-sound-2 sound/sparc/cs4231.c --- 25/sound/sparc/cs4231.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/sparc/cs4231.c Fri Jan 13 15:51:17 2006 @@ -114,8 +114,8 @@ struct snd_cs4231 { unsigned char image[32]; /* registers image */ int mce_bit; int calibrate_mute; - struct semaphore mce_mutex; - struct semaphore open_mutex; + struct mutex mce_mutex; + struct mutex open_mutex; union { #ifdef SBUS_SUPPORT @@ -774,7 +774,7 @@ static void snd_cs4231_playback_format(s { unsigned long flags; - down(&chip->mce_mutex); + mutex_lock(&chip->mce_mutex); snd_cs4231_calibrate_mute(chip, 1); snd_cs4231_mce_up(chip); @@ -789,7 +789,7 @@ static void snd_cs4231_playback_format(s 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, struct snd_pcm_hw_params *params, @@ -797,7 +797,7 @@ static void snd_cs4231_capture_format(st { unsigned long flags; - down(&chip->mce_mutex); + mutex_lock(&chip->mce_mutex); snd_cs4231_calibrate_mute(chip, 1); snd_cs4231_mce_up(chip); @@ -818,7 +818,7 @@ static void snd_cs4231_capture_format(st snd_cs4231_mce_down(chip); snd_cs4231_calibrate_mute(chip, 0); - up(&chip->mce_mutex); + mutex_unlock(&chip->mce_mutex); } /* @@ -932,14 +932,14 @@ static int snd_cs4231_open(struct snd_cs { unsigned long flags; - down(&chip->open_mutex); + mutex_lock(&chip->open_mutex); if ((chip->mode & mode)) { - 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 */ @@ -959,7 +959,7 @@ static int snd_cs4231_open(struct snd_cs spin_unlock_irqrestore(&chip->lock, flags); chip->mode = mode; - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return 0; } @@ -967,10 +967,10 @@ static void snd_cs4231_close(struct snd_ { 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); @@ -1007,7 +1007,7 @@ static void snd_cs4231_close(struct snd_ snd_cs4231_calibrate_mute(chip, 0); chip->mode = 0; - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); } /* @@ -1968,8 +1968,8 @@ static int __init snd_cs4231_sbus_create spin_lock_init(&chip->lock); spin_lock_init(&chip->c_dma.sbus_info.lock); spin_lock_init(&chip->p_dma.sbus_info.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->dev_u.sdev = sdev; chip->regs_size = sdev->reg_addrs[0].reg_size; @@ -2156,8 +2156,8 @@ static int __init snd_cs4231_ebus_create spin_lock_init(&chip->lock); spin_lock_init(&chip->c_dma.ebus_info.lock); spin_lock_init(&chip->p_dma.ebus_info.lock); - init_MUTEX(&chip->mce_mutex); - init_MUTEX(&chip->open_mutex); + mutex_init(&chip->mce_mutex); + mutex_init(&chip->open_mutex); chip->flags |= CS4231_FLAG_EBUS; chip->card = card; chip->dev_u.pdev = edev->bus->self; diff -puN sound/synth/emux/emux.c~sem2mutex-sound-2 sound/synth/emux/emux.c --- 25/sound/synth/emux/emux.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/synth/emux/emux.c Fri Jan 13 15:51:17 2006 @@ -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 diff -puN sound/synth/emux/emux_oss.c~sem2mutex-sound-2 sound/synth/emux/emux_oss.c --- 25/sound/synth/emux/emux_oss.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/synth/emux/emux_oss.c Fri Jan 13 15:51:17 2006 @@ -117,10 +117,10 @@ snd_emux_open_seq_oss(struct snd_seq_oss 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 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 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_os 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; } diff -puN sound/synth/emux/emux_proc.c~sem2mutex-sound-2 sound/synth/emux/emux_proc.c --- 25/sound/synth/emux/emux_proc.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/synth/emux/emux_proc.c Fri Jan 13 15:51:17 2006 @@ -37,7 +37,7 @@ snd_emux_proc_info_read(struct snd_info_ 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_ 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_ 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); } diff -puN sound/synth/emux/emux_seq.c~sem2mutex-sound-2 sound/synth/emux/emux_seq.c --- 25/sound/synth/emux/emux_seq.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/synth/emux/emux_seq.c Fri Jan 13 15:51:17 2006 @@ -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 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, struc 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; } diff -puN sound/synth/emux/soundfont.c~sem2mutex-sound-2 sound/synth/emux/soundfont.c --- 25/sound/synth/emux/soundfont.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/synth/emux/soundfont.c Fri Jan 13 15:51:17 2006 @@ -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 *callb 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; diff -puN sound/usb/usx2y/usbusx2yaudio.c~sem2mutex-sound-2 sound/usb/usx2y/usbusx2yaudio.c --- 25/sound/usb/usx2y/usbusx2yaudio.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/usb/usx2y/usbusx2yaudio.c Fri Jan 13 15:51:17 2006 @@ -811,7 +811,7 @@ static int snd_usX2Y_pcm_hw_free(struct { struct snd_pcm_runtime *runtime = substream->runtime; struct snd_usX2Y_substream *subs = runtime->private_data; - down(&subs->usX2Y->prepare_mutex); + mutex_lock(&subs->usX2Y->prepare_mutex); snd_printdd("snd_usX2Y_hw_free(%p)\n", substream); if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { @@ -832,7 +832,7 @@ static int snd_usX2Y_pcm_hw_free(struct usX2Y_urbs_release(subs); } } - up(&subs->usX2Y->prepare_mutex); + mutex_unlock(&subs->usX2Y->prepare_mutex); return snd_pcm_lib_free_pages(substream); } /* @@ -849,7 +849,7 @@ static int snd_usX2Y_pcm_prepare(struct int err = 0; snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream); - down(&usX2Y->prepare_mutex); + mutex_lock(&usX2Y->prepare_mutex); usX2Y_subs_prepare(subs); // Start hardware streams // SyncStream first.... @@ -869,7 +869,7 @@ static int snd_usX2Y_pcm_prepare(struct err = usX2Y_urbs_start(subs); up_prepare_mutex: - up(&usX2Y->prepare_mutex); + mutex_unlock(&usX2Y->prepare_mutex); return err; } diff -puN sound/usb/usx2y/usbusx2y.c~sem2mutex-sound-2 sound/usb/usx2y/usbusx2y.c --- 25/sound/usb/usx2y/usbusx2y.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/usb/usx2y/usbusx2y.c Fri Jan 13 15:51:17 2006 @@ -351,7 +351,7 @@ static struct snd_card *usX2Y_create_car usX2Y(card)->chip.dev = device; usX2Y(card)->chip.card = card; init_waitqueue_head(&usX2Y(card)->prepare_wait_queue); - init_MUTEX (&usX2Y(card)->prepare_mutex); + mutex_init(&usX2Y(card)->prepare_mutex); INIT_LIST_HEAD(&usX2Y(card)->chip.midi_list); strcpy(card->driver, "USB "NAME_ALLCAPS""); sprintf(card->shortname, "TASCAM "NAME_ALLCAPS""); diff -puN sound/usb/usx2y/usbusx2y.h~sem2mutex-sound-2 sound/usb/usx2y/usbusx2y.h --- 25/sound/usb/usx2y/usbusx2y.h~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/usb/usx2y/usbusx2y.h Fri Jan 13 15:51:17 2006 @@ -34,7 +34,7 @@ struct usX2Ydev { unsigned int rate, format; int chip_status; - struct semaphore prepare_mutex; + struct mutex prepare_mutex; struct us428ctls_sharedmem *us428ctls_sharedmem; int wait_iso_frame; wait_queue_head_t us428ctls_wait_queue_head; diff -puN sound/usb/usx2y/usx2yhwdeppcm.c~sem2mutex-sound-2 sound/usb/usx2y/usx2yhwdeppcm.c --- 25/sound/usb/usx2y/usx2yhwdeppcm.c~sem2mutex-sound-2 Fri Jan 13 15:51:17 2006 +++ 25-akpm/sound/usb/usx2y/usx2yhwdeppcm.c Fri Jan 13 15:51:17 2006 @@ -366,7 +366,7 @@ static int snd_usX2Y_usbpcm_hw_free(stru struct snd_pcm_runtime *runtime = substream->runtime; struct snd_usX2Y_substream *subs = runtime->private_data, *cap_subs2 = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE + 2]; - down(&subs->usX2Y->prepare_mutex); + mutex_lock(&subs->usX2Y->prepare_mutex); snd_printdd("snd_usX2Y_usbpcm_hw_free(%p)\n", substream); if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { @@ -395,7 +395,7 @@ static int snd_usX2Y_usbpcm_hw_free(stru usX2Y_usbpcm_urbs_release(cap_subs2); } } - up(&subs->usX2Y->prepare_mutex); + mutex_unlock(&subs->usX2Y->prepare_mutex); return snd_pcm_lib_free_pages(substream); } @@ -503,7 +503,7 @@ static int snd_usX2Y_usbpcm_prepare(stru memset(usX2Y->hwdep_pcm_shm, 0, sizeof(struct snd_usX2Y_hwdep_pcm_shm)); } - down(&usX2Y->prepare_mutex); + mutex_lock(&usX2Y->prepare_mutex); usX2Y_subs_prepare(subs); // Start hardware streams // SyncStream first.... @@ -544,7 +544,7 @@ static int snd_usX2Y_usbpcm_prepare(stru usX2Y->hwdep_pcm_shm->capture_iso_start = -1; up_prepare_mutex: - up(&usX2Y->prepare_mutex); + mutex_unlock(&usX2Y->prepare_mutex); return err; } @@ -621,7 +621,7 @@ static int usX2Y_pcms_lock_check(struct if (dev->type != SNDRV_DEV_PCM) continue; pcm = dev->device_data; - down(&pcm->open_mutex); + mutex_lock(&pcm->open_mutex); } list_for_each(list, &card->devices) { int s; @@ -650,7 +650,7 @@ static void usX2Y_pcms_unlock(struct snd if (dev->type != SNDRV_DEV_PCM) continue; pcm = dev->device_data; - up(&pcm->open_mutex); + mutex_unlock(&pcm->open_mutex); } } _