Skip to content

Commit

Permalink
ALSA: pcm: Add snd_printd_ratelimit()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: Pierre-Louis Bossart <[email protected]>
Cc: Lars-Peter Clausen <[email protected]>
Cc: Yacine Belkadi <[email protected]>
Signed-off-by: Tim Gardner <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
rtg-canonical authored and tiwai committed Aug 19, 2013
1 parent c841ad2 commit bcbb155
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/sound/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/rwsem.h> /* struct rw_semaphore */
#include <linux/pm.h> /* pm_message_t */
#include <linux/stringify.h>
#include <linux/printk.h>

/* number of supported soundcards */
#ifdef CONFIG_SND_DYNAMIC_MINORS
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit bcbb155

Please sign in to comment.