static void snd_ac97_proc_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer)
{
- ac97_t *ac97 = snd_magic_cast(ac97_t, entry->private_data, return);
+ ac97_t *ac97 = entry->private_data;
+ down(&ac97->mutex);
if ((ac97->id & 0xffffff40) == AC97_ID_AD1881) { // Analog Devices AD1881/85/86
int idx;
- down(&ac97->spec.ad18xx.mutex);
for (idx = 0; idx < 3; idx++)
if (ac97->spec.ad18xx.id[idx]) {
/* select single codec */
}
/* select all codecs */
snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, 0x7000);
- up(&ac97->spec.ad18xx.mutex);
snd_iprintf(buffer, "\nAD18XX configuration\n");
snd_iprintf(buffer, "Unchained : 0x%04x,0x%04x,0x%04x\n",
} else {
snd_ac97_proc_read_main(ac97, buffer, 0);
}
+ up(&ac97->mutex);
}
#ifdef CONFIG_SND_DEBUG
/* direct register write for debugging */
static void snd_ac97_proc_regs_write(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
{
- ac97_t *ac97 = snd_magic_cast(ac97_t, entry->private_data, return);
+ ac97_t *ac97 = entry->private_data;
char line[64];
unsigned int reg, val;
+ down(&ac97->mutex);
while (!snd_info_get_line(buffer, line, sizeof(line))) {
if (sscanf(line, "%x %x", ®, &val) != 2)
continue;
- /* register must be odd */
+ /* register must be even */
if (reg < 0x80 && (reg & 1) == 0 && val <= 0xffff)
snd_ac97_write_cache(ac97, reg, val);
}
+ up(&ac97->mutex);
}
#endif
static void snd_ac97_proc_regs_read(snd_info_entry_t *entry,
snd_info_buffer_t * buffer)
{
- ac97_t *ac97 = snd_magic_cast(ac97_t, entry->private_data, return);
+ ac97_t *ac97 = entry->private_data;
+ down(&ac97->mutex);
if ((ac97->id & 0xffffff40) == AC97_ID_AD1881) { // Analog Devices AD1881/85/86
int idx;
- down(&ac97->spec.ad18xx.mutex);
for (idx = 0; idx < 3; idx++)
if (ac97->spec.ad18xx.id[idx]) {
/* select single codec */
}
/* select all codecs */
snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, 0x7000);
- up(&ac97->spec.ad18xx.mutex);
} else {
snd_ac97_proc_regs_read_main(ac97, buffer, 0);
}
+ up(&ac97->mutex);
}
void snd_ac97_proc_init(ac97_t * ac97)