diff options
Diffstat (limited to 'include/acpi/acoutput.h')
-rw-r--r-- | include/acpi/acoutput.h | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 9885276178e0..4f52ea795c7a 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h | |||
@@ -324,9 +324,9 @@ | |||
324 | 324 | ||
325 | /* Helper macro */ | 325 | /* Helper macro */ |
326 | 326 | ||
327 | #define ACPI_TRACE_ENTRY(name, function, cast, param) \ | 327 | #define ACPI_TRACE_ENTRY(name, function, type, param) \ |
328 | ACPI_FUNCTION_NAME (name) \ | 328 | ACPI_FUNCTION_NAME (name) \ |
329 | function (ACPI_DEBUG_PARAMETERS, cast (param)) | 329 | function (ACPI_DEBUG_PARAMETERS, (type) (param)) |
330 | 330 | ||
331 | /* The actual entry trace macros */ | 331 | /* The actual entry trace macros */ |
332 | 332 | ||
@@ -335,13 +335,13 @@ | |||
335 | acpi_ut_trace (ACPI_DEBUG_PARAMETERS) | 335 | acpi_ut_trace (ACPI_DEBUG_PARAMETERS) |
336 | 336 | ||
337 | #define ACPI_FUNCTION_TRACE_PTR(name, pointer) \ | 337 | #define ACPI_FUNCTION_TRACE_PTR(name, pointer) \ |
338 | ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, (void *), pointer) | 338 | ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, void *, pointer) |
339 | 339 | ||
340 | #define ACPI_FUNCTION_TRACE_U32(name, value) \ | 340 | #define ACPI_FUNCTION_TRACE_U32(name, value) \ |
341 | ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, (u32), value) | 341 | ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, u32, value) |
342 | 342 | ||
343 | #define ACPI_FUNCTION_TRACE_STR(name, string) \ | 343 | #define ACPI_FUNCTION_TRACE_STR(name, string) \ |
344 | ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, (char *), string) | 344 | ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, char *, string) |
345 | 345 | ||
346 | #define ACPI_FUNCTION_ENTRY() \ | 346 | #define ACPI_FUNCTION_ENTRY() \ |
347 | acpi_ut_track_stack_ptr() | 347 | acpi_ut_track_stack_ptr() |
@@ -355,16 +355,37 @@ | |||
355 | * | 355 | * |
356 | * One of the FUNCTION_TRACE macros above must be used in conjunction | 356 | * One of the FUNCTION_TRACE macros above must be used in conjunction |
357 | * with these macros so that "_AcpiFunctionName" is defined. | 357 | * with these macros so that "_AcpiFunctionName" is defined. |
358 | * | ||
359 | * There are two versions of most of the return macros. The default version is | ||
360 | * safer, since it avoids side-effects by guaranteeing that the argument will | ||
361 | * not be evaluated twice. | ||
362 | * | ||
363 | * A less-safe version of the macros is provided for optional use if the | ||
364 | * compiler uses excessive CPU stack (for example, this may happen in the | ||
365 | * debug case if code optimzation is disabled.) | ||
358 | */ | 366 | */ |
359 | 367 | ||
360 | /* Exit trace helper macro */ | 368 | /* Exit trace helper macro */ |
361 | 369 | ||
362 | #define ACPI_TRACE_EXIT(function, cast, param) \ | 370 | #ifndef ACPI_SIMPLE_RETURN_MACROS |
371 | |||
372 | #define ACPI_TRACE_EXIT(function, type, param) \ | ||
373 | ACPI_DO_WHILE0 ({ \ | ||
374 | register type _param = (type) (param); \ | ||
375 | function (ACPI_DEBUG_PARAMETERS, _param); \ | ||
376 | return (_param); \ | ||
377 | }) | ||
378 | |||
379 | #else /* Use original less-safe macros */ | ||
380 | |||
381 | #define ACPI_TRACE_EXIT(function, type, param) \ | ||
363 | ACPI_DO_WHILE0 ({ \ | 382 | ACPI_DO_WHILE0 ({ \ |
364 | function (ACPI_DEBUG_PARAMETERS, cast (param)); \ | 383 | function (ACPI_DEBUG_PARAMETERS, (type) (param)); \ |
365 | return ((param)); \ | 384 | return (param); \ |
366 | }) | 385 | }) |
367 | 386 | ||
387 | #endif /* ACPI_SIMPLE_RETURN_MACROS */ | ||
388 | |||
368 | /* The actual exit macros */ | 389 | /* The actual exit macros */ |
369 | 390 | ||
370 | #define return_VOID \ | 391 | #define return_VOID \ |
@@ -374,13 +395,19 @@ | |||
374 | }) | 395 | }) |
375 | 396 | ||
376 | #define return_ACPI_STATUS(status) \ | 397 | #define return_ACPI_STATUS(status) \ |
377 | ACPI_TRACE_EXIT (acpi_ut_status_exit, (acpi_status), status) | 398 | ACPI_TRACE_EXIT (acpi_ut_status_exit, acpi_status, status) |
378 | 399 | ||
379 | #define return_PTR(pointer) \ | 400 | #define return_PTR(pointer) \ |
380 | ACPI_TRACE_EXIT (acpi_ut_ptr_exit, (u8 *), pointer) | 401 | ACPI_TRACE_EXIT (acpi_ut_ptr_exit, void *, pointer) |
381 | 402 | ||
382 | #define return_VALUE(value) \ | 403 | #define return_VALUE(value) \ |
383 | ACPI_TRACE_EXIT (acpi_ut_value_exit, (u64), value) | 404 | ACPI_TRACE_EXIT (acpi_ut_value_exit, u64, value) |
405 | |||
406 | #define return_UINT32(value) \ | ||
407 | ACPI_TRACE_EXIT (acpi_ut_value_exit, u32, value) | ||
408 | |||
409 | #define return_UINT8(value) \ | ||
410 | ACPI_TRACE_EXIT (acpi_ut_value_exit, u8, value) | ||
384 | 411 | ||
385 | /* Conditional execution */ | 412 | /* Conditional execution */ |
386 | 413 | ||
@@ -428,8 +455,10 @@ | |||
428 | 455 | ||
429 | #define return_VOID return | 456 | #define return_VOID return |
430 | #define return_ACPI_STATUS(s) return(s) | 457 | #define return_ACPI_STATUS(s) return(s) |
431 | #define return_VALUE(s) return(s) | ||
432 | #define return_PTR(s) return(s) | 458 | #define return_PTR(s) return(s) |
459 | #define return_VALUE(s) return(s) | ||
460 | #define return_UINT8(s) return(s) | ||
461 | #define return_UINT32(s) return(s) | ||
433 | 462 | ||
434 | #endif /* ACPI_DEBUG_OUTPUT */ | 463 | #endif /* ACPI_DEBUG_OUTPUT */ |
435 | 464 | ||