diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-01-23 17:07:23 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-01-23 17:07:23 +0100 |
commit | 3e367f155f3ba90b761497ab9e0343dc54778469 (patch) | |
tree | 3151586f23613c91e63e28b16eb3c9ba94b94804 /sound/pci | |
parent | e4a395e7819b1e666b2e9da22234059f403dbc11 (diff) | |
download | op-kernel-dev-3e367f155f3ba90b761497ab9e0343dc54778469.zip op-kernel-dev-3e367f155f3ba90b761497ab9e0343dc54778469.tar.gz |
ALSA: hda - Small code refactoring about path re-initialization
Introduce a helper function to do the same thing.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/hda_generic.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 06e203d..921582d 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -735,6 +735,14 @@ static void set_pin_eapd(struct hda_codec *codec, hda_nid_t pin, bool enable) enable ? 0x02 : 0x00); } +/* re-initialize the path specified by the given path index */ +static void resume_path_from_idx(struct hda_codec *codec, int path_idx) +{ + struct nid_path *path = snd_hda_get_path_from_idx(codec, path_idx); + if (path) + snd_hda_activate_path(codec, path, path->active, false); +} + /* * Helper functions for creating mixer ctl elements @@ -4684,16 +4692,8 @@ static void init_analog_input(struct hda_codec *codec) /* init loopback inputs */ if (spec->mixer_nid) { - struct nid_path *path; - path = snd_hda_get_path_from_idx(codec, spec->loopback_paths[i]); - if (path) - snd_hda_activate_path(codec, path, - path->active, false); - path = snd_hda_get_path_from_idx(codec, - spec->loopback_merge_path); - if (path) - snd_hda_activate_path(codec, path, path->active, - false); + resume_path_from_idx(codec, spec->loopback_paths[i]); + resume_path_from_idx(codec, spec->loopback_merge_path); } } } @@ -4741,11 +4741,8 @@ static void init_digital(struct hda_codec *codec) set_output_and_unmute(codec, spec->digout_paths[i]); pin = spec->autocfg.dig_in_pin; if (pin) { - struct nid_path *path; restore_pin_ctl(codec, pin); - path = snd_hda_get_path_from_idx(codec, spec->digin_path); - if (path) - snd_hda_activate_path(codec, path, path->active, false); + resume_path_from_idx(codec, spec->digin_path); } } |