From bcbb15530ebe9737622cb7779b35c61f48b49734 Mon Sep 17 00:00:00 2001 From: Tim Gardner Date: Fri, 16 Aug 2013 11:18:59 -0600 Subject: [PATCH] ALSA: pcm: Add snd_printd_ratelimit() Direct calls to printk_limit() will emit log noise even when CONFIG_SND_DEBUG is not defined. Add a wrapper macro around printk_limit() that is conditionally defined by CONFIG_SND_DEBUG. Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Pierre-Louis Bossart Cc: Lars-Peter Clausen Cc: Yacine Belkadi Signed-off-by: Tim Gardner Signed-off-by: Takashi Iwai --- include/sound/core.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/sound/core.h b/include/sound/core.h index c586617cfa0d..2a14f1f02d4f 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -27,6 +27,7 @@ #include /* struct rw_semaphore */ #include /* pm_message_t */ #include +#include /* number of supported soundcards */ #ifdef CONFIG_SND_DYNAMIC_MINORS @@ -375,6 +376,11 @@ void __snd_printk(unsigned int level, const char *file, int line, */ #define snd_BUG() WARN(1, "BUG?\n") +/** + * Suppress high rates of output when CONFIG_SND_DEBUG is enabled. + */ +#define snd_printd_ratelimit() printk_ratelimit() + /** * snd_BUG_ON - debugging check macro * @cond: condition to evaluate @@ -398,6 +404,8 @@ static inline void _snd_printd(int level, const char *format, ...) {} unlikely(__ret_warn_on); \ }) +static inline bool snd_printd_ratelimit(void) { return false; } + #endif /* CONFIG_SND_DEBUG */ #ifdef CONFIG_SND_DEBUG_VERBOSE -- 2.39.5