From nobody Wed Oct 8 21:34:41 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82CB5226CF3; Tue, 24 Jun 2025 20:30:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797051; cv=none; b=rmEDOjFfEa/rO0ZWWYndW0kYWnpWDnmz68BwXoBT+syu/yr6Z/5WrQtZQPRL5C2x32biR4q8OS7pdmZ1Xn+MSwPXE997a3twD9moyexVekTl14lk6nhW9EgzOdObn+0Qyez15FeBYqe/GlJMYRVbofq5IXcxEbiMix5nzb/3TyU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797051; c=relaxed/simple; bh=dwUS0NNQBo6ioFvBv9MvL8ShjmESObZeByXZvWYMJKk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lfc0tFh6BJE4mlJm0yawN2Nh0gU3NcarspOdjjCMeWOzSolCcmaIzcUjmMXGMZWctGPBObXW4lCaQBd2NNGv9Okfah82Nv6lMlYqv5vx5kQd88F7s4le/DUrFsn/JhiAVL8FQcpE6PRg+hH14Rf35yGOUxYxIpyjASCeHq7YrxQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B0qF+VrE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="B0qF+VrE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C63C1C4CEF0; Tue, 24 Jun 2025 20:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750797051; bh=dwUS0NNQBo6ioFvBv9MvL8ShjmESObZeByXZvWYMJKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B0qF+VrEpm9PcHkfA+Nr09IQ9DvuNyNUtKOhoAQbDQqjjE1ofB+JzuQpU3BCW4xJ7 hGfy9RqOJtCwXX8UlpxxResPC8Jsk/+JIwnoBCnL1KXc8gmR6ABti7ZJq6zWJM1R0V cIZGceXaypx3YkPJ/m3ZzN9q6c5obCYNV30Qe/Ut29p5sWv9rhZHUkLEl/8BfyOIf5 Yi+iUngbNtWhN++rX8XXemp4WvmP/S45lbcDvnjCAqa5gyaixX5HUFjDmsYH0Lt5T4 nq1FE5r0WVSMeYeqiejWZwpPwEnAbD0flIRL0S0KHKfc28zJw1l5VOf6kEd6DTE+3Y tUSwq6UQaDvuw== From: Mario Limonciello To: Bjorn Helgaas Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Lukas Wunner , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Alex Williamson , Jaroslav Kysela , Takashi Iwai , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list), iommu@lists.linux.dev (open list:INTEL IOMMU (VT-d)), linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), kvm@vger.kernel.org (open list:VFIO DRIVER), linux-sound@vger.kernel.org (open list:SOUND), Daniel Dadap , Mario Limonciello , Simona Vetter Subject: [PATCH v5 1/9] PCI: Add helper for checking if a PCI device is a display controller Date: Tue, 24 Jun 2025 15:30:34 -0500 Message-ID: <20250624203042.1102346-2-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250624203042.1102346-1-superm1@kernel.org> References: <20250624203042.1102346-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mario Limonciello Several places in the kernel do class shifting to match whether a PCI device is display class. Introduce a helper for those places to use. Reviewed-by: Daniel Dadap Reviewed-by: Simona Vetter Signed-off-by: Mario Limonciello Acked-by: Bjorn Helgaas --- include/linux/pci.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/pci.h b/include/linux/pci.h index 05e68f35f3923..e77754e43c629 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -744,6 +744,21 @@ static inline bool pci_is_vga(struct pci_dev *pdev) return false; } =20 +/** + * pci_is_display - Check if a PCI device is a display controller + * @pdev: Pointer to the PCI device structure + * + * This function determines whether the given PCI device corresponds + * to a display controller. Display controllers are typically used + * for graphical output and are identified based on their class code. + * + * Return: true if the PCI device is a display controller, false otherwise. + */ +static inline bool pci_is_display(struct pci_dev *pdev) +{ + return (pdev->class >> 16) =3D=3D PCI_BASE_CLASS_DISPLAY; +} + #define for_each_pci_bridge(dev, bus) \ list_for_each_entry(dev, &bus->devices, bus_list) \ if (!pci_is_bridge(dev)) {} else --=20 2.43.0