]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
PCI: add acpi_find_root_bridge_handle
authorJiri Slaby <jirislaby@gmail.com>
Mon, 18 Aug 2008 18:22:54 +0000 (20:22 +0200)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Mon, 18 Aug 2008 20:48:04 +0000 (13:48 -0700)
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: Alex Chiang <achiang@hp.com>
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/hotplug/acpi_pcihp.c
drivers/pci/pcie/aer/aerdrv_acpi.c
include/linux/pci-acpi.h

index bd831970f00bd4709c58908038c228ad089c8067..e17ef54f0efced2d0173a9f5af250c2f0fa93517 100644 (file)
@@ -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,
         * upto the host bridge under which this controller exists.
         */
-       while (pdev->bus->self)
-               pdev = pdev->bus->self;
-       handle = acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus),
-                       pdev->bus->number);
+       handle = acpi_find_root_bridge_handle(pdev);
        if (handle) {
                acpi_get_name(handle, ACPI_FULL_PATHNAME, &string);
                dbg("Trying to get hotplug control for %s\n",
index 30f581b8791f5f84c6ab72a1f76bf1de8a5a2c87..6dd7b13e9808072bab1bf605ab997d817592efb1 100644 (file)
@@ -36,12 +36,7 @@ int aer_osc_setup(struct pcie_device *pciedev)
        if (acpi_pci_disabled)
                return -1;
 
-       /* Find root host bridge */
-       while (pdev->bus->self)
-               pdev = pdev->bus->self;
-       handle = acpi_get_pci_rootbridge_handle(
-               pci_domain_nr(pdev->bus), pdev->bus->number);
-
+       handle = acpi_find_root_bridge_handle(pdev);
        if (handle) {
                pcie_osc_support_set(OSC_EXT_PCI_CONFIG_SUPPORT);
                status = pci_osc_control_set(handle,
index 3ba25065fa96b0f3907447f20fda02a8ea7e840c..8837928fbf33744249765eaedab779494a452d92 100644 (file)
@@ -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);
 }
+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
 #if !defined(AE_ERROR)
 typedef u32            acpi_status;
@@ -66,6 +75,8 @@ static inline acpi_status pci_osc_control_set(acpi_handle handle, 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_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
+{ return NULL; }
 #endif
 
 #endif /* _PCI_ACPI_H_ */