diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-10-10 05:46:31 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-11-04 07:17:42 -0500 |
commit | 7c22f1aaa23370bf9ba2dd3abbccbed70dced216 (patch) | |
tree | ebc9c1e5cfdab4815afdfab1ba583e6220287252 /include | |
parent | f01cc521a2abef5dba24fb0873b9626ba6b0a0a5 (diff) |
[ALSA] Remove snd_runtime_check() macro
Remove snd_runtime_check() macro.
This macro worsens the readability of codes. They should be either
normal if() or removable asserts.
Also, the assert displays stack-dump, instead of only the last caller
pointer.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/sound/core.h | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/include/sound/core.h b/include/sound/core.h index 6d971a4c4ca0..f0f54407fe5c 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -429,34 +429,24 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) | |||
429 | * When CONFIG_SND_DEBUG is not set, the expression is executed but | 429 | * When CONFIG_SND_DEBUG is not set, the expression is executed but |
430 | * not checked. | 430 | * not checked. |
431 | */ | 431 | */ |
432 | #define snd_assert(expr, args...) do {\ | 432 | #define snd_assert(expr, args...) do { \ |
433 | if (unlikely(!(expr))) { \ | 433 | if (unlikely(!(expr))) { \ |
434 | snd_printk(KERN_ERR "BUG? (%s) (called from %p)\n", __ASTRING__(expr), __builtin_return_address(0));\ | 434 | snd_printk(KERN_ERR "BUG? (%s)\n", __ASTRING__(expr)); \ |
435 | args;\ | 435 | dump_stack(); \ |
436 | }\ | 436 | args; \ |
437 | } \ | ||
437 | } while (0) | 438 | } while (0) |
438 | /** | 439 | |
439 | * snd_runtime_check - run-time assertion macro | 440 | #define snd_BUG() do { \ |
440 | * @expr: expression | 441 | snd_printk(KERN_ERR "BUG?\n"); \ |
441 | * @args...: the action | 442 | dump_stack(); \ |
442 | * | ||
443 | * This macro checks the expression in run-time and invokes the commands | ||
444 | * given in the rest arguments if the assertion is failed. | ||
445 | * Unlike snd_assert(), the action commands are executed even if | ||
446 | * CONFIG_SND_DEBUG is not set but without any error messages. | ||
447 | */ | ||
448 | #define snd_runtime_check(expr, args...) do {\ | ||
449 | if (unlikely(!(expr))) { \ | ||
450 | snd_printk(KERN_ERR "ERROR (%s) (called from %p)\n", __ASTRING__(expr), __builtin_return_address(0));\ | ||
451 | args;\ | ||
452 | }\ | ||
453 | } while (0) | 443 | } while (0) |
454 | 444 | ||
455 | #else /* !CONFIG_SND_DEBUG */ | 445 | #else /* !CONFIG_SND_DEBUG */ |
456 | 446 | ||
457 | #define snd_printd(fmt, args...) /* nothing */ | 447 | #define snd_printd(fmt, args...) /* nothing */ |
458 | #define snd_assert(expr, args...) (void)(expr) | 448 | #define snd_assert(expr, args...) (void)(expr) |
459 | #define snd_runtime_check(expr, args...) do { if (!(expr)) { args; } } while (0) | 449 | #define snd_BUG() /* nothing */ |
460 | 450 | ||
461 | #endif /* CONFIG_SND_DEBUG */ | 451 | #endif /* CONFIG_SND_DEBUG */ |
462 | 452 | ||
@@ -473,8 +463,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...) | |||
473 | #define snd_printdd(format, args...) /* nothing */ | 463 | #define snd_printdd(format, args...) /* nothing */ |
474 | #endif | 464 | #endif |
475 | 465 | ||
476 | #define snd_BUG() snd_assert(0, ) | ||
477 | |||
478 | 466 | ||
479 | static inline void snd_timestamp_now(struct timespec *tstamp, int timespec) | 467 | static inline void snd_timestamp_now(struct timespec *tstamp, int timespec) |
480 | { | 468 | { |