Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/nouveau: Use pci_get_base_class() to reduce duplicated code

Use pci_get_base_class() to reduce duplicated code. No functional change
intended.

Link: https://lore.kernel.org/r/20230825062714.6325-4-sui.jingfeng@linux.dev
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>

authored by

Sui Jingfeng and committed by
Bjorn Helgaas
c213ed39 9ed8fcfd

+4 -7
+4 -7
drivers/gpu/drm/nouveau/nouveau_acpi.c
··· 284 284 printk("MXM: GUID detected in BIOS\n"); 285 285 286 286 /* now do DSM detection */ 287 - while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { 288 - vga_count++; 287 + while ((pdev = pci_get_base_class(PCI_BASE_CLASS_DISPLAY, pdev))) { 288 + if ((pdev->class != PCI_CLASS_DISPLAY_VGA << 8) && 289 + (pdev->class != PCI_CLASS_DISPLAY_3D << 8)) 290 + continue; 289 291 290 - nouveau_dsm_pci_probe(pdev, &dhandle, &has_mux, &has_optimus, 291 - &has_optimus_flags, &has_power_resources); 292 - } 293 - 294 - while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_3D << 8, pdev)) != NULL) { 295 292 vga_count++; 296 293 297 294 nouveau_dsm_pci_probe(pdev, &dhandle, &has_mux, &has_optimus,