[PATCH 3/3] PCI: of: Add some debug printks to track problems with of_node setup

From: Mauro Carvalho Chehab
Date: Thu Aug 05 2021 - 04:29:18 EST


In order to be able to identify why some of_nodes are not created,
we need to add some debug prints.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
---
drivers/pci/of.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index b6fa3bd46ae6..7b8c2b87eb25 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -18,6 +18,9 @@
#ifdef CONFIG_PCI
void pci_set_of_node(struct pci_dev *dev)
{
+ dev_dbg(&dev->dev, "%s: of_node: %pOF\n",
+ __func__, dev->bus->dev.of_node);
+
if (!dev->bus->dev.of_node)
return;
dev->dev.of_node = of_pci_find_child_device(dev->bus->dev.of_node,
@@ -41,12 +44,16 @@ void pci_set_bus_of_node(struct pci_bus *bus)
node = pcibios_get_phb_of_node(bus);
} else {
node = of_node_get(bus->self->dev.of_node);
- if (!node)
+ if (!node) {
node = of_node_get(bus->self->dev.parent->of_node);
+ dev_dbg(&bus->dev, "%s: use of_node of the parent",
+ __func__);
+ }
if (node && of_property_read_bool(node, "external-facing"))
bus->self->external_facing = true;
}

+ dev_dbg(&bus->dev, "%s: of_node: %pOF\n", __func__, node);
bus->dev.of_node = node;

if (bus->dev.of_node)
--
2.31.1