Commit 056c58e8 authored by Jiri Slaby's avatar Jiri Slaby Committed by Jesse Barnes

PCI: add acpi_find_root_bridge_handle

Consolidate finding of a root bridge and getting its handle to the one
inline function. It's cut & pasted on multiple places. Use this new
inline in those.

Cc: kristen.c.accardi@intel.com
Acked-by: default avatarAlex Chiang <achiang@hp.com>
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent e0d94bee
...@@ -404,10 +404,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags) ...@@ -404,10 +404,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags)
* OSHP within the scope of the hotplug controller and its parents, * OSHP within the scope of the hotplug controller and its parents,
* upto the host bridge under which this controller exists. * upto the host bridge under which this controller exists.
*/ */
while (pdev->bus->self) handle = acpi_find_root_bridge_handle(pdev);
pdev = pdev->bus->self;
handle = acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus),
pdev->bus->number);
if (handle) { if (handle) {
acpi_get_name(handle, ACPI_FULL_PATHNAME, &string); acpi_get_name(handle, ACPI_FULL_PATHNAME, &string);
dbg("Trying to get hotplug control for %s\n", dbg("Trying to get hotplug control for %s\n",
......
...@@ -36,12 +36,7 @@ int aer_osc_setup(struct pcie_device *pciedev) ...@@ -36,12 +36,7 @@ int aer_osc_setup(struct pcie_device *pciedev)
if (acpi_pci_disabled) if (acpi_pci_disabled)
return -1; return -1;
/* Find root host bridge */ handle = acpi_find_root_bridge_handle(pdev);
while (pdev->bus->self)
pdev = pdev->bus->self;
handle = acpi_get_pci_rootbridge_handle(
pci_domain_nr(pdev->bus), pdev->bus->number);
if (handle) { if (handle) {
pcie_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT); pcie_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT);
status = pci_osc_control_set(handle, status = pci_osc_control_set(handle,
......
...@@ -57,6 +57,15 @@ static inline acpi_status pcie_osc_support_set(u32 flags) ...@@ -57,6 +57,15 @@ static inline acpi_status pcie_osc_support_set(u32 flags)
{ {
return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING); return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING);
} }
static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
{
/* Find root host bridge */
while (pdev->bus->self)
pdev = pdev->bus->self;
return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus),
pdev->bus->number);
}
#else #else
#if !defined(AE_ERROR) #if !defined(AE_ERROR)
typedef u32 acpi_status; typedef u32 acpi_status;
...@@ -66,6 +75,8 @@ static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) ...@@ -66,6 +75,8 @@ static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
{return AE_ERROR;} {return AE_ERROR;}
static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;} static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;}
static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;} static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;}
static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
{ return NULL; }
#endif #endif
#endif /* _PCI_ACPI_H_ */ #endif /* _PCI_ACPI_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment