diff options
Diffstat (limited to 'drivers/pci/hotplug/acpiphp_glue.c')
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index f3c49c442d93..b7342d2e819b 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -297,7 +297,6 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data, | |||
297 | newfunc = &context->func; | 297 | newfunc = &context->func; |
298 | newfunc->function = function; | 298 | newfunc->function = function; |
299 | newfunc->parent = bridge; | 299 | newfunc->parent = bridge; |
300 | acpi_unlock_hp_context(); | ||
301 | 300 | ||
302 | if (acpi_has_method(handle, "_EJ0")) | 301 | if (acpi_has_method(handle, "_EJ0")) |
303 | newfunc->flags = FUNC_HAS_EJ0; | 302 | newfunc->flags = FUNC_HAS_EJ0; |
@@ -305,8 +304,14 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data, | |||
305 | if (acpi_has_method(handle, "_STA")) | 304 | if (acpi_has_method(handle, "_STA")) |
306 | newfunc->flags |= FUNC_HAS_STA; | 305 | newfunc->flags |= FUNC_HAS_STA; |
307 | 306 | ||
307 | /* | ||
308 | * Dock stations' notify handler should be used for dock devices instead | ||
309 | * of the common one, so clear hp.event in their contexts. | ||
310 | */ | ||
308 | if (acpi_has_method(handle, "_DCK")) | 311 | if (acpi_has_method(handle, "_DCK")) |
309 | newfunc->flags |= FUNC_HAS_DCK; | 312 | context->hp.event = NULL; |
313 | |||
314 | acpi_unlock_hp_context(); | ||
310 | 315 | ||
311 | /* search for objects that share the same slot */ | 316 | /* search for objects that share the same slot */ |
312 | list_for_each_entry(slot, &bridge->slots, node) | 317 | list_for_each_entry(slot, &bridge->slots, node) |
@@ -374,10 +379,6 @@ static acpi_status register_slot(acpi_handle handle, u32 lvl, void *data, | |||
374 | pr_debug("failed to register dock device\n"); | 379 | pr_debug("failed to register dock device\n"); |
375 | } | 380 | } |
376 | 381 | ||
377 | /* install notify handler */ | ||
378 | if (!(newfunc->flags & FUNC_HAS_DCK)) | ||
379 | acpi_install_hotplug_notify_handler(handle); | ||
380 | |||
381 | return AE_OK; | 382 | return AE_OK; |
382 | } | 383 | } |
383 | 384 | ||
@@ -411,13 +412,14 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge) | |||
411 | 412 | ||
412 | list_for_each_entry(slot, &bridge->slots, node) { | 413 | list_for_each_entry(slot, &bridge->slots, node) { |
413 | list_for_each_entry(func, &slot->funcs, sibling) { | 414 | list_for_each_entry(func, &slot->funcs, sibling) { |
414 | acpi_handle handle = func_to_handle(func); | 415 | struct acpi_device *adev = func_to_acpi_device(func); |
415 | 416 | ||
416 | if (is_dock_device(handle)) | 417 | if (is_dock_device(adev->handle)) |
417 | unregister_hotplug_dock_device(handle); | 418 | unregister_hotplug_dock_device(adev->handle); |
418 | 419 | ||
419 | if (!(func->flags & FUNC_HAS_DCK)) | 420 | acpi_lock_hp_context(); |
420 | acpi_remove_hotplug_notify_handler(handle); | 421 | adev->hp->event = NULL; |
422 | acpi_unlock_hp_context(); | ||
421 | } | 423 | } |
422 | slot->flags |= SLOT_IS_GOING_AWAY; | 424 | slot->flags |= SLOT_IS_GOING_AWAY; |
423 | if (slot->slot) | 425 | if (slot->slot) |