Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pci-v6.3-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci

Pull pci fix from Bjorn Helgaas:

- Previously we ignored PCI devices if the DT "status" property or the
ACPI _STA method said it was not present.

Per spec, _STA cannot be used for that purpose, and using it that way
caused regressions, so skip the _STA check (Rob Herring)

* tag 'pci-v6.3-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci:
PCI: Restrict device disabled status check to DT

+30 -12
+24 -6
drivers/pci/of.c
··· 16 16 #include "pci.h" 17 17 18 18 #ifdef CONFIG_PCI 19 - void pci_set_of_node(struct pci_dev *dev) 19 + /** 20 + * pci_set_of_node - Find and set device's DT device_node 21 + * @dev: the PCI device structure to fill 22 + * 23 + * Returns 0 on success with of_node set or when no device is described in the 24 + * DT. Returns -ENODEV if the device is present, but disabled in the DT. 25 + */ 26 + int pci_set_of_node(struct pci_dev *dev) 20 27 { 28 + struct device_node *node; 29 + 21 30 if (!dev->bus->dev.of_node) 22 - return; 23 - dev->dev.of_node = of_pci_find_child_device(dev->bus->dev.of_node, 24 - dev->devfn); 25 - if (dev->dev.of_node) 26 - dev->dev.fwnode = &dev->dev.of_node->fwnode; 31 + return 0; 32 + 33 + node = of_pci_find_child_device(dev->bus->dev.of_node, dev->devfn); 34 + if (!node) 35 + return 0; 36 + 37 + if (!of_device_is_available(node)) { 38 + of_node_put(node); 39 + return -ENODEV; 40 + } 41 + 42 + dev->dev.of_node = node; 43 + dev->dev.fwnode = &node->fwnode; 44 + return 0; 27 45 } 28 46 29 47 void pci_release_of_node(struct pci_dev *dev)
+2 -2
drivers/pci/pci.h
··· 624 624 u32 of_pci_get_slot_power_limit(struct device_node *node, 625 625 u8 *slot_power_limit_value, 626 626 u8 *slot_power_limit_scale); 627 - void pci_set_of_node(struct pci_dev *dev); 627 + int pci_set_of_node(struct pci_dev *dev); 628 628 void pci_release_of_node(struct pci_dev *dev); 629 629 void pci_set_bus_of_node(struct pci_bus *bus); 630 630 void pci_release_bus_of_node(struct pci_bus *bus); ··· 662 662 return 0; 663 663 } 664 664 665 - static inline void pci_set_of_node(struct pci_dev *dev) { } 665 + static inline int pci_set_of_node(struct pci_dev *dev) { return 0; } 666 666 static inline void pci_release_of_node(struct pci_dev *dev) { } 667 667 static inline void pci_set_bus_of_node(struct pci_bus *bus) { } 668 668 static inline void pci_release_bus_of_node(struct pci_bus *bus) { }
+4 -4
drivers/pci/probe.c
··· 1826 1826 u32 class; 1827 1827 u16 cmd; 1828 1828 u8 hdr_type; 1829 - int pos = 0; 1829 + int err, pos = 0; 1830 1830 struct pci_bus_region region; 1831 1831 struct resource *res; 1832 1832 ··· 1840 1840 dev->error_state = pci_channel_io_normal; 1841 1841 set_pcie_port_type(dev); 1842 1842 1843 - pci_set_of_node(dev); 1843 + err = pci_set_of_node(dev); 1844 + if (err) 1845 + return err; 1844 1846 pci_set_acpi_fwnode(dev); 1845 - if (dev->dev.fwnode && !fwnode_device_is_available(dev->dev.fwnode)) 1846 - return -ENODEV; 1847 1847 1848 1848 pci_dev_assign_slot(dev); 1849 1849