History

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

Linus Torvalds committed 3 years ago

Commit b7bc77e2 parents 0f2a4af 0d21e713 files · +30 −12Browse files

Unified · Split

3 files
  1. drivers/pci/of.c +24 −6
  2. drivers/pci/pci.h +2 −2
  3. drivers/pci/probe.c +4 −4
drivers/pci/of.c+24−6
@@ -16,14 +16,32 @@ · 15 unmodified lines
1616 #include "pci.h"
1717
1818 #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)
2027 {
28+ struct device_node *node;
29+
2130 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;
2745 }
2846
2947 void pci_release_of_node(struct pci_dev *dev)
drivers/pci/pci.h+2−2
@@ -624,7 +624,7 @@ int of_pci_get_max_link_speed(struct device_node *node); · 623 unmodified lines
624624 u32 of_pci_get_slot_power_limit(struct device_node *node,
625625 u8 *slot_power_limit_value,
626626 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);
628628 void pci_release_of_node(struct pci_dev *dev);
629629 void pci_set_bus_of_node(struct pci_bus *bus);
630630 void pci_release_bus_of_node(struct pci_bus *bus);
@@ -662,7 +662,7 @@ of_pci_get_slot_power_limit(struct device_node *node, · 31 unmodified lines
662662 return 0;
663663 }
664664
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; }
666666 static inline void pci_release_of_node(struct pci_dev *dev) { }
667667 static inline void pci_set_bus_of_node(struct pci_bus *bus) { }
668668 static inline void pci_release_bus_of_node(struct pci_bus *bus) { }
drivers/pci/probe.c+4−4
@@ -1826,7 +1826,7 @@ int pci_setup_device(struct pci_dev *dev) · 1825 unmodified lines
18261826 u32 class;
18271827 u16 cmd;
18281828 u8 hdr_type;
1829− int pos = 0;
1829+ int err, pos = 0;
18301830 struct pci_bus_region region;
18311831 struct resource *res;
18321832
@@ -1840,10 +1840,10 @@ int pci_setup_device(struct pci_dev *dev) · 7 unmodified lines
18401840 dev->error_state = pci_channel_io_normal;
18411841 set_pcie_port_type(dev);
18421842
1843− pci_set_of_node(dev);
1843+ err = pci_set_of_node(dev);
1844+ if (err)
1845+ return err;
18441846 pci_set_acpi_fwnode(dev);
1845− if (dev->dev.fwnode && !fwnode_device_is_available(dev->dev.fwnode))
1846− return -ENODEV;
18471847
18481848 pci_dev_assign_slot(dev);
18491849

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t