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_cirrus.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_cirrus.c')
-rw-r--r-- | sound/pci/hda/patch_cirrus.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index c7b5ca28fa77..7f93739b1e33 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -346,21 +346,15 @@ static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin, | |||
346 | 346 | ||
347 | nid = codec->start_nid; | 347 | nid = codec->start_nid; |
348 | for (i = 0; i < codec->num_nodes; i++, nid++) { | 348 | for (i = 0; i < codec->num_nodes; i++, nid++) { |
349 | hda_nid_t pins[2]; | ||
350 | unsigned int type; | 349 | unsigned int type; |
351 | int j, nums; | 350 | int idx; |
352 | type = get_wcaps_type(get_wcaps(codec, nid)); | 351 | type = get_wcaps_type(get_wcaps(codec, nid)); |
353 | if (type != AC_WID_AUD_IN) | 352 | if (type != AC_WID_AUD_IN) |
354 | continue; | 353 | continue; |
355 | nums = snd_hda_get_connections(codec, nid, pins, | 354 | idx = snd_hda_get_conn_index(codec, nid, pin, 0); |
356 | ARRAY_SIZE(pins)); | 355 | if (idx >= 0) { |
357 | if (nums <= 0) | 356 | *idxp = idx; |
358 | continue; | 357 | return nid; |
359 | for (j = 0; j < nums; j++) { | ||
360 | if (pins[j] == pin) { | ||
361 | *idxp = j; | ||
362 | return nid; | ||
363 | } | ||
364 | } | 358 | } |
365 | } | 359 | } |
366 | return 0; | 360 | return 0; |