diff mbox

[v6,08/16] core/pci: Trace device tree node from PCI device

Message ID 1430456549-21090-9-git-send-email-gwshan@linux.vnet.ibm.com
State Superseded
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Gavin Shan May 1, 2015, 5:02 a.m. UTC
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(+)
diff mbox

Patch

diff --git a/core/pci.c b/core/pci.c
index 81e91eb..9862087 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -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);
 
diff --git a/include/pci.h b/include/pci.h
index 57ba547..9726a6e 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -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;