]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/commitdiff
PCI: pci_is_root_bus helper
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Fri, 20 Mar 2009 20:55:55 +0000 (14:55 -0600)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Fri, 20 Mar 2009 21:56:36 +0000 (14:56 -0700)
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>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
include/linux/pci.h

index 1216843412da447f219302fc2600c5c2f7a6ea78..50d94388e87cf3247d47b3d38dfadb56d8234794 100644 (file)
@@ -357,6 +357,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)
 {