}
 EXPORT_SYMBOL_GPL(snd_hda_codec_set_power_to_all);
 
-/*
- * wait until the state is reached, returns the current state
- */
-static unsigned int hda_sync_power_state(struct hda_codec *codec,
-                                        hda_nid_t fg,
-                                        unsigned int power_state)
-{
-       unsigned long end_time = jiffies + msecs_to_jiffies(500);
-       unsigned int state, actual_state;
-
-       for (;;) {
-               state = snd_hda_codec_read(codec, fg, 0,
-                                          AC_VERB_GET_POWER_STATE, 0);
-               if (state & AC_PWRST_ERROR)
-                       break;
-               actual_state = (state >> 4) & 0x0f;
-               if (actual_state == power_state)
-                       break;
-               if (time_after_eq(jiffies, end_time))
-                       break;
-               /* wait until the codec reachs to the target state */
-               msleep(1);
-       }
-       return state;
-}
-
 /**
  * snd_hda_codec_eapd_power_filter - A power filter callback for EAPD
  * @codec: the HDA codec
                                                   state);
                        snd_hda_codec_set_power_to_all(codec, fg, power_state);
                }
-               state = hda_sync_power_state(codec, fg, power_state);
+               state = snd_hda_sync_power_state(codec, fg, power_state);
                if (!(state & AC_PWRST_ERROR))
                        break;
        }
 
 {
        return snd_hdac_check_power_state(&codec->core, nid, target_state);
 }
-
+static inline bool snd_hda_sync_power_state(struct hda_codec *codec,
+                          hda_nid_t nid, unsigned int target_state)
+{
+       return snd_hdac_sync_power_state(&codec->core, nid, target_state);
+}
 unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec,
                                             hda_nid_t nid,
                                             unsigned int power_state);