On Tue, Jul 28, 2020 at 10:17:19PM -0500, Daniel Dadap wrote: > On 7/27/20 7:11 PM, Barnabás P??cze wrote: > > > + while ((dev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev))) { > > > + switch (dev->vendor) { > > > + case 0x8086: > > > + pci_dev_put(ig_dev); > > > + ig_dev = pci_dev_get(dev); > > > + break; > > > + case 0x10de: > > > + pci_dev_put(dg_dev); > > > + dg_dev = pci_dev_get(dev); > > > + break; > > > + default: > > > + break; > > > + } > > > + } > > > + > > > > Regardless of how improbable, I am wondering what happens if an > > external GPU is connected to a dual-GPU laptop? Cannot that > > interfere with this device lookup logic? > > I don't think it'll be a problem, since an external GPU won't have an > implementation of the MXDM/MXDS methods in its associated ACPI node, so even > if the eGPU is plugged in at the time this module loads, it should fail to > initialize unless there is also an internal discrete GPU which does support > MXDM/MXDS. Still, dg_dev may point to the wrong device. You can avoid it by adding the following at the top of the while loop: if (pci_is_thunderbolt_attached(dev)) continue; Thanks, Lukas