From patchwork Tue Mar 3 11:20:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ingo Brueckl X-Patchwork-Id: 5921571 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 610FDBF440 for ; Tue, 3 Mar 2015 11:25:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6B39D20225 for ; Tue, 3 Mar 2015 11:25:20 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5113D2021F for ; Tue, 3 Mar 2015 11:25:19 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5DE9B261489; Tue, 3 Mar 2015 12:25:18 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 2963926128B; Tue, 3 Mar 2015 12:25:11 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 26C5A26129A; Tue, 3 Mar 2015 12:25:09 +0100 (CET) Received: from moutD.wup.tal.de (moutd.wup.tal.de [213.240.144.30]) by alsa0.perex.cz (Postfix) with ESMTP id 3CA8B2606F4 for ; Tue, 3 Mar 2015 12:25:02 +0100 (CET) Received: from point.localnet (mue-88-130-96-087.dsl.tropolys.de [88.130.96.87]) (Authenticated sender: ib@wtal.de) by smtp.tal.de (Postfix) with ESMTPA id C642D813FA16; Tue, 3 Mar 2015 12:25:01 +0100 (CET) Received: from ib by point.localnet with local (masqmail 0.2.21) id 1YSkwf-1JD-00; Tue, 03 Mar 2015 12:25:01 +0100 Message-ID: <54f5995b.6dd0d757.bm000@wupperonline.de> From: =?ISO-8859-1?Q?Ingo=20Br=FCckl?= To: alsa-devel@alsa-project.org Date: Tue, 03 Mar 2015 12:20:02 +0100 MIME-Version: 1.0 X-Mailer: blueMail/Linux 1.5 Cc: tiwai@suse.de, superquad.vortex2@gmail.com, david.henningsson@canonical.com Subject: [alsa-devel] [PATCH] ALSA: hda - Make path_has_mixer() tristate X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP ... 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. Signed-off-by: Ingo Brückl --- 1.7.10 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] = {