diff options
author | Thomas Renninger <trenn@suse.de> | 2006-06-02 15:58:00 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-06-27 00:56:56 -0400 |
commit | e8406b4485730031d91872086456bd052948686b (patch) | |
tree | be5a62931928098fb87d5df4d23279991b3fa4f7 | |
parent | d550d98d3317378d93a4869db204725d270ec812 (diff) |
[ACPI] Print error message if remove/install notify handler fails
Signed-off-by: Thomas Renniger <trenn@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | drivers/acpi/events/evxface.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 76c34a66e0e0..4f948df17ab9 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -414,12 +414,13 @@ acpi_remove_notify_handler(acpi_handle device, | |||
414 | 414 | ||
415 | if ((!device) || | 415 | if ((!device) || |
416 | (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { | 416 | (!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) { |
417 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 417 | status = AE_BAD_PARAMETER; |
418 | goto exit; | ||
418 | } | 419 | } |
419 | 420 | ||
420 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 421 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
421 | if (ACPI_FAILURE(status)) { | 422 | if (ACPI_FAILURE(status)) { |
422 | return_ACPI_STATUS(status); | 423 | goto exit; |
423 | } | 424 | } |
424 | 425 | ||
425 | /* Convert and validate the device handle */ | 426 | /* Convert and validate the device handle */ |
@@ -427,7 +428,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
427 | node = acpi_ns_map_handle_to_node(device); | 428 | node = acpi_ns_map_handle_to_node(device); |
428 | if (!node) { | 429 | if (!node) { |
429 | status = AE_BAD_PARAMETER; | 430 | status = AE_BAD_PARAMETER; |
430 | goto unlock_and_exit; | 431 | goto unlock; |
431 | } | 432 | } |
432 | 433 | ||
433 | /* Root Object */ | 434 | /* Root Object */ |
@@ -441,7 +442,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
441 | ((handler_type & ACPI_DEVICE_NOTIFY) && | 442 | ((handler_type & ACPI_DEVICE_NOTIFY) && |
442 | !acpi_gbl_device_notify.handler)) { | 443 | !acpi_gbl_device_notify.handler)) { |
443 | status = AE_NOT_EXIST; | 444 | status = AE_NOT_EXIST; |
444 | goto unlock_and_exit; | 445 | goto unlock; |
445 | } | 446 | } |
446 | 447 | ||
447 | /* Make sure all deferred tasks are completed */ | 448 | /* Make sure all deferred tasks are completed */ |
@@ -450,7 +451,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
450 | acpi_os_wait_events_complete(NULL); | 451 | acpi_os_wait_events_complete(NULL); |
451 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 452 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
452 | if (ACPI_FAILURE(status)) { | 453 | if (ACPI_FAILURE(status)) { |
453 | return_ACPI_STATUS(status); | 454 | goto exit; |
454 | } | 455 | } |
455 | 456 | ||
456 | if (handler_type & ACPI_SYSTEM_NOTIFY) { | 457 | if (handler_type & ACPI_SYSTEM_NOTIFY) { |
@@ -473,7 +474,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
473 | 474 | ||
474 | if (!acpi_ev_is_notify_object(node)) { | 475 | if (!acpi_ev_is_notify_object(node)) { |
475 | status = AE_TYPE; | 476 | status = AE_TYPE; |
476 | goto unlock_and_exit; | 477 | goto unlock; |
477 | } | 478 | } |
478 | 479 | ||
479 | /* Check for an existing internal object */ | 480 | /* Check for an existing internal object */ |
@@ -481,7 +482,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
481 | obj_desc = acpi_ns_get_attached_object(node); | 482 | obj_desc = acpi_ns_get_attached_object(node); |
482 | if (!obj_desc) { | 483 | if (!obj_desc) { |
483 | status = AE_NOT_EXIST; | 484 | status = AE_NOT_EXIST; |
484 | goto unlock_and_exit; | 485 | goto unlock; |
485 | } | 486 | } |
486 | 487 | ||
487 | /* Object exists - make sure there's an existing handler */ | 488 | /* Object exists - make sure there's an existing handler */ |
@@ -491,7 +492,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
491 | if ((!notify_obj) || | 492 | if ((!notify_obj) || |
492 | (notify_obj->notify.handler != handler)) { | 493 | (notify_obj->notify.handler != handler)) { |
493 | status = AE_BAD_PARAMETER; | 494 | status = AE_BAD_PARAMETER; |
494 | goto unlock_and_exit; | 495 | goto unlock; |
495 | } | 496 | } |
496 | /* Make sure all deferred tasks are completed */ | 497 | /* Make sure all deferred tasks are completed */ |
497 | 498 | ||
@@ -499,7 +500,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
499 | acpi_os_wait_events_complete(NULL); | 500 | acpi_os_wait_events_complete(NULL); |
500 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 501 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
501 | if (ACPI_FAILURE(status)) { | 502 | if (ACPI_FAILURE(status)) { |
502 | return_ACPI_STATUS(status); | 503 | goto exit; |
503 | } | 504 | } |
504 | 505 | ||
505 | /* Remove the handler */ | 506 | /* Remove the handler */ |
@@ -512,7 +513,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
512 | if ((!notify_obj) || | 513 | if ((!notify_obj) || |
513 | (notify_obj->notify.handler != handler)) { | 514 | (notify_obj->notify.handler != handler)) { |
514 | status = AE_BAD_PARAMETER; | 515 | status = AE_BAD_PARAMETER; |
515 | goto unlock_and_exit; | 516 | goto unlock; |
516 | } | 517 | } |
517 | /* Make sure all deferred tasks are completed */ | 518 | /* Make sure all deferred tasks are completed */ |
518 | 519 | ||
@@ -520,7 +521,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
520 | acpi_os_wait_events_complete(NULL); | 521 | acpi_os_wait_events_complete(NULL); |
521 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 522 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
522 | if (ACPI_FAILURE(status)) { | 523 | if (ACPI_FAILURE(status)) { |
523 | return_ACPI_STATUS(status); | 524 | goto exit; |
524 | } | 525 | } |
525 | 526 | ||
526 | /* Remove the handler */ | 527 | /* Remove the handler */ |
@@ -529,8 +530,11 @@ acpi_remove_notify_handler(acpi_handle device, | |||
529 | } | 530 | } |
530 | } | 531 | } |
531 | 532 | ||
532 | unlock_and_exit: | 533 | unlock: |
533 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 534 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
535 | exit: | ||
536 | if (ACPI_FAILURE(status)) | ||
537 | ACPI_EXCEPTION((AE_INFO, status, "Removing notify handler")); | ||
534 | return_ACPI_STATUS(status); | 538 | return_ACPI_STATUS(status); |
535 | } | 539 | } |
536 | 540 | ||
@@ -568,12 +572,13 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
568 | /* Parameter validation */ | 572 | /* Parameter validation */ |
569 | 573 | ||
570 | if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) { | 574 | if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) { |
571 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 575 | status = AE_BAD_PARAMETER; |
576 | goto exit; | ||
572 | } | 577 | } |
573 | 578 | ||
574 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 579 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
575 | if (ACPI_FAILURE(status)) { | 580 | if (ACPI_FAILURE(status)) { |
576 | return_ACPI_STATUS(status); | 581 | goto exit; |
577 | } | 582 | } |
578 | 583 | ||
579 | /* Ensure that we have a valid GPE number */ | 584 | /* Ensure that we have a valid GPE number */ |
@@ -581,7 +586,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
581 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); | 586 | gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); |
582 | if (!gpe_event_info) { | 587 | if (!gpe_event_info) { |
583 | status = AE_BAD_PARAMETER; | 588 | status = AE_BAD_PARAMETER; |
584 | goto unlock_and_exit; | 589 | goto unlock; |
585 | } | 590 | } |
586 | 591 | ||
587 | /* Make sure that there isn't a handler there already */ | 592 | /* Make sure that there isn't a handler there already */ |
@@ -589,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
589 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 594 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
590 | ACPI_GPE_DISPATCH_HANDLER) { | 595 | ACPI_GPE_DISPATCH_HANDLER) { |
591 | status = AE_ALREADY_EXISTS; | 596 | status = AE_ALREADY_EXISTS; |
592 | goto unlock_and_exit; | 597 | goto unlock; |
593 | } | 598 | } |
594 | 599 | ||
595 | /* Allocate and init handler object */ | 600 | /* Allocate and init handler object */ |
@@ -597,7 +602,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
597 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); | 602 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); |
598 | if (!handler) { | 603 | if (!handler) { |
599 | status = AE_NO_MEMORY; | 604 | status = AE_NO_MEMORY; |
600 | goto unlock_and_exit; | 605 | goto unlock; |
601 | } | 606 | } |
602 | 607 | ||
603 | handler->address = address; | 608 | handler->address = address; |
@@ -608,7 +613,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
608 | 613 | ||
609 | status = acpi_ev_disable_gpe(gpe_event_info); | 614 | status = acpi_ev_disable_gpe(gpe_event_info); |
610 | if (ACPI_FAILURE(status)) { | 615 | if (ACPI_FAILURE(status)) { |
611 | goto unlock_and_exit; | 616 | goto unlock; |
612 | } | 617 | } |
613 | 618 | ||
614 | /* Install the handler */ | 619 | /* Install the handler */ |
@@ -623,8 +628,12 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
623 | 628 | ||
624 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | 629 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
625 | 630 | ||
626 | unlock_and_exit: | 631 | unlock: |
627 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 632 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
633 | exit: | ||
634 | if (ACPI_FAILURE(status)) | ||
635 | ACPI_EXCEPTION((AE_INFO, status, | ||
636 | "Installing notify handler failed")); | ||
628 | return_ACPI_STATUS(status); | 637 | return_ACPI_STATUS(status); |
629 | } | 638 | } |
630 | 639 | ||