diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-09-17 22:16:11 -0700 |
---|---|---|
committer | Yinghai Lu <yinghai@kernel.org> | 2012-09-17 22:16:11 -0700 |
commit | b95948ab4d283614bc0d88031559ce74c6701645 (patch) | |
tree | 23f6d80643b0589badc48cfcc12a638318e1a293 | |
parent | a0999cb2f82c90ab2cba253ef46bcfdb6fbd68fe (diff) | |
download | linux-yinghai-b95948ab4d283614bc0d88031559ce74c6701645.tar.gz |
PCI, acpi: Update acpi_pci_driver add/remove interface
To take acpi_pci_root pointer instead, so later caller will not need to
check the apci_pci_root list to find it.
Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
-rw-r--r-- | drivers/acpi/pci_root.c | 4 | ||||
-rw-r--r-- | drivers/acpi/pci_slot.c | 12 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 12 | ||||
-rw-r--r-- | include/linux/acpi.h | 4 |
4 files changed, 18 insertions, 14 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 72a2c98bc4298e..3d92c0ea270b46 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -90,7 +90,7 @@ int acpi_pci_register_driver(struct acpi_pci_driver *driver) return 0; list_for_each_entry(root, &acpi_pci_roots, node) { - driver->add(root->device->handle); + driver->add(root); n++; } @@ -116,7 +116,7 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver) return; list_for_each_entry(root, &acpi_pci_roots, node) - driver->remove(root->device->handle); + driver->remove(root); } EXPORT_SYMBOL(acpi_pci_unregister_driver); diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c index e50e31a518afbf..1c16c20ec60608 100644 --- a/drivers/acpi/pci_slot.c +++ b/drivers/acpi/pci_slot.c @@ -67,8 +67,8 @@ struct acpi_pci_slot { struct list_head list; /* node in the list of slots */ }; -static int acpi_pci_slot_add(acpi_handle handle); -static void acpi_pci_slot_remove(acpi_handle handle); +static int acpi_pci_slot_add(struct acpi_pci_root *root); +static void acpi_pci_slot_remove(struct acpi_pci_root *root); static LIST_HEAD(slot_list); static DEFINE_MUTEX(slot_list_lock); @@ -295,11 +295,11 @@ walk_root_bridge(acpi_handle handle, acpi_walk_callback user_function) * @handle: points to an acpi_pci_root */ static int -acpi_pci_slot_add(acpi_handle handle) +acpi_pci_slot_add(struct acpi_pci_root *root) { acpi_status status; - status = walk_root_bridge(handle, register_slot); + status = walk_root_bridge(root->device->handle, register_slot); if (ACPI_FAILURE(status)) err("%s: register_slot failure - %d\n", __func__, status); @@ -311,12 +311,14 @@ acpi_pci_slot_add(acpi_handle handle) * @handle: points to an acpi_pci_root */ static void -acpi_pci_slot_remove(acpi_handle handle) +acpi_pci_slot_remove(struct acpi_pci_root *root) { struct acpi_pci_slot *slot, *tmp; struct pci_bus *pbus; + acpi_handle handle; mutex_lock(&slot_list_lock); + handle = root->device->handle; list_for_each_entry_safe(slot, tmp, &slot_list, list) { if (slot->root_handle == handle) { list_del(&slot->list); diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 00fa414a0f10fa..201c5f7ba4afbd 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) { + acpi_handle handle = root->device->handle; struct acpiphp_bridge *bridge; - struct acpi_pci_root *root = acpi_pci_find_root(handle); bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL); if (bridge == NULL) @@ -468,8 +468,9 @@ 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_handle handle = root->device->handle; acpi_status status; unsigned long long tmp; acpi_handle 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 */ @@ -591,8 +592,9 @@ 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) { + acpi_handle handle = root->device->handle; struct acpiphp_bridge *bridge; /* cleanup p2p bridges under this host bridge diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 4f2a76224509ef..a68609823fdd6e 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -139,8 +139,8 @@ void acpi_pci_irq_disable (struct pci_dev *dev); struct acpi_pci_driver { struct acpi_pci_driver *next; - int (*add)(acpi_handle handle); - void (*remove)(acpi_handle handle); + int (*add)(struct acpi_pci_root *root); + void (*remove)(struct acpi_pci_root *root); }; int acpi_pci_register_driver(struct acpi_pci_driver *driver); |