aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/acpiphp_glue.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/acpiphp_glue.c')
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 602d153c7055..70741c8c46a0 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -80,8 +80,9 @@ static struct acpiphp_context *acpiphp_init_context(struct acpi_device *adev)
80 return NULL; 80 return NULL;
81 81
82 context->refcount = 1; 82 context->refcount = 1;
83 acpi_set_hp_context(adev, &context->hp, acpiphp_hotplug_notify, NULL, 83 context->hp.notify = acpiphp_hotplug_notify;
84 acpiphp_post_dock_fixup); 84 context->hp.fixup = acpiphp_post_dock_fixup;
85 acpi_set_hp_context(adev, &context->hp);
85 return context; 86 return context;
86} 87}
87 88
@@ -369,20 +370,6 @@ static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data,
369 return AE_OK; 370 return AE_OK;
370} 371}
371 372
372static struct acpiphp_bridge *acpiphp_dev_to_bridge(struct acpi_device *adev)
373{
374 struct acpiphp_bridge *bridge = NULL;
375
376 acpi_lock_hp_context();
377 if (adev->hp) {
378 bridge = to_acpiphp_root_context(adev->hp)->root_bridge;
379 if (bridge)
380 get_bridge(bridge);
381 }
382 acpi_unlock_hp_context();
383 return bridge;
384}
385
386static void cleanup_bridge(struct acpiphp_bridge *bridge) 373static void cleanup_bridge(struct acpiphp_bridge *bridge)
387{ 374{
388 struct acpiphp_slot *slot; 375 struct acpiphp_slot *slot;
@@ -753,9 +740,15 @@ static void acpiphp_sanitize_bus(struct pci_bus *bus)
753 740
754void acpiphp_check_host_bridge(struct acpi_device *adev) 741void acpiphp_check_host_bridge(struct acpi_device *adev)
755{ 742{
756 struct acpiphp_bridge *bridge; 743 struct acpiphp_bridge *bridge = NULL;
757 744
758 bridge = acpiphp_dev_to_bridge(adev); 745 acpi_lock_hp_context();
746 if (adev->hp) {
747 bridge = to_acpiphp_root_context(adev->hp)->root_bridge;
748 if (bridge)
749 get_bridge(bridge);
750 }
751 acpi_unlock_hp_context();
759 if (bridge) { 752 if (bridge) {
760 pci_lock_rescan_remove(); 753 pci_lock_rescan_remove();
761 754
@@ -884,7 +877,7 @@ void acpiphp_enumerate_slots(struct pci_bus *bus)
884 goto err; 877 goto err;
885 878
886 root_context->root_bridge = bridge; 879 root_context->root_bridge = bridge;
887 acpi_set_hp_context(adev, &root_context->hp, NULL, NULL, NULL); 880 acpi_set_hp_context(adev, &root_context->hp);
888 } else { 881 } else {
889 struct acpiphp_context *context; 882 struct acpiphp_context *context;
890 883
@@ -927,7 +920,7 @@ void acpiphp_enumerate_slots(struct pci_bus *bus)
927 kfree(bridge); 920 kfree(bridge);
928} 921}
929 922
930void acpiphp_drop_bridge(struct acpiphp_bridge *bridge) 923static void acpiphp_drop_bridge(struct acpiphp_bridge *bridge)
931{ 924{
932 if (pci_is_root_bus(bridge->pci_bus)) { 925 if (pci_is_root_bus(bridge->pci_bus)) {
933 struct acpiphp_root_context *root_context; 926 struct acpiphp_root_context *root_context;