Skip to content

Commit 6eb827d

Browse files
committed
ALSA: hda - Move runtime PM check to runtime_idle callback
The runtime_idle callback is the right place to check the suspend capability, but currently we do it wrongly in the runtime_suspend callback. This leads to a kernel error message like: pci_pm_runtime_suspend(): azx_runtime_suspend+0x0/0x50 [snd_hda_intel] returns -11 and the runtime PM core would even repeat the attempts. Reported-and-tested-by: Borislav Petkov <bp@alien8.de> Cc: <stable@vger.kernel.org> [v3.7] Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 63a077e commit 6eb827d

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

sound/pci/hda/hda_intel.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2691,10 +2691,6 @@ static int azx_runtime_suspend(struct device *dev)
26912691
struct snd_card *card = dev_get_drvdata(dev);
26922692
struct azx *chip = card->private_data;
26932693

2694-
if (!power_save_controller ||
2695-
!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
2696-
return -EAGAIN;
2697-
26982694
azx_stop_chip(chip);
26992695
azx_clear_irq_pending(chip);
27002696
return 0;
@@ -2709,12 +2705,25 @@ static int azx_runtime_resume(struct device *dev)
27092705
azx_init_chip(chip, 1);
27102706
return 0;
27112707
}
2708+
2709+
static int azx_runtime_idle(struct device *dev)
2710+
{
2711+
struct snd_card *card = dev_get_drvdata(dev);
2712+
struct azx *chip = card->private_data;
2713+
2714+
if (!power_save_controller ||
2715+
!(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
2716+
return -EBUSY;
2717+
2718+
return 0;
2719+
}
2720+
27122721
#endif /* CONFIG_PM_RUNTIME */
27132722

27142723
#ifdef CONFIG_PM
27152724
static const struct dev_pm_ops azx_pm = {
27162725
SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume)
2717-
SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, NULL)
2726+
SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, azx_runtime_idle)
27182727
};
27192728

27202729
#define AZX_PM_OPS &azx_pm

0 commit comments

Comments
 (0)