From patchwork Thu Jan 14 21:05:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Wunner X-Patchwork-Id: 8035421 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 248F19F744 for ; Thu, 14 Jan 2016 21:06:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5962B204EB for ; Thu, 14 Jan 2016 21:06:58 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 2891B204E4 for ; Thu, 14 Jan 2016 21:06:57 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5F44D265D57; Thu, 14 Jan 2016 22:06:56 +0100 (CET) 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, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 08E5326058E; Thu, 14 Jan 2016 22:06:15 +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 9681426058E; Thu, 14 Jan 2016 22:06:14 +0100 (CET) Received: from mailout3.hostsharing.net (mailout3.hostsharing.net [176.9.242.54]) by alsa0.perex.cz (Postfix) with ESMTP id D860326058E for ; Thu, 14 Jan 2016 22:06:09 +0100 (CET) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mailout3.hostsharing.net (Postfix) with ESMTPS id B8227101C05BB; Thu, 14 Jan 2016 22:06:09 +0100 (CET) Received: from localhost (6-38-90-81.adsl.cmo.de [81.90.38.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id 98F06603E11D; Thu, 14 Jan 2016 22:06:08 +0100 (CET) X-Mailbox-Line: From d0a9aefc9315fb3ec6cb3dad1d4260bf16456424 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Lukas Wunner Date: Thu, 14 Jan 2016 22:05:03 +0100 To: Takashi Iwai Cc: Hui Wang , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 1/1] ALSA: hda - Use acpi_dev_present() 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 Use shiny new acpi_dev_present() and remove all the boilerplate to search for a particular ACPI device. No functional change. Cf. 2d12b6b381ba ("ACPI / utils: Add acpi_dev_present()"). Cc: Hui Wang Cc: Takashi Iwai Signed-off-by: Lukas Wunner Acked-by: Hui Wang --- sound/pci/hda/thinkpad_helper.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/sound/pci/hda/thinkpad_helper.c b/sound/pci/hda/thinkpad_helper.c index 0a4ad5f..59ab6ce 100644 --- a/sound/pci/hda/thinkpad_helper.c +++ b/sound/pci/hda/thinkpad_helper.c @@ -10,23 +10,10 @@ static int (*led_set_func)(int, bool); static void (*old_vmaster_hook)(void *, int); -static acpi_status acpi_check_cb(acpi_handle handle, u32 lvl, void *context, - void **rv) -{ - bool *found = context; - *found = true; - return AE_OK; -} - static bool is_thinkpad(struct hda_codec *codec) { - bool found = false; - if (codec->core.subsystem_id >> 16 != 0x17aa) - return false; - if (ACPI_SUCCESS(acpi_get_devices("LEN0068", acpi_check_cb, &found, NULL)) && found) - return true; - found = false; - return ACPI_SUCCESS(acpi_get_devices("IBM0068", acpi_check_cb, &found, NULL)) && found; + return (codec->core.subsystem_id >> 16 == 0x17aa) && + (acpi_dev_present("LEN0068") || acpi_dev_present("IBM0068")); } static void update_tpacpi_mute_led(void *private_data, int enabled)