x86/PCI: Add to_pci_sysdata() helper
Various helpers need the pci_sysdata just to dereference a single field in it. Add a little helper that returns the properly typed sysdata pointer to require a little less boilerplate code. [jonathan.derrick: to_pci_sysdata const argument] Link: https://lore.kernel.org/r/1579613871-301529-2-git-send-email-jonathan.derrick@intel.com Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jon Derrick <jonathan.derrick@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
parent
e42617b825
commit
aad6aa0cd6
@ -35,12 +35,15 @@ extern int noioapicreroute;
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
|
||||
static inline struct pci_sysdata *to_pci_sysdata(const struct pci_bus *bus)
|
||||
{
|
||||
return bus->sysdata;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PCI_DOMAINS
|
||||
static inline int pci_domain_nr(struct pci_bus *bus)
|
||||
{
|
||||
struct pci_sysdata *sd = bus->sysdata;
|
||||
|
||||
return sd->domain;
|
||||
return to_pci_sysdata(bus)->domain;
|
||||
}
|
||||
|
||||
static inline int pci_proc_domain(struct pci_bus *bus)
|
||||
@ -52,24 +55,20 @@ static inline int pci_proc_domain(struct pci_bus *bus)
|
||||
#ifdef CONFIG_PCI_MSI_IRQ_DOMAIN
|
||||
static inline void *_pci_root_bus_fwnode(struct pci_bus *bus)
|
||||
{
|
||||
struct pci_sysdata *sd = bus->sysdata;
|
||||
|
||||
return sd->fwnode;
|
||||
return to_pci_sysdata(bus)->fwnode;
|
||||
}
|
||||
|
||||
#define pci_root_bus_fwnode _pci_root_bus_fwnode
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_VMD)
|
||||
static inline bool is_vmd(struct pci_bus *bus)
|
||||
{
|
||||
#if IS_ENABLED(CONFIG_VMD)
|
||||
struct pci_sysdata *sd = bus->sysdata;
|
||||
|
||||
return sd->vmd_domain;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
return to_pci_sysdata(bus)->vmd_domain;
|
||||
}
|
||||
#else
|
||||
#define is_vmd(bus) false
|
||||
#endif /* CONFIG_VMD */
|
||||
|
||||
/* Can be used to override the logic in pci_scan_bus for skipping
|
||||
already-configured bus numbers - to be used for buggy BIOSes
|
||||
@ -124,9 +123,7 @@ void native_restore_msi_irqs(struct pci_dev *dev);
|
||||
/* Returns the node based on pci bus */
|
||||
static inline int __pcibus_to_node(const struct pci_bus *bus)
|
||||
{
|
||||
const struct pci_sysdata *sd = bus->sysdata;
|
||||
|
||||
return sd->node;
|
||||
return to_pci_sysdata(bus)->node;
|
||||
}
|
||||
|
||||
static inline const struct cpumask *
|
||||
|
Loading…
x
Reference in New Issue
Block a user