From mboxrd@z Thu Jan 1 00:00:00 1970 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 2F51B2F1FE2; Fri, 27 Jun 2025 04:31:17 +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=1750998679; cv=none; b=Aqmy0bF+DTAZbAvY6aYibJxHkad1h2P1sVLTmDeeyEFaTP/4o+cW0MaFz2wr+aXvpFMkMJ92fzb+D6N84g0OD5Ck5vRKP0JFIXWQKasD3/7HdP1ZsUs7HWF2NEO58Xp/1lVl7KwlzntJLStGWphVd/QOFY7nh75eOoTRTWK/NTc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750998679; c=relaxed/simple; bh=cHj3h7hBxwKQAm75Z7A1SPHl3XQrv92gk4AeXACN+L4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=stHWkm+yuRAHfXH3ev95Ra4RegP0T8z7cT/ZBr6m9Fwelw5kOPr9fogt8a1Ve19ByRCEUjlOIgFg+AG420SF33cVdRqD7gut+pKyD7crinVe8dfZDW1rPTgyd2oqyGOG2dfVa1nNh/kw4cnUgaI0TmVJa7Rl3jIviVUBN0s5Y1c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qTTHnN9c; 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="qTTHnN9c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B72AC4CEEB; Fri, 27 Jun 2025 04:31:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750998677; bh=cHj3h7hBxwKQAm75Z7A1SPHl3XQrv92gk4AeXACN+L4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qTTHnN9chrw/j4mMWfd8t2CBL1YUO4G9jliAghuWR2BzwFfvN56oPigNfcjSeH8WK CWIax6JRBF7elZwp8Q7E856rwen/L9iZI4tUjcy8HKAaDQ9N/uBcs1lyJjmwD/lZ8O NJvmxqEUp9ZDEkm29vvTojbKGa1HuKNITe+T8DFXivtvl9AEyfspYaHI6DBbNLDj5z Ow94RzT+U7hdw49tV/091hir179IcnYQLPKq0AsyFOpq7FMKcRnFOlHl5Cj+lYnuN7 toSXPE+fSXWoDr2VP2Y27r97jb2nUwtM5h8QNcXrFLpi4xcaVgDnBqdgP8ajOuQs61 VfGKrQrMuvPIQ== 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 v6 1/9] PCI: Add helper for checking if a PCI device is a display controller Date: Thu, 26 Jun 2025 23:31:00 -0500 Message-ID: <20250627043108.3141206-2-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250627043108.3141206-1-superm1@kernel.org> References: <20250627043108.3141206-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. Acked-by: Bjorn Helgaas Reviewed-by: Daniel Dadap Reviewed-by: Simona Vetter Signed-off-by: Mario Limonciello --- 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; } +/** + * 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) == 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 -- 2.43.0