aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorTaku Izumi <izumi.taku@jp.fujitsu.com>2012-09-18 02:22:35 -0400
committerBjorn Helgaas <bhelgaas@google.com>2012-09-24 17:29:40 -0400
commit55bfe3c0c561783655a8ff2f6f3f19ac1362b132 (patch)
tree270c4b1344f93f417e46f6abd9a9c91a5a3e8c55 /drivers/acpi
parentd0020f65220c237f300355873125df5efe2c2740 (diff)
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 <izumi.taku@jp.fujitsu.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/pci_root.c8
-rw-r--r--drivers/acpi/pci_slot.c11
2 files changed, 10 insertions, 9 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index d710585e4a7f..2868a9ff6d07 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -87,7 +87,7 @@ int acpi_pci_register_driver(struct acpi_pci_driver *driver)
87 list_add_tail(&driver->node, &acpi_pci_drivers); 87 list_add_tail(&driver->node, &acpi_pci_drivers);
88 if (driver->add) 88 if (driver->add)
89 list_for_each_entry(root, &acpi_pci_roots, node) { 89 list_for_each_entry(root, &acpi_pci_roots, node) {
90 driver->add(root->device->handle); 90 driver->add(root);
91 n++; 91 n++;
92 } 92 }
93 mutex_unlock(&acpi_pci_root_lock); 93 mutex_unlock(&acpi_pci_root_lock);
@@ -104,7 +104,7 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver)
104 list_del(&driver->node); 104 list_del(&driver->node);
105 if (driver->remove) 105 if (driver->remove)
106 list_for_each_entry(root, &acpi_pci_roots, node) 106 list_for_each_entry(root, &acpi_pci_roots, node)
107 driver->remove(root->device->handle); 107 driver->remove(root);
108 mutex_unlock(&acpi_pci_root_lock); 108 mutex_unlock(&acpi_pci_root_lock);
109} 109}
110EXPORT_SYMBOL(acpi_pci_unregister_driver); 110EXPORT_SYMBOL(acpi_pci_unregister_driver);
@@ -629,7 +629,7 @@ static int acpi_pci_root_start(struct acpi_device *device)
629 mutex_lock(&acpi_pci_root_lock); 629 mutex_lock(&acpi_pci_root_lock);
630 list_for_each_entry(driver, &acpi_pci_drivers, node) 630 list_for_each_entry(driver, &acpi_pci_drivers, node)
631 if (driver->add) 631 if (driver->add)
632 driver->add(device->handle); 632 driver->add(root);
633 mutex_unlock(&acpi_pci_root_lock); 633 mutex_unlock(&acpi_pci_root_lock);
634 634
635 pci_bus_add_devices(root->bus); 635 pci_bus_add_devices(root->bus);
@@ -645,7 +645,7 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type)
645 mutex_lock(&acpi_pci_root_lock); 645 mutex_lock(&acpi_pci_root_lock);
646 list_for_each_entry(driver, &acpi_pci_drivers, node) 646 list_for_each_entry(driver, &acpi_pci_drivers, node)
647 if (driver->remove) 647 if (driver->remove)
648 driver->remove(root->device->handle); 648 driver->remove(root);
649 mutex_unlock(&acpi_pci_root_lock); 649 mutex_unlock(&acpi_pci_root_lock);
650 650
651 device_set_run_wake(root->bus->bridge, false); 651 device_set_run_wake(root->bus->bridge, false);
diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c
index e50e31a518af..8051ffa7609d 100644
--- a/drivers/acpi/pci_slot.c
+++ b/drivers/acpi/pci_slot.c
@@ -67,8 +67,8 @@ struct acpi_pci_slot {
67 struct list_head list; /* node in the list of slots */ 67 struct list_head list; /* node in the list of slots */
68}; 68};
69 69
70static int acpi_pci_slot_add(acpi_handle handle); 70static int acpi_pci_slot_add(struct acpi_pci_root *root);
71static void acpi_pci_slot_remove(acpi_handle handle); 71static void acpi_pci_slot_remove(struct acpi_pci_root *root);
72 72
73static LIST_HEAD(slot_list); 73static LIST_HEAD(slot_list);
74static DEFINE_MUTEX(slot_list_lock); 74static DEFINE_MUTEX(slot_list_lock);
@@ -295,11 +295,11 @@ walk_root_bridge(acpi_handle handle, acpi_walk_callback user_function)
295 * @handle: points to an acpi_pci_root 295 * @handle: points to an acpi_pci_root
296 */ 296 */
297static int 297static int
298acpi_pci_slot_add(acpi_handle handle) 298acpi_pci_slot_add(struct acpi_pci_root *root)
299{ 299{
300 acpi_status status; 300 acpi_status status;
301 301
302 status = walk_root_bridge(handle, register_slot); 302 status = walk_root_bridge(root->device->handle, register_slot);
303 if (ACPI_FAILURE(status)) 303 if (ACPI_FAILURE(status))
304 err("%s: register_slot failure - %d\n", __func__, status); 304 err("%s: register_slot failure - %d\n", __func__, status);
305 305
@@ -311,10 +311,11 @@ acpi_pci_slot_add(acpi_handle handle)
311 * @handle: points to an acpi_pci_root 311 * @handle: points to an acpi_pci_root
312 */ 312 */
313static void 313static void
314acpi_pci_slot_remove(acpi_handle handle) 314acpi_pci_slot_remove(struct acpi_pci_root *root)
315{ 315{
316 struct acpi_pci_slot *slot, *tmp; 316 struct acpi_pci_slot *slot, *tmp;
317 struct pci_bus *pbus; 317 struct pci_bus *pbus;
318 acpi_handle handle = root->device->handle;
318 319
319 mutex_lock(&slot_list_lock); 320 mutex_lock(&slot_list_lock);
320 list_for_each_entry_safe(slot, tmp, &slot_list, list) { 321 list_for_each_entry_safe(slot, tmp, &slot_list, list) {