diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2023-04-21 12:09:39 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2023-06-07 00:15:45 +0200 |
commit | c6f54cf44c3d05510f8f292a1782105c087797ba (patch) | |
tree | 9d39ec5962fb78f609c23db17b458bf15d27f14f /drivers/pci/of.c | |
parent | PCI: Add PCI_EXT_CAP_ID_PL_32GT define (diff) | |
download | linux-c6f54cf44c3d05510f8f292a1782105c087797ba.tar.xz linux-c6f54cf44c3d05510f8f292a1782105c087797ba.zip |
PCI: of: Propagate firmware node by calling device_set_node()
Insulate pci_set_of_node() and pci_set_bus_of_node() from possible
changes to fwnode_handle implementation by using device_set_node()
instead of open-coding dev->dev.fwnode assignments.
Link: https://lore.kernel.org/r/20230421100939.68225-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/of.c')
-rw-r--r-- | drivers/pci/of.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 2c25f4fa0225..e51219f9f523 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -39,16 +39,14 @@ int pci_set_of_node(struct pci_dev *dev) return -ENODEV; } - dev->dev.of_node = node; - dev->dev.fwnode = &node->fwnode; + device_set_node(&dev->dev, of_fwnode_handle(node)); return 0; } void pci_release_of_node(struct pci_dev *dev) { of_node_put(dev->dev.of_node); - dev->dev.of_node = NULL; - dev->dev.fwnode = NULL; + device_set_node(&dev->dev, NULL); } void pci_set_bus_of_node(struct pci_bus *bus) @@ -63,17 +61,13 @@ void pci_set_bus_of_node(struct pci_bus *bus) bus->self->external_facing = true; } - bus->dev.of_node = node; - - if (bus->dev.of_node) - bus->dev.fwnode = &bus->dev.of_node->fwnode; + device_set_node(&bus->dev, of_fwnode_handle(node)); } void pci_release_bus_of_node(struct pci_bus *bus) { of_node_put(bus->dev.of_node); - bus->dev.of_node = NULL; - bus->dev.fwnode = NULL; + device_set_node(&bus->dev, NULL); } struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus) |