]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
ALSA: hda - minor optimization in hda_set_power_state()
authorTakashi Iwai <tiwai@suse.de>
Tue, 21 Apr 2009 11:37:29 +0000 (13:37 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 21 Apr 2009 11:38:30 +0000 (13:38 +0200)
Check the target power-state before checking EAPD exception to reduce
unneeded verb executions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c

index b649033a4c8181549be2a6a460cdf3263ea28b32..b91f6ed5cc58d5c30c82e506a5879b0fb9c4ea6a 100644 (file)
@@ -2348,7 +2348,8 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
                if (wcaps & AC_WCAP_POWER) {
                        unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >>
                                AC_WCAP_TYPE_SHIFT;
-                       if (wid_type == AC_WID_PIN) {
+                       if (power_state == AC_PWRST_D3 &&
+                           wid_type == AC_WID_PIN) {
                                unsigned int pincap;
                                /*
                                 * don't power down the widget if it controls
@@ -2360,7 +2361,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
                                                nid, 0,
                                                AC_VERB_GET_EAPD_BTLENABLE, 0);
                                        eapd &= 0x02;
-                                       if (power_state == AC_PWRST_D3 && eapd)
+                                       if (eapd)
                                                continue;
                                }
                        }