From patchwork Tue May 27 07:12:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Henningsson X-Patchwork-Id: 4246231 X-Patchwork-Delegate: tiwai@suse.de 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6691EBF90B for ; Tue, 27 May 2014 07:13:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EA554202D1 for ; Tue, 27 May 2014 07:13:13 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 261C820272 for ; Tue, 27 May 2014 07:13:09 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id E306E265554; Tue, 27 May 2014 09:13:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: 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 B2CFC265521; Tue, 27 May 2014 09:12:52 +0200 (CEST) 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 D81CE265521; Tue, 27 May 2014 09:12:51 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by alsa0.perex.cz (Postfix) with ESMTP id 5E5D226554C for ; Tue, 27 May 2014 09:12:40 +0200 (CEST) Received: from hd9483857.selulk5.dyn.perspektivbredband.net ([217.72.56.87] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1WpBYt-0005LT-Rj; Tue, 27 May 2014 07:12:39 +0000 From: David Henningsson To: tiwai@suse.de, alsa-devel@alsa-project.org Date: Tue, 27 May 2014 09:12:36 +0200 Message-Id: <1401174756-10729-1-git-send-email-david.henningsson@canonical.com> X-Mailer: git-send-email 1.9.1 Cc: David Henningsson Subject: [alsa-devel] [PATCH] hdajackretask: Make sure codecs do not show up twice under 3.15 kernel 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP On a 3.15 based kernel, both "hdaudioC*D*" and "hwC*D*" shows up under /sys/class/sound, and pointing to the same object. Make sure we only match on the hwC*D* name to avoid duplicate entries. Signed-off-by: David Henningsson --- hdajackretask/sysfs-pin-configs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hdajackretask/sysfs-pin-configs.c b/hdajackretask/sysfs-pin-configs.c index 4044989..5bae0f9 100644 --- a/hdajackretask/sysfs-pin-configs.c +++ b/hdajackretask/sysfs-pin-configs.c @@ -20,8 +20,10 @@ int get_codec_name_list(codec_name_t* names, int entries) const gchar* dirname = g_dir_read_name(sysdir); if (!dirname) break; + /* Split e g "hwC0D1" into "hw", "0" and "1" */ cd = g_strsplit_set(dirname, "CD", 9); ok = g_strv_length(cd) == 3; + ok &= strcmp(cd[0], "hw") == 0; if (ok) { gchar* filetest = g_strdup_printf("/sys/class/sound/%s/init_pin_configs", dirname); ok = g_file_test(filetest, G_FILE_TEST_IS_REGULAR);