diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-01-24 17:47:17 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-01-24 17:47:17 +0100 |
commit | 9040d102da5635abc306372bb4dbffaba92c478e (patch) | |
tree | b6674ae2c98ab64d78c78b7623e51e676bacd55f /sound/pci/hda/patch_via.c | |
parent | b9c590bbf1d7621c3f9feb6ac0992d638244d0b1 (diff) | |
download | linux-stable-9040d102da5635abc306372bb4dbffaba92c478e.tar.gz linux-stable-9040d102da5635abc306372bb4dbffaba92c478e.tar.bz2 linux-stable-9040d102da5635abc306372bb4dbffaba92c478e.zip |
ALSA: hda - Add snd_hda_check_power_state() helper function
... for small refactoring.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_via.c')
-rw-r--r-- | sound/pci/hda/patch_via.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 5bd4b0c10003..9641c0e487bb 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -240,10 +240,7 @@ static void set_widgets_power_state(struct hda_codec *codec) static void update_power_state(struct hda_codec *codec, hda_nid_t nid, unsigned int parm) { - unsigned int state = snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_POWER_STATE, 0); - state = (state >> 4) & 0x0f; - if (state == parm) + if (snd_hda_check_power_state(codec, nid, parm)) return; snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, parm); } @@ -253,10 +250,8 @@ static void update_conv_power_state(struct hda_codec *codec, hda_nid_t nid, { struct via_spec *spec = codec->spec; unsigned int format; - unsigned int state = snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_POWER_STATE, 0); - state = (state >> 4) & 0x0f; - if (state == parm) + + if (snd_hda_check_power_state(codec, nid, parm)) return; format = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); if (format && (spec->dac_stream_tag[index] != format)) |