diff mbox

[v5,01/13] PCI: pci_is_root_bus helper

Message ID 20090320205555.12275.10712.stgit@bob.kio (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Alexander Chiang March 20, 2009, 8:55 p.m. UTC
From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>

Introduce pci_is_root_bus helper function. This will help make code
more consistent, as well as prevent incorrect assumptions (such as
pci_bus->self == NULL on a root bus, which is not always true).

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Alex Chiang <achiang@hp.com>
---

 include/linux/pci.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jesse Barnes March 20, 2009, 10 p.m. UTC | #1
On Fri, 20 Mar 2009 14:55:55 -0600
Alex Chiang <achiang@hp.com> wrote:

> From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
> 
> Introduce pci_is_root_bus helper function. This will help make code
> more consistent, as well as prevent incorrect assumptions (such as
> pci_bus->self == NULL on a root bus, which is not always true).
> 
> Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
> Signed-off-by: Alex Chiang <achiang@hp.com>
> ---

Applied this series, thanks everyone!
diff mbox

Patch

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1f6c5dd..72ccf15 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -341,6 +341,15 @@  struct pci_bus {
 #define pci_bus_b(n)	list_entry(n, struct pci_bus, node)
 #define to_pci_bus(n)	container_of(n, struct pci_bus, dev)
 
+/*
+ * Returns true if the pci bus is root (behind host-pci bridge),
+ * false otherwise
+ */
+static inline bool pci_is_root_bus(struct pci_bus *pbus)
+{
+	return !(pbus->parent);
+}
+
 #ifdef CONFIG_PCI_MSI
 static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
 {