From 8d087c7600499463b7b8e3d4da4da40669cb8bfa Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 28 Jun 2011 12:45:47 +0200 Subject: 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 --- sound/pci/hda/patch_realtek.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'sound/pci/hda/patch_realtek.c') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index cf383ede281..7b96dcef2c6 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -1195,18 +1195,8 @@ static void alc_line_automute(struct hda_codec *codec) update_speakers(codec); } -static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, - hda_nid_t nid) -{ - hda_nid_t conn[HDA_MAX_NUM_INPUTS]; - int i, nums; - - nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); - for (i = 0; i < nums; i++) - if (conn[i] == nid) - return i; - return -1; -} +#define get_connection_index(codec, mux, nid) \ + snd_hda_get_conn_index(codec, mux, nid, 0) /* switch the current ADC according to the jack state */ static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec) -- cgit v1.2.3