[alsa-devel] [PATCH] ALSA: hda - Make path_has_mixer() tristate

Takashi Iwai tiwai at suse.de
Wed Mar 4 12:48:38 CET 2015


At Tue, 03 Mar 2015 12:20:02 +0100,
Ingo Brückl wrote:
> 
> ... in order to distinguish whether there is no ctl or no path at all.
> 
> It is used as !path_has_mixer() which means that it is true even if
> there is no path at all. For headphone or speaker outs without path,
> because they don't have a DAC assign to them, this would give a false
> positive result.

Do you mean the code checking hp_lo_shared and spk_lo_shared in
get_line_out_pfx()?  How can they be no path?


Takashi

> Signed-off-by: Ingo Brückl <ib at wupperonline.de>
> 
> diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
> index b680b4e..ecee349 100644
> --- a/sound/pci/hda/hda_generic.c
> +++ b/sound/pci/hda/hda_generic.c
> @@ -1035,11 +1035,11 @@ static int hda_gen_bind_mute_put(struct snd_kcontrol *kcontrol,
>  	return snd_hda_mixer_bind_switch_put(kcontrol, ucontrol);
>  }
> 
> -/* any ctl assigned to the path with the given index? */
> -static bool path_has_mixer(struct hda_codec *codec, int path_idx, int ctl_type)
> +/* any ctl assigned to the path (if one at all) with the given index? */
> +static int path_has_mixer(struct hda_codec *codec, int path_idx, int ctl_type)
>  {
>  	struct nid_path *path = snd_hda_get_path_from_idx(codec, path_idx);
> -	return path && path->ctls[ctl_type];
> +	return path ? path->ctls[ctl_type] : -1;
>  }
> 
>  static const char * const channel_name[4] = {
> --
> 1.7.10
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 


More information about the Alsa-devel mailing list