From patchwork Fri Aug 25 06:27:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 13367318 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F13D8C83F01 for ; Sun, 27 Aug 2023 17:04:54 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1C7E420C; Sun, 27 Aug 2023 19:04:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1C7E420C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1693155893; bh=MDSTxmSbsGjEUoJEOL2CjWrU4s+CsU3pMdNq+LzazFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=uP/xDqm/0zOxqE7+DdTm7QVELC8mohoyI/B+m+K+97r9UomWly/Aw0YfYRMsnafTa NTQxEtBIYds5atcUCYXXPOz4epSpULzkltsSAZiSr3bvA6WiPeDHOrBFiHzGLgTmh7 QCh0R43XQTqn3X791h+dHzGaEwao3CFmhyogLJYo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B4D60F805B4; Sun, 27 Aug 2023 19:02:03 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 1148EF805C4; Sun, 27 Aug 2023 19:02:03 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7A34BF804DA; Fri, 25 Aug 2023 08:27:48 +0200 (CEST) Received: from out-7.mta1.migadu.com (out-7.mta1.migadu.com [95.215.58.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E008EF800D1 for ; Fri, 25 Aug 2023 08:27:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E008EF800D1 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Un86inUG X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1692944851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wd9rzcQO4o5TkX49UxGyU1jqO6hsnMsbjt9qVYaR0vo=; b=Un86inUGQHAzbv/iop1ydVXq6y358z4C6QQREMzovcbDvertp4NuWGO+x9UM8QENAavwJh 1qy8vCrJISPWmY15TX2UFkBfE0qXG1HlAK6MWIDepmQq1aE/XDm9bbyCMocMyg6tUr2Zzs MONL/1/8GYuXjhUnJ2SVp70cZvgnsgI= From: Sui Jingfeng To: Bjorn Helgaas Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, linux-pci@vger.kernel.org, alsa-devel@alsa-project.org, Sui Jingfeng , Jaroslav Kysela , Takashi Iwai , Fred Oh , Pierre-Louis Bossart , Kai Vehmanen Subject: [PATCH 2/5] ALSA: hda/intel: Use pci_get_base_class() to reduce duplicated code Date: Fri, 25 Aug 2023 14:27:11 +0800 Message-Id: <20230825062714.6325-3-sui.jingfeng@linux.dev> In-Reply-To: <20230825062714.6325-1-sui.jingfeng@linux.dev> References: <20230825062714.6325-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-MailFrom: sui.jingfeng@linux.dev X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: DPNGEHMAYVJXUXJNZJZ2SICMNG5N2Z5G X-Message-ID-Hash: DPNGEHMAYVJXUXJNZJZ2SICMNG5N2Z5G X-Mailman-Approved-At: Sun, 27 Aug 2023 17:01:46 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Sui Jingfeng Should be no functional change Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Fred Oh Cc: Pierre-Louis Bossart Cc: Kai Vehmanen Cc: Bjorn Helgaas Signed-off-by: Sui Jingfeng --- sound/pci/hda/hda_intel.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index a21b61ad08d1..811a149584f2 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1429,17 +1429,11 @@ static bool atpx_present(void) acpi_handle dhandle, atpx_handle; acpi_status status; - while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { - dhandle = ACPI_HANDLE(&pdev->dev); - if (dhandle) { - status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); - if (ACPI_SUCCESS(status)) { - pci_dev_put(pdev); - return true; - } - } - } - while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) { + while ((pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev))) { + if ((pdev->class != PCI_CLASS_DISPLAY_VGA << 8) && + (pdev->class != PCI_CLASS_DISPLAY_OTHER << 8)) + continue; + dhandle = ACPI_HANDLE(&pdev->dev); if (dhandle) { status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);