Am 11.08.25 um 18:26 schrieb Mario Limonciello (AMD):
vga_is_firmware_default() checks firmware resources to find the owner
framebuffer resources to find the firmware PCI device.  This is an
open coded implementation of screen_info_pci_dev().  Switch to using
screen_info_pci_dev() instead.

Acked-by: Bjorn Helgaas <[email protected]>
Suggested-by: Thomas Zimmermann <[email protected]>
Signed-off-by: Mario Limonciello (AMD) <[email protected]>

Reviewed-by: Thomas Zimmermann <[email protected]>

---
v10:
  * Rebase on 6.17-rc1
---
  drivers/pci/vgaarb.c | 31 +++++--------------------------
  1 file changed, 5 insertions(+), 26 deletions(-)

diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c
index 78748e8d2dbae..b58f94ee48916 100644
--- a/drivers/pci/vgaarb.c
+++ b/drivers/pci/vgaarb.c
@@ -556,34 +556,13 @@ EXPORT_SYMBOL(vga_put);
static bool vga_is_firmware_default(struct pci_dev *pdev)
  {
-#if defined(CONFIG_X86)
-       u64 base = screen_info.lfb_base;
-       u64 size = screen_info.lfb_size;
-       struct resource *r;
-       u64 limit;
+#ifdef CONFIG_SCREEN_INFO
+       struct screen_info *si = &screen_info;
- /* Select the device owning the boot framebuffer if there is one */
-
-       if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
-               base |= (u64)screen_info.ext_lfb_base << 32;
-
-       limit = base + size;
-
-       /* Does firmware framebuffer belong to us? */
-       pci_dev_for_each_resource(pdev, r) {
-               if (resource_type(r) != IORESOURCE_MEM)
-                       continue;
-
-               if (!r->start || !r->end)
-                       continue;
-
-               if (base < r->start || limit >= r->end)
-                       continue;
-
-               return true;
-       }
-#endif
+       return pdev == screen_info_pci_dev(si);
+#else
        return false;
+#endif
  }
static bool vga_arb_integrated_gpu(struct device *dev)

--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


Reply via email to