Re: [PATCH v7 2/8] PCI/VGA: Deal only with VGA class devices

From: Sui Jingfeng
Date: Sun Jun 18 2023 - 23:45:45 EST


Hi,

On 2023/6/19 11:02, Maciej W. Rozycki wrote:
On Tue, 13 Jun 2023, Sui Jingfeng wrote:

Deal only with the VGA devcie(pdev->class == 0x0300), so replace the
Typo here: s/devcie/device/.
Thanks a lot,
pci_get_subsys() function with pci_get_class(). Filter the non-PCI display
device(pdev->class != 0x0300) out. There no need to process the non-display
PCI device.
I've only come across this patch series now. Without diving into what
this code actually does I have just one question as a matter of interest.

diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c
index c1bc6c983932..22a505e877dc 100644
--- a/drivers/pci/vgaarb.c
+++ b/drivers/pci/vgaarb.c
@@ -1500,7 +1496,9 @@ static int pci_notify(struct notifier_block *nb, unsigned long action,
struct pci_dev *pdev = to_pci_dev(dev);
bool notify = false;
- vgaarb_dbg(dev, "%s\n", __func__);
+ /* Only deal with VGA class devices */
+ if (pdev->class != PCI_CLASS_DISPLAY_VGA << 8)
+ return 0;
Hmm, shouldn't this also handle PCI_CLASS_NOT_DEFINED_VGA?

If your machine have only one such a VGA card, it probably don't hurt.

But, such a card will also get ignored originally (before applying this patch).

As far as I
know it is the equivalent of PCI_CLASS_DISPLAY_VGA for PCI <= 2.0 devices
that were implemented before the idea of PCI device classes has developed
into its current form.

If multiple video card problems on your machine is matter,

then I think it do deserve another patch to clarify this issue and to explain the rationale.

I may have such a VGA device somewhere.

Maciej