Skip to content

Commit c6f54cf

Browse files
andy-shevbjorn-helgaas
authored andcommitted
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/[email protected] Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 0b3dee6 commit c6f54cf

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

drivers/pci/of.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,14 @@ int pci_set_of_node(struct pci_dev *dev)
3939
return -ENODEV;
4040
}
4141

42-
dev->dev.of_node = node;
43-
dev->dev.fwnode = &node->fwnode;
42+
device_set_node(&dev->dev, of_fwnode_handle(node));
4443
return 0;
4544
}
4645

4746
void pci_release_of_node(struct pci_dev *dev)
4847
{
4948
of_node_put(dev->dev.of_node);
50-
dev->dev.of_node = NULL;
51-
dev->dev.fwnode = NULL;
49+
device_set_node(&dev->dev, NULL);
5250
}
5351

5452
void pci_set_bus_of_node(struct pci_bus *bus)
@@ -63,17 +61,13 @@ void pci_set_bus_of_node(struct pci_bus *bus)
6361
bus->self->external_facing = true;
6462
}
6563

66-
bus->dev.of_node = node;
67-
68-
if (bus->dev.of_node)
69-
bus->dev.fwnode = &bus->dev.of_node->fwnode;
64+
device_set_node(&bus->dev, of_fwnode_handle(node));
7065
}
7166

7267
void pci_release_bus_of_node(struct pci_bus *bus)
7368
{
7469
of_node_put(bus->dev.of_node);
75-
bus->dev.of_node = NULL;
76-
bus->dev.fwnode = NULL;
70+
device_set_node(&bus->dev, NULL);
7771
}
7872

7973
struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus)

0 commit comments

Comments
 (0)