From 55bfe3c0c561783655a8ff2f6f3f19ac1362b132 Mon Sep 17 00:00:00 2001 From: Taku Izumi Date: Tue, 18 Sep 2012 15:22:35 +0900 Subject: PCI/ACPI: Pass acpi_pci_root to acpi_pci_drivers' add/remove interface This patch changes .add/.remove interfaces of acpi_pci_driver. In the current implementation acpi_handle is passed as a parameter of .add/.remove interface. However, the acpi_pci_root structure contains more useful information than just the acpi_handle. This enables us to avoid some useless lookups in each acpi_pci_driver. Note: This changes interfaces used by acpi_pci_register_driver(), an exported symbol. This patch updates all the in-kernel users, but any out-of-kernel acpi_pci_register_driver() users will need updates. [bhelgaas: changelog] Signed-off-by: Taku Izumi Signed-off-by: Bjorn Helgaas --- drivers/pci/hotplug/acpiphp_glue.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'drivers/pci') diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 7be4ca5e1f4c..466233b481b1 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -382,10 +382,10 @@ static inline void config_p2p_bridge_flags(struct acpiphp_bridge *bridge) /* allocate and initialize host bridge data structure */ -static void add_host_bridge(acpi_handle *handle) +static void add_host_bridge(struct acpi_pci_root *root) { struct acpiphp_bridge *bridge; - struct acpi_pci_root *root = acpi_pci_find_root(handle); + acpi_handle handle = root->device->handle; bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); if (bridge == NULL) @@ -468,11 +468,12 @@ find_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv) /* find hot-pluggable slots, and then find P2P bridge */ -static int add_bridge(acpi_handle handle) +static int add_bridge(struct acpi_pci_root *root) { acpi_status status; unsigned long long tmp; acpi_handle dummy_handle; + acpi_handle handle = root->device->handle; /* if the bridge doesn't have _STA, we assume it is always there */ status = acpi_get_handle(handle, "_STA", &dummy_handle); @@ -490,7 +491,7 @@ static int add_bridge(acpi_handle handle) /* check if this bridge has ejectable slots */ if (detect_ejectable_slots(handle) > 0) { dbg("found PCI host-bus bridge with hot-pluggable slots\n"); - add_host_bridge(handle); + add_host_bridge(root); } /* search P2P bridges under this host bridge */ @@ -588,9 +589,10 @@ cleanup_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv) return AE_OK; } -static void remove_bridge(acpi_handle handle) +static void remove_bridge(struct acpi_pci_root *root) { struct acpiphp_bridge *bridge; + acpi_handle handle = root->device->handle; /* cleanup p2p bridges under this host bridge in a depth-first manner */ -- cgit v1.2.3