[PATCH master 1/3] pci: efi: skip driver model fixup for non-EFI PCI busses

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Nov 15 01:00:21 PST 2021


The EFI driver registers a PCI fixup to associate PCI devices probed via
EFI with their parent. Restrict the fixup to EFI PCI busses only, so
other PCI drivers can be used in the same build.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/pci/pci-efi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pci-efi.c b/drivers/pci/pci-efi.c
index e1fe11d07016..846449c4b0e0 100644
--- a/drivers/pci/pci-efi.c
+++ b/drivers/pci/pci-efi.c
@@ -209,15 +209,22 @@ static u8 *acpi_parse_resource(u8 *next, struct resource *out)
 	return next;
 }
 
+static struct efi_driver efi_pci_driver;
+
 /* EFI already enumerated the bus for us, match our new pci devices with the efi
  * handles
  */
 static void efi_pci_fixup_dev_parent(struct pci_dev *dev)
 {
-	struct efi_pci_priv *priv = host_to_efi_pci(dev->bus->host);
+	struct efi_pci_priv *priv;
 	struct pci_child *child;
 	struct pci_child_id id;
 
+	if (dev->dev.driver != &efi_pci_driver.driver)
+		return;
+
+	priv = host_to_efi_pci(dev->bus->host);
+
 	id.segmentno = priv->protocol->segmentno;
 	id.busno = dev->bus->number;
 	id.devno = PCI_SLOT(dev->devfn);
-- 
2.30.2




More information about the barebox mailing list