diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-06-28 06:45:47 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-06-29 02:01:46 -0400 |
commit | 8d087c7600499463b7b8e3d4da4da40669cb8bfa (patch) | |
tree | 817ba350193d4c1cd77546dbd0bbe0d68ee14ecf /sound/pci/hda/patch_conexant.c | |
parent | 63f10d2ca78c17cdd612c1daee7daffacca8b7fb (diff) |
ALSA: hda - Create snd_hda_get_conn_index() helper function
Create snd_hda_get_conn_index() helper function for obtaining the
connection index of the widget. Replaced the similar codes used in
several codec-drivers with this common helper.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_conexant.c')
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 6e864276b744..40cf7f16f587 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -3308,19 +3308,8 @@ static const struct hda_pcm_stream cx_auto_pcm_analog_capture = { | |||
3308 | 3308 | ||
3309 | static const hda_nid_t cx_auto_adc_nids[] = { 0x14 }; | 3309 | static const hda_nid_t cx_auto_adc_nids[] = { 0x14 }; |
3310 | 3310 | ||
3311 | /* get the connection index of @nid in the widget @mux */ | 3311 | #define get_connection_index(codec, mux, nid)\ |
3312 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, | 3312 | snd_hda_get_conn_index(codec, mux, nid, 0) |
3313 | hda_nid_t nid) | ||
3314 | { | ||
3315 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | ||
3316 | int i, nums; | ||
3317 | |||
3318 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); | ||
3319 | for (i = 0; i < nums; i++) | ||
3320 | if (conn[i] == nid) | ||
3321 | return i; | ||
3322 | return -1; | ||
3323 | } | ||
3324 | 3313 | ||
3325 | /* get an unassigned DAC from the given list. | 3314 | /* get an unassigned DAC from the given list. |
3326 | * Return the nid if found and reduce the DAC list, or return zero if | 3315 | * Return the nid if found and reduce the DAC list, or return zero if |