summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_cmedia.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-06-28 12:45:47 +0200
committerTakashi Iwai <tiwai@suse.de>2011-06-29 08:01:46 +0200
commit8d087c7600499463b7b8e3d4da4da40669cb8bfa (patch)
tree817ba350193d4c1cd77546dbd0bbe0d68ee14ecf /sound/pci/hda/patch_cmedia.c
parent63f10d2ca78c17cdd612c1daee7daffacca8b7fb (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_cmedia.c')
-rw-r--r--sound/pci/hda/patch_cmedia.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index 9eaf99b01ae..08af4847c07 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -403,7 +403,6 @@ static int cmi9880_fill_multi_init(struct hda_codec *codec, const struct auto_pi
/* clear the table, only one c-media dac assumed here */
memset(spec->multi_init, 0, sizeof(spec->multi_init));
for (j = 0, i = 0; i < cfg->line_outs; i++) {
- hda_nid_t conn[4];
nid = cfg->line_out_pins[i];
/* set as output */
spec->multi_init[j].nid = nid;
@@ -416,12 +415,10 @@ static int cmi9880_fill_multi_init(struct hda_codec *codec, const struct auto_pi
spec->multi_init[j].verb = AC_VERB_SET_CONNECT_SEL;
spec->multi_init[j].param = 0;
/* find the index in connect list */
- len = snd_hda_get_connections(codec, nid, conn, 4);
- for (k = 0; k < len; k++)
- if (conn[k] == spec->dac_nids[i]) {
- spec->multi_init[j].param = k;
- break;
- }
+ k = snd_hda_get_conn_index(codec, nid,
+ spec->dac_nids[i], 0);
+ if (k >= 0)
+ spec->multi_init[j].param = k;
j++;
}
}