Message ID | 49E8E368.5010804@kernel.org (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
On Fri, Apr 17, 2009 at 01:15:36PM -0700, Yinghai Lu wrote: > can you fix pci_is_root_bus? > > +/* > + * 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); > +} struct pci_bus { struct list_head node; /* node in list of buses */ struct pci_bus *parent; /* parent bus this bridge is on */ different 'parent' ...
Matthew Wilcox wrote: > On Fri, Apr 17, 2009 at 01:15:36PM -0700, Yinghai Lu wrote: >> can you fix pci_is_root_bus? >> >> +/* >> + * 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); >> +} > > struct pci_bus { > struct list_head node; /* node in list of buses */ > struct pci_bus *parent; /* parent bus this bridge is on */ > > different 'parent' ... > ok, I get it. it seems pci_create_bus is only for creating root bus YH -- 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
diff --git a/include/linux/pci.h b/include/linux/pci.h index 1216843..50d9438 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -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) {