Skip to content

Commit 963afde

Browse files
committed
ALSA: hda/via - Clean up duplicated codes
The previous commit was written in the way to make the backport to 3.9.y easier, and left the duplicated open codes intentionally. Now let's clean up the duplicated codes. Signed-off-by: Takashi Iwai <[email protected]>
1 parent 5a6f294 commit 963afde

File tree

1 file changed

+12
-30
lines changed

1 file changed

+12
-30
lines changed

sound/pci/hda/hda_generic.c

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,17 +1940,7 @@ static int create_speaker_out_ctls(struct hda_codec *codec)
19401940
* independent HP controls
19411941
*/
19421942

1943-
/* update HP auto-mute state too */
1944-
static void update_hp_automute_hook(struct hda_codec *codec)
1945-
{
1946-
struct hda_gen_spec *spec = codec->spec;
1947-
1948-
if (spec->hp_automute_hook)
1949-
spec->hp_automute_hook(codec, NULL);
1950-
else
1951-
snd_hda_gen_hp_automute(codec, NULL);
1952-
}
1953-
1943+
static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack);
19541944
static int indep_hp_info(struct snd_kcontrol *kcontrol,
19551945
struct snd_ctl_elem_info *uinfo)
19561946
{
@@ -2011,7 +2001,7 @@ static int indep_hp_put(struct snd_kcontrol *kcontrol,
20112001
else
20122002
*dacp = spec->alt_dac_nid;
20132003

2014-
update_hp_automute_hook(codec);
2004+
call_hp_automute(codec, NULL);
20152005
ret = 1;
20162006
}
20172007
unlock:
@@ -2307,7 +2297,7 @@ static void update_hp_mic(struct hda_codec *codec, int adc_mux, bool force)
23072297
else
23082298
val = PIN_HP;
23092299
set_pin_target(codec, pin, val, true);
2310-
update_hp_automute_hook(codec);
2300+
call_hp_automute(codec, NULL);
23112301
}
23122302
}
23132303

@@ -2716,7 +2706,7 @@ static int hp_mic_jack_mode_put(struct snd_kcontrol *kcontrol,
27162706
val = snd_hda_get_default_vref(codec, nid);
27172707
}
27182708
snd_hda_set_pin_ctl_cache(codec, nid, val);
2719-
update_hp_automute_hook(codec);
2709+
call_hp_automute(codec, NULL);
27202710

27212711
return 1;
27222712
}
@@ -3861,22 +3851,6 @@ void snd_hda_gen_mic_autoswitch(struct hda_codec *codec, struct hda_jack_tbl *ja
38613851
}
38623852
EXPORT_SYMBOL_HDA(snd_hda_gen_mic_autoswitch);
38633853

3864-
/* update jack retasking */
3865-
static void update_automute_all(struct hda_codec *codec)
3866-
{
3867-
struct hda_gen_spec *spec = codec->spec;
3868-
3869-
update_hp_automute_hook(codec);
3870-
if (spec->line_automute_hook)
3871-
spec->line_automute_hook(codec, NULL);
3872-
else
3873-
snd_hda_gen_line_automute(codec, NULL);
3874-
if (spec->mic_autoswitch_hook)
3875-
spec->mic_autoswitch_hook(codec, NULL);
3876-
else
3877-
snd_hda_gen_mic_autoswitch(codec, NULL);
3878-
}
3879-
38803854
/* call appropriate hooks */
38813855
static void call_hp_automute(struct hda_codec *codec, struct hda_jack_tbl *jack)
38823856
{
@@ -3907,6 +3881,14 @@ static void call_mic_autoswitch(struct hda_codec *codec,
39073881
snd_hda_gen_mic_autoswitch(codec, jack);
39083882
}
39093883

3884+
/* update jack retasking */
3885+
static void update_automute_all(struct hda_codec *codec)
3886+
{
3887+
call_hp_automute(codec, NULL);
3888+
call_line_automute(codec, NULL);
3889+
call_mic_autoswitch(codec, NULL);
3890+
}
3891+
39103892
/*
39113893
* Auto-Mute mode mixer enum support
39123894
*/

0 commit comments

Comments
 (0)