drm/virtio: Use pci_is_vga() to identify VGA devices
authorSui Jingfeng <suijingfeng@loongson.cn>
Wed, 30 Aug 2023 11:15:31 +0000 (19:15 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 6 Oct 2023 22:19:01 +0000 (17:19 -0500)
Use pci_is_vga() to identify VGA devices instead of open-coding the class
test.

This means virtio_gpu_pci_quirk() will apply to old
PCI_CLASS_NOT_DEFINED_VGA (0x0001) devices as well as the
PCI_CLASS_DISPLAY_VGA (0x0300) devices it did previously.

Link: https://lore.kernel.org/r/20230830111532.444535-5-sui.jingfeng@linux.dev
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
[bhelgaas: commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: David Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gurchetan Singh <gurchetansingh@chromium.org>
Cc: Chia-I Wu <olvaffe@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
drivers/gpu/drm/virtio/virtgpu_drv.c

index 644b8ee51009bf92bf6263c098251fcb9b79b42b..4334c76084084284ab0ff7d61375efe6b2953e83 100644 (file)
@@ -51,7 +51,7 @@ static int virtio_gpu_pci_quirk(struct drm_device *dev)
 {
        struct pci_dev *pdev = to_pci_dev(dev->dev);
        const char *pname = dev_name(&pdev->dev);
-       bool vga = (pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA;
+       bool vga = pci_is_vga(pdev);
        int ret;
 
        DRM_INFO("pci: %s detected at %s\n",