aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Rob Herring <robh@kernel.org> 2023-02-10 10:43:51 -0600
committerGravatar Bjorn Helgaas <bhelgaas@google.com> 2023-02-13 15:29:56 -0600
commit6fffbc7ae1373e10b989afe23a9eeb9c49fe15c3 (patch)
tree829c3d406b251909de62382aa3cc359f0106022b
parentPCI: loongson: Add more devices that need MRRS quirk (diff)
downloadlinux-6fffbc7ae137.tar.gz
linux-6fffbc7ae137.tar.bz2
linux-6fffbc7ae137.zip
PCI: Honor firmware's device disabled status
If a device has a firmware node (DT/ACPI), and the device is marked disabled, that is currently ignored. Add a check for this condition and bail out creating the pci_dev. This assumes the config space for the device can still be accessed because they already have by this point in order to identify the device. Link: https://lore.kernel.org/r/20230210164351.2687475-1-robh@kernel.org Tested-by: Binbin Zhou <zhoubinbin@loongson.cn> Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Cc: Liu Peibao <liupeibao@loongson.cn> Cc: Huacai Chen <chenhuacai@loongson.cn>
-rw-r--r--drivers/pci/probe.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 1779582fb500..b1d80c1d7a69 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1841,6 +1841,8 @@ int pci_setup_device(struct pci_dev *dev)
pci_set_of_node(dev);
pci_set_acpi_fwnode(dev);
+ if (dev->dev.fwnode && !fwnode_device_is_available(dev->dev.fwnode))
+ return -ENODEV;
pci_dev_assign_slot(dev);