diff options
author | Murali Karicheri <m-karicheri2@ti.com> | 2015-03-03 12:52:11 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-03-03 15:42:57 -0500 |
commit | 6675a601d72be408025e675599702e30a99188aa (patch) | |
tree | 3eeb9457aba240725c97f1aff5eb944b9ef1a8c2 | |
parent | 0c79c81c779fe54e67c0ce8c1fda551ca57d8a35 (diff) |
PCI: Add helper functions pci_get[put]_host_bridge_device()
Add helper functions to get/put the root bus's host bridge device.
Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> (AMD Seattle)
Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
CC: Joerg Roedel <joro@8bytes.org>
CC: Grant Likely <grant.likely@linaro.org>
CC: Rob Herring <robh+dt@kernel.org>
CC: Russell King <linux@arm.linux.org.uk>
CC: Arnd Bergmann <arnd@arndb.de>
-rw-r--r-- | drivers/pci/host-bridge.c | 14 | ||||
-rw-r--r-- | include/linux/pci.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c index 39b2dbe585aa..3e5bbf9e8889 100644 --- a/drivers/pci/host-bridge.c +++ b/drivers/pci/host-bridge.c | |||
@@ -23,6 +23,20 @@ static struct pci_host_bridge *find_pci_host_bridge(struct pci_bus *bus) | |||
23 | return to_pci_host_bridge(root_bus->bridge); | 23 | return to_pci_host_bridge(root_bus->bridge); |
24 | } | 24 | } |
25 | 25 | ||
26 | struct device *pci_get_host_bridge_device(struct pci_dev *dev) | ||
27 | { | ||
28 | struct pci_bus *root_bus = find_pci_root_bus(dev->bus); | ||
29 | struct device *bridge = root_bus->bridge; | ||
30 | |||
31 | kobject_get(&bridge->kobj); | ||
32 | return bridge; | ||
33 | } | ||
34 | |||
35 | void pci_put_host_bridge_device(struct device *dev) | ||
36 | { | ||
37 | kobject_put(&dev->kobj); | ||
38 | } | ||
39 | |||
26 | void pci_set_host_bridge_release(struct pci_host_bridge *bridge, | 40 | void pci_set_host_bridge_release(struct pci_host_bridge *bridge, |
27 | void (*release_fn)(struct pci_host_bridge *), | 41 | void (*release_fn)(struct pci_host_bridge *), |
28 | void *release_data) | 42 | void *release_data) |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 211e9da8a7d7..a379513bddef 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -510,6 +510,9 @@ static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev) | |||
510 | return dev->bus->self; | 510 | return dev->bus->self; |
511 | } | 511 | } |
512 | 512 | ||
513 | struct device *pci_get_host_bridge_device(struct pci_dev *dev); | ||
514 | void pci_put_host_bridge_device(struct device *dev); | ||
515 | |||
513 | #ifdef CONFIG_PCI_MSI | 516 | #ifdef CONFIG_PCI_MSI |
514 | static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) | 517 | static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) |
515 | { | 518 | { |