Skip to content

Commit bcbb155

Browse files
rtg-canonicaltiwai
authored andcommitted
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 <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.de> Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Yacine Belkadi <yacine.belkadi.1@gmail.com> Signed-off-by: Tim Gardner <tim.gardner@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent c841ad2 commit bcbb155

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎include/sound/core.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/rwsem.h> /* struct rw_semaphore */
2828
#include <linux/pm.h> /* pm_message_t */
2929
#include <linux/stringify.h>
30+
#include <linux/printk.h>
3031

3132
/* number of supported soundcards */
3233
#ifdef CONFIG_SND_DYNAMIC_MINORS
@@ -375,6 +376,11 @@ void __snd_printk(unsigned int level, const char *file, int line,
375376
*/
376377
#define snd_BUG() WARN(1, "BUG?\n")
377378

379+
/**
380+
* Suppress high rates of output when CONFIG_SND_DEBUG is enabled.
381+
*/
382+
#define snd_printd_ratelimit() printk_ratelimit()
383+
378384
/**
379385
* snd_BUG_ON - debugging check macro
380386
* @cond: condition to evaluate
@@ -398,6 +404,8 @@ static inline void _snd_printd(int level, const char *format, ...) {}
398404
unlikely(__ret_warn_on); \
399405
})
400406

407+
static inline bool snd_printd_ratelimit(void) { return false; }
408+
401409
#endif /* CONFIG_SND_DEBUG */
402410

403411
#ifdef CONFIG_SND_DEBUG_VERBOSE

0 commit comments

Comments
 (0)