[ALSA] semaphore -> mutex (PCI part)
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:

committed by
Jaroslav Kysela

parent
8b7547f95c
commit
62932df8fb
@@ -28,6 +28,7 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/ac97_codec.h>
|
||||
@@ -296,11 +297,11 @@ void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned sh
|
||||
{
|
||||
if (!snd_ac97_valid_reg(ac97, reg))
|
||||
return;
|
||||
down(&ac97->reg_mutex);
|
||||
mutex_lock(&ac97->reg_mutex);
|
||||
ac97->regs[reg] = value;
|
||||
ac97->bus->ops->write(ac97, reg, value);
|
||||
set_bit(reg, ac97->reg_accessed);
|
||||
up(&ac97->reg_mutex);
|
||||
mutex_unlock(&ac97->reg_mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,14 +322,14 @@ int snd_ac97_update(struct snd_ac97 *ac97, unsigned short reg, unsigned short va
|
||||
|
||||
if (!snd_ac97_valid_reg(ac97, reg))
|
||||
return -EINVAL;
|
||||
down(&ac97->reg_mutex);
|
||||
mutex_lock(&ac97->reg_mutex);
|
||||
change = ac97->regs[reg] != value;
|
||||
if (change) {
|
||||
ac97->regs[reg] = value;
|
||||
ac97->bus->ops->write(ac97, reg, value);
|
||||
}
|
||||
set_bit(reg, ac97->reg_accessed);
|
||||
up(&ac97->reg_mutex);
|
||||
mutex_unlock(&ac97->reg_mutex);
|
||||
return change;
|
||||
}
|
||||
|
||||
@@ -351,9 +352,9 @@ int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned sho
|
||||
|
||||
if (!snd_ac97_valid_reg(ac97, reg))
|
||||
return -EINVAL;
|
||||
down(&ac97->reg_mutex);
|
||||
mutex_lock(&ac97->reg_mutex);
|
||||
change = snd_ac97_update_bits_nolock(ac97, reg, mask, value);
|
||||
up(&ac97->reg_mutex);
|
||||
mutex_unlock(&ac97->reg_mutex);
|
||||
return change;
|
||||
}
|
||||
|
||||
@@ -380,12 +381,12 @@ static int snd_ac97_ad18xx_update_pcm_bits(struct snd_ac97 *ac97, int codec, uns
|
||||
int change;
|
||||
unsigned short old, new, cfg;
|
||||
|
||||
down(&ac97->page_mutex);
|
||||
mutex_lock(&ac97->page_mutex);
|
||||
old = ac97->spec.ad18xx.pcmreg[codec];
|
||||
new = (old & ~mask) | value;
|
||||
change = old != new;
|
||||
if (change) {
|
||||
down(&ac97->reg_mutex);
|
||||
mutex_lock(&ac97->reg_mutex);
|
||||
cfg = snd_ac97_read_cache(ac97, AC97_AD_SERIAL_CFG);
|
||||
ac97->spec.ad18xx.pcmreg[codec] = new;
|
||||
/* select single codec */
|
||||
@@ -397,9 +398,9 @@ static int snd_ac97_ad18xx_update_pcm_bits(struct snd_ac97 *ac97, int codec, uns
|
||||
/* select all codecs */
|
||||
ac97->bus->ops->write(ac97, AC97_AD_SERIAL_CFG,
|
||||
cfg | 0x7000);
|
||||
up(&ac97->reg_mutex);
|
||||
mutex_unlock(&ac97->reg_mutex);
|
||||
}
|
||||
up(&ac97->page_mutex);
|
||||
mutex_unlock(&ac97->page_mutex);
|
||||
return change;
|
||||
}
|
||||
|
||||
@@ -467,7 +468,7 @@ static int snd_ac97_page_save(struct snd_ac97 *ac97, int reg, struct snd_kcontro
|
||||
(ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_23 &&
|
||||
(reg >= 0x60 && reg < 0x70)) {
|
||||
unsigned short page = (kcontrol->private_value >> 26) & 0x0f;
|
||||
down(&ac97->page_mutex); /* lock paging */
|
||||
mutex_lock(&ac97->page_mutex); /* lock paging */
|
||||
page_save = snd_ac97_read(ac97, AC97_INT_PAGING) & AC97_PAGE_MASK;
|
||||
snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page);
|
||||
}
|
||||
@@ -478,7 +479,7 @@ static void snd_ac97_page_restore(struct snd_ac97 *ac97, int page_save)
|
||||
{
|
||||
if (page_save >= 0) {
|
||||
snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page_save);
|
||||
up(&ac97->page_mutex); /* unlock paging */
|
||||
mutex_unlock(&ac97->page_mutex); /* unlock paging */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -674,12 +675,12 @@ static int snd_ac97_spdif_default_get(struct snd_kcontrol *kcontrol, struct snd_
|
||||
{
|
||||
struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
|
||||
|
||||
down(&ac97->reg_mutex);
|
||||
mutex_lock(&ac97->reg_mutex);
|
||||
ucontrol->value.iec958.status[0] = ac97->spdif_status & 0xff;
|
||||
ucontrol->value.iec958.status[1] = (ac97->spdif_status >> 8) & 0xff;
|
||||
ucontrol->value.iec958.status[2] = (ac97->spdif_status >> 16) & 0xff;
|
||||
ucontrol->value.iec958.status[3] = (ac97->spdif_status >> 24) & 0xff;
|
||||
up(&ac97->reg_mutex);
|
||||
mutex_unlock(&ac97->reg_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -718,7 +719,7 @@ static int snd_ac97_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_
|
||||
}
|
||||
}
|
||||
|
||||
down(&ac97->reg_mutex);
|
||||
mutex_lock(&ac97->reg_mutex);
|
||||
change = ac97->spdif_status != new;
|
||||
ac97->spdif_status = new;
|
||||
|
||||
@@ -746,7 +747,7 @@ static int snd_ac97_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_
|
||||
snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF); /* turn on again */
|
||||
}
|
||||
}
|
||||
up(&ac97->reg_mutex);
|
||||
mutex_unlock(&ac97->reg_mutex);
|
||||
|
||||
return change;
|
||||
}
|
||||
@@ -763,7 +764,7 @@ static int snd_ac97_put_spsa(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
|
||||
|
||||
value = (ucontrol->value.integer.value[0] & mask);
|
||||
|
||||
down(&ac97->reg_mutex);
|
||||
mutex_lock(&ac97->reg_mutex);
|
||||
mask <<= shift;
|
||||
value <<= shift;
|
||||
old = snd_ac97_read_cache(ac97, reg);
|
||||
@@ -777,7 +778,7 @@ static int snd_ac97_put_spsa(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
|
||||
if (extst & AC97_EA_SPDIF)
|
||||
snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF); /* turn on again */
|
||||
}
|
||||
up(&ac97->reg_mutex);
|
||||
mutex_unlock(&ac97->reg_mutex);
|
||||
return change;
|
||||
}
|
||||
|
||||
@@ -888,10 +889,10 @@ static int snd_ac97_ad18xx_pcm_get_volume(struct snd_kcontrol *kcontrol, struct
|
||||
struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol);
|
||||
int codec = kcontrol->private_value & 3;
|
||||
|
||||
down(&ac97->page_mutex);
|
||||
mutex_lock(&ac97->page_mutex);
|
||||
ucontrol->value.integer.value[0] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 0) & 31);
|
||||
ucontrol->value.integer.value[1] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 8) & 31);
|
||||
up(&ac97->page_mutex);
|
||||
mutex_unlock(&ac97->page_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1856,8 +1857,8 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
|
||||
ac97->limited_regs = template->limited_regs;
|
||||
memcpy(ac97->reg_accessed, template->reg_accessed, sizeof(ac97->reg_accessed));
|
||||
bus->codec[ac97->num] = ac97;
|
||||
init_MUTEX(&ac97->reg_mutex);
|
||||
init_MUTEX(&ac97->page_mutex);
|
||||
mutex_init(&ac97->reg_mutex);
|
||||
mutex_init(&ac97->page_mutex);
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
if (ac97->pci) {
|
||||
|
Reference in New Issue
Block a user