Some PCI devices have device nodes associated with them. Do not register
these devices when they are disabled in the device tree.

Signed-off-by: Sascha Hauer <s.ha...@pengutronix.de>
---
 drivers/pci/bus.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index fdd012733a..b6eab56d87 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -114,6 +114,9 @@ int pci_register_device(struct pci_dev *pdev)
        struct device *dev = &pdev->dev;
        int ret;
 
+       if (!of_device_is_available(pdev->dev.of_node))
+               return 0;
+
        dev_set_name(dev, "pci-%04x:%04x.", pdev->vendor, pdev->device);
        dev->bus = &pci_bus;
        dev->id = DEVICE_ID_DYNAMIC;
-- 
2.39.2


Reply via email to