ALSA: hda - Consolidate cap_sync_hook and capture_switch_hook
authorTakashi Iwai <tiwai@suse.de>
Fri, 18 Jan 2013 13:10:00 +0000 (14:10 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 18 Jan 2013 13:34:22 +0000 (14:34 +0100)
commita90229e0517938a5c5d9d682708b6ee7cd0e19b9
tree1fb5352f62bbc699feb24fa9c38a47d5f00de5eb
parenta35bd1e3e6eadba210faedf93354c7657dd59238
ALSA: hda - Consolidate cap_sync_hook and capture_switch_hook

Two hooks in hda_gen_spec, cap_sync_hook and capture_switch_hook, play
very similar roles.  The only differences are that the former is
called more often (e.g. at init or switching capsrc) while the latter
can take an on/off argument.

As a more generic implementation, consolidate these two hooks, and
pass snd_ctl_elem_value pointer as the second argument.  If the
secondary argument is non-NULL, it can take the on/off value, so the
caller handles it like the former capture_switch_hook.  If it's NULL,
it's called in the init or capsrc switch case.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_generic.c
sound/pci/hda/hda_generic.h
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_sigmatel.c