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 C369E2EF9C5; Thu, 26 Jun 2025 20:43:49 +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=1750970629; cv=none; b=J8cY7/tzLDQsaOvO2e0gI5CzDAN6DcfxiUzuFXD1fRq+riMCzfiq+kP6oLAvym/VNqGMvZUM/aUXIVUkj7ugKn2ZTIV8jiM1ApB3SatBJoJRplF2E2XWzcYqI07FMMFOw8XiFhdKYvYMGdQPDSMyLzQGDTxigjKFi7rgaNzsdx8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750970629; c=relaxed/simple; bh=RxyMC+2G+d8PymhCGrHX7YP1mVjswtwkuXu40rNBTkU=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=eQ1O0Sb2WurlfuBP9H7V+ZLdWf7uCwd3/nRbokamH3Wul/mZpyHZHjBZsfZSfJxr+ZGMMuv8ZGOq2p4bj7Y6WsgX6Iqogggg9B0YTt1tZHKpNa6o2tf+UveC8gg/L+qnpsZhmpFCg1i6EuKHctZdFjBwvBwYZt0MSKct6/vbz+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jHSFUIqZ; 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="jHSFUIqZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15AFDC4CEEB; Thu, 26 Jun 2025 20:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750970629; bh=RxyMC+2G+d8PymhCGrHX7YP1mVjswtwkuXu40rNBTkU=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=jHSFUIqZ0TTJQpruH30p17NnWNGatOoB4vi9WQfZYchyL+arvyBGio0XxKMElG4am 36jyKQkGirTxX9VRBWkqhMmOsmo0SxMFd2Ql78FpR3LxsxSPmhdzPWC2JFFrqO5qOy XOF5y38I320zXYHhJC+THSW6VWcgTNRoBRj+c7Snbf+h8Jfcy3YVRNOoqx0rmpFOyd ZDAAneTSGiN8xGe/BBds1mnROHCYF5r/vDlwHjMFpN7VkMwqOEGZmqEzW2zKwb+UK4 tBSgM4XoBU3mDn9yIzEFRm5kXY2VT2PUneU24hjsn0PD63yCds2swtwDFKzYR9B6Np 5q6CuPFLe/ViQ== Date: Thu, 26 Jun 2025 15:43:47 -0500 From: Bjorn Helgaas To: Mario Limonciello Cc: Bjorn Helgaas , Alex Deucher , Christian =?utf-8?B?S8O2bmln?= , 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 , "open list:DRM DRIVERS" , open list , "open list:INTEL IOMMU (VT-d)" , "open list:PCI SUBSYSTEM" , "open list:VFIO DRIVER" , "open list:SOUND" , Daniel Dadap , Mario Limonciello , Simona Vetter Subject: Re: [PATCH v5 1/9] PCI: Add helper for checking if a PCI device is a display controller Message-ID: <20250626204347.GA1638339@bhelgaas> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250624203042.1102346-2-superm1@kernel.org> On Tue, Jun 24, 2025 at 03:30:34PM -0500, Mario Limonciello wrote: > 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 Not sure how this should be merged, let me know if you want me to do something with it. > --- > 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 >