mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 02:19:51 +00:00
ALSA: hda - Check validity of CORB/RIRB WP reads
When the HD-audio controller is disabled (e.g. via vga switcheroo) but the driver is still accessing it, it spews floods of "spurious response" kernel messages. It's because CORB/RIRB WP reads 0xff, and the driver tries to fill up until this number. This patch changes the CORB/RIRB WP reads to word instead of byte, and add the check of the read value. If it's 0xffff, the controller is supposed to be disabled, so the further action will be skipped. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
fa348da53b
commit
cc5ede3efd
1 changed files with 12 additions and 2 deletions
|
@ -799,7 +799,12 @@ static int azx_corb_send_cmd(struct hda_bus *bus, u32 val)
|
||||||
spin_lock_irq(&chip->reg_lock);
|
spin_lock_irq(&chip->reg_lock);
|
||||||
|
|
||||||
/* add command to corb */
|
/* add command to corb */
|
||||||
wp = azx_readb(chip, CORBWP);
|
wp = azx_readw(chip, CORBWP);
|
||||||
|
if (wp == 0xffff) {
|
||||||
|
/* something wrong, controller likely turned to D3 */
|
||||||
|
spin_unlock_irq(&chip->reg_lock);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
wp++;
|
wp++;
|
||||||
wp %= ICH6_MAX_CORB_ENTRIES;
|
wp %= ICH6_MAX_CORB_ENTRIES;
|
||||||
|
|
||||||
|
@ -821,7 +826,12 @@ static void azx_update_rirb(struct azx *chip)
|
||||||
unsigned int addr;
|
unsigned int addr;
|
||||||
u32 res, res_ex;
|
u32 res, res_ex;
|
||||||
|
|
||||||
wp = azx_readb(chip, RIRBWP);
|
wp = azx_readw(chip, RIRBWP);
|
||||||
|
if (wp == 0xffff) {
|
||||||
|
/* something wrong, controller likely turned to D3 */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (wp == chip->rirb.wp)
|
if (wp == chip->rirb.wp)
|
||||||
return;
|
return;
|
||||||
chip->rirb.wp = wp;
|
chip->rirb.wp = wp;
|
||||||
|
|
Loading…
Reference in a new issue