diff options
Diffstat (limited to 'include/acpi/acmacros.h')
-rw-r--r-- | include/acpi/acmacros.h | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index 702cc4e57f5f..258cfe5e2aac 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h | |||
@@ -525,6 +525,9 @@ | |||
525 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. | 525 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. |
526 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros | 526 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros |
527 | * so that "_acpi_function_name" is defined. | 527 | * so that "_acpi_function_name" is defined. |
528 | * | ||
529 | * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining | ||
530 | * about these constructs. | ||
528 | */ | 531 | */ |
529 | #ifdef ACPI_USE_DO_WHILE_0 | 532 | #ifdef ACPI_USE_DO_WHILE_0 |
530 | #define ACPI_DO_WHILE0(a) do a while(0) | 533 | #define ACPI_DO_WHILE0(a) do a while(0) |
@@ -532,10 +535,55 @@ | |||
532 | #define ACPI_DO_WHILE0(a) a | 535 | #define ACPI_DO_WHILE0(a) a |
533 | #endif | 536 | #endif |
534 | 537 | ||
535 | #define return_VOID ACPI_DO_WHILE0 ({acpi_ut_exit(ACPI_DEBUG_PARAMETERS);return;}) | 538 | #define return_VOID ACPI_DO_WHILE0 ({ \ |
536 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({acpi_ut_status_exit(ACPI_DEBUG_PARAMETERS,(s));return((s));}) | 539 | acpi_ut_exit (ACPI_DEBUG_PARAMETERS); \ |
537 | #define return_VALUE(s) ACPI_DO_WHILE0 ({acpi_ut_value_exit(ACPI_DEBUG_PARAMETERS,(acpi_integer)(s));return((s));}) | 540 | return;}) |
538 | #define return_PTR(s) ACPI_DO_WHILE0 ({acpi_ut_ptr_exit(ACPI_DEBUG_PARAMETERS,(u8 *)(s));return((s));}) | 541 | /* |
542 | * There are two versions of most of the return macros. The default version is | ||
543 | * safer, since it avoids side-effects by guaranteeing that the argument will | ||
544 | * not be evaluated twice. | ||
545 | * | ||
546 | * A less-safe version of the macros is provided for optional use if the | ||
547 | * compiler uses excessive CPU stack (for example, this may happen in the | ||
548 | * debug case if code optimzation is disabled.) | ||
549 | */ | ||
550 | #ifndef ACPI_SIMPLE_RETURN_MACROS | ||
551 | |||
552 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ | ||
553 | register acpi_status _s = (s); \ | ||
554 | acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
555 | return (_s); }) | ||
556 | #define return_PTR(s) ACPI_DO_WHILE0 ({ \ | ||
557 | register void *_s = (void *) (s); \ | ||
558 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) _s); \ | ||
559 | return (_s); }) | ||
560 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | ||
561 | register acpi_integer _s = (s); \ | ||
562 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
563 | return (_s); }) | ||
564 | #define return_UINT8(s) ACPI_DO_WHILE0 ({ \ | ||
565 | register u8 _s = (u8) (s); \ | ||
566 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
567 | return (_s); }) | ||
568 | #define return_UINT32(s) ACPI_DO_WHILE0 ({ \ | ||
569 | register u32 _s = (u32) (s); \ | ||
570 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, _s); \ | ||
571 | return (_s); }) | ||
572 | #else /* Use original less-safe macros */ | ||
573 | |||
574 | #define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \ | ||
575 | acpi_ut_status_exit (ACPI_DEBUG_PARAMETERS, (s)); \ | ||
576 | return((s)); }) | ||
577 | #define return_PTR(s) ACPI_DO_WHILE0 ({ \ | ||
578 | acpi_ut_ptr_exit (ACPI_DEBUG_PARAMETERS, (u8 *) (s)); \ | ||
579 | return((s)); }) | ||
580 | #define return_VALUE(s) ACPI_DO_WHILE0 ({ \ | ||
581 | acpi_ut_value_exit (ACPI_DEBUG_PARAMETERS, (acpi_integer) (s)); \ | ||
582 | return((s)); }) | ||
583 | #define return_UINT8(s) return_VALUE(s) | ||
584 | #define return_UINT32(s) return_VALUE(s) | ||
585 | |||
586 | #endif /* ACPI_SIMPLE_RETURN_MACROS */ | ||
539 | 587 | ||
540 | /* Conditional execution */ | 588 | /* Conditional execution */ |
541 | 589 | ||
@@ -612,6 +660,8 @@ | |||
612 | #define return_VOID return | 660 | #define return_VOID return |
613 | #define return_ACPI_STATUS(s) return(s) | 661 | #define return_ACPI_STATUS(s) return(s) |
614 | #define return_VALUE(s) return(s) | 662 | #define return_VALUE(s) return(s) |
663 | #define return_UINT8(s) return(s) | ||
664 | #define return_UINT32(s) return(s) | ||
615 | #define return_PTR(s) return(s) | 665 | #define return_PTR(s) return(s) |
616 | 666 | ||
617 | #endif | 667 | #endif |