ALSA: hda - bug fix on references without checking CONFIG_SND_HDA_POWER_SAVE
The patch to support runtime PM introduced a bug:
Module parameter 'power_save_controller', and the codec flag 'd3_stop_clk'
'd3_stop_clk_ok' are defined only when HDA power save is enabled in config. But
there are references to them without checking macro CONFIG_SND_HDA_POWER_SAVE.
This patch is to fix the bug.
Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 0de1f76..4a2f35c 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1320,11 +1320,13 @@
AC_VERB_GET_SUBSYSTEM_ID, 0);
}
+#ifdef CONFIG_SND_HDA_POWER_SAVE
codec->d3_stop_clk = snd_hda_codec_get_supported_ps(codec,
codec->afg ? codec->afg : codec->mfg,
AC_PWRST_CLKSTOP);
if (!codec->d3_stop_clk)
bus->power_keep_link_on = 1;
+#endif
/* power-up all before initialization */
hda_set_power_state(codec,
@@ -3544,7 +3546,9 @@
int count;
unsigned int state;
+#ifdef CONFIG_SND_HDA_POWER_SAVE
codec->d3_stop_clk_ok = 0;
+#endif
if (codec->patch_ops.set_power_state) {
codec->patch_ops.set_power_state(codec, fg, power_state);
@@ -3569,9 +3573,11 @@
break;
}
+#ifdef CONFIG_SND_HDA_POWER_SAVE
if ((power_state == AC_PWRST_D3)
&& codec->d3_stop_clk && (state & AC_PWRST_CLK_STOP_OK))
codec->d3_stop_clk_ok = 1;
+#endif
}
#ifdef CONFIG_SND_HDA_HWDEP