@@ -1298,6 +1298,9 @@ static void pci_add_one_node(struct phb *phb, struct pci_device *pd,
reg[1] = reg[2] = reg[3] = reg[4] = 0;
dt_add_property(np, "reg", reg, sizeof(reg));
+ /* Bind the device node with PCI device */
+ pd->dt_node = np;
+
/* Print summary info about the device */
pci_print_summary_line(phb, pd, np, rev_class, cname);
@@ -126,6 +126,7 @@ struct pci_device {
uint32_t cap[64];
uint32_t mps; /* Max payload size capability */
+ struct dt_node *dt_node;
struct pci_slot_info *slot_info;
struct pci_device *parent;
struct list_head children;
The patch adds one more fields "struct pci_device::dt_node" to trace the binding device tree node from PCI device. When all the subordinate devices behind PCI slot are unplugged in future, all PCI device instances together with their associated device tree nodes should be removed. The changes introduced by this patch helps on that. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> --- core/pci.c | 3 +++ include/pci.h | 1 + 2 files changed, 4 insertions(+)