Skip to content

Commit 4e6c918

Browse files
chenhuacaibjorn-helgaas
authored andcommitted
PCI/VGA: Log bridge control messages when adding devices
Previously vga_arb_device_init() iterated through all VGA devices and indicated whether legacy VGA routing to each could be controlled by an upstream bridge. But we determine that information in vga_arbiter_add_pci_device(), which we call for every device, so we can log it there without iterating through the VGA devices again. Note that we call vga_arbiter_check_bridge_sharing() before adding the device to vga_list, so we have to handle the very first device separately. Link: https://lore.kernel.org/r/20220224224753.297579-10-helgaas@kernel.org Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent dc593fd commit 4e6c918

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

drivers/pci/vgaarb.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,10 @@ static void vga_arbiter_check_bridge_sharing(struct vga_device *vgadev)
719719

720720
vgadev->bridge_has_one_vga = true;
721721

722-
if (list_empty(&vga_list))
722+
if (list_empty(&vga_list)) {
723+
vgaarb_info(&vgadev->pdev->dev, "bridge control possible\n");
723724
return;
725+
}
724726

725727
/* okay iterate the new devices bridge hierarachy */
726728
new_bus = vgadev->pdev->bus;
@@ -759,6 +761,11 @@ static void vga_arbiter_check_bridge_sharing(struct vga_device *vgadev)
759761
}
760762
new_bus = new_bus->parent;
761763
}
764+
765+
if (vgadev->bridge_has_one_vga)
766+
vgaarb_info(&vgadev->pdev->dev, "bridge control possible\n");
767+
else
768+
vgaarb_info(&vgadev->pdev->dev, "no bridge control possible\n");
762769
}
763770

764771
/*
@@ -1557,7 +1564,6 @@ static int __init vga_arb_device_init(void)
15571564
{
15581565
int rc;
15591566
struct pci_dev *pdev;
1560-
struct vga_device *vgadev;
15611567

15621568
rc = misc_register(&vga_arb_device);
15631569
if (rc < 0)
@@ -1573,15 +1579,6 @@ static int __init vga_arb_device_init(void)
15731579
PCI_ANY_ID, pdev)) != NULL)
15741580
vga_arbiter_add_pci_device(pdev);
15751581

1576-
list_for_each_entry(vgadev, &vga_list, list) {
1577-
struct device *dev = &vgadev->pdev->dev;
1578-
1579-
if (vgadev->bridge_has_one_vga)
1580-
vgaarb_info(dev, "bridge control possible\n");
1581-
else
1582-
vgaarb_info(dev, "no bridge control possible\n");
1583-
}
1584-
15851582
pr_info("loaded\n");
15861583
return rc;
15871584
}

0 commit comments

Comments
 (0)