aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-08-27 10:45:07 -0400
committerTakashi Iwai <tiwai@suse.de>2009-08-27 11:42:08 -0400
commit36ce99c1dcab2978fc1900f19b431adedd8f99f6 (patch)
tree5023629848d50243df8bbb780fde50468fd6acd3 /include
parent1b0053a0f0893e6bbaaee0d28f5f6269459d8d14 (diff)
ALSA: Add debug module option
Add debug module option to snd core. This controls the debug print level. When CONFIG_SND_DEBUG_VERBOSE is set, you can suppress the debug messages by giving or changing this parameter to a lower value. debug=0 means no debug messsages. As default, it's set to the verbose level 2. Since this option can be changed dynamically via sysfs file, you can suppress the verbose debug messages on the fly, which wasn't possible before. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/sound/core.h38
1 files changed, 14 insertions, 24 deletions
diff --git a/include/sound/core.h b/include/sound/core.h
index 309cb9659a05..a89728db5584 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -340,18 +340,17 @@ unsigned int snd_dma_pointer(unsigned long dma, unsigned int size);
340struct resource; 340struct resource;
341void release_and_free_resource(struct resource *res); 341void release_and_free_resource(struct resource *res);
342 342
343#ifdef CONFIG_SND_VERBOSE_PRINTK
344void snd_verbose_printk(const char *file, int line, const char *format, ...)
345 __attribute__ ((format (printf, 3, 4)));
346#endif
347#if defined(CONFIG_SND_DEBUG) && defined(CONFIG_SND_VERBOSE_PRINTK)
348void snd_verbose_printd(const char *file, int line, const char *format, ...)
349 __attribute__ ((format (printf, 3, 4)));
350#endif
351
352/* --- */ 343/* --- */
353 344
354#ifdef CONFIG_SND_VERBOSE_PRINTK 345#if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK)
346void __snd_printk(unsigned int level, const char *file, int line,
347 const char *format, ...)
348 __attribute__ ((format (printf, 4, 5)));
349#else
350#define __snd_printk(level, file, line, format, args...) \
351 prinkt(format, ##args)
352#endif
353
355/** 354/**
356 * snd_printk - printk wrapper 355 * snd_printk - printk wrapper
357 * @fmt: format string 356 * @fmt: format string
@@ -360,15 +359,9 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
360 * when configured with CONFIG_SND_VERBOSE_PRINTK. 359 * when configured with CONFIG_SND_VERBOSE_PRINTK.
361 */ 360 */
362#define snd_printk(fmt, args...) \ 361#define snd_printk(fmt, args...) \
363 snd_verbose_printk(__FILE__, __LINE__, fmt ,##args) 362 __snd_printk(0, __FILE__, __LINE__, fmt, ##args)
364#else
365#define snd_printk(fmt, args...) \
366 printk(fmt ,##args)
367#endif
368 363
369#ifdef CONFIG_SND_DEBUG 364#ifdef CONFIG_SND_DEBUG
370
371#ifdef CONFIG_SND_VERBOSE_PRINTK
372/** 365/**
373 * snd_printd - debug printk 366 * snd_printd - debug printk
374 * @fmt: format string 367 * @fmt: format string
@@ -377,11 +370,7 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
377 * Ignored when CONFIG_SND_DEBUG is not set. 370 * Ignored when CONFIG_SND_DEBUG is not set.
378 */ 371 */
379#define snd_printd(fmt, args...) \ 372#define snd_printd(fmt, args...) \
380 snd_verbose_printd(__FILE__, __LINE__, fmt ,##args) 373 __snd_printk(1, __FILE__, __LINE__, fmt, ##args)
381#else
382#define snd_printd(fmt, args...) \
383 printk(fmt ,##args)
384#endif
385 374
386/** 375/**
387 * snd_BUG - give a BUG warning message and stack trace 376 * snd_BUG - give a BUG warning message and stack trace
@@ -428,9 +417,10 @@ static inline int __snd_bug_on(int cond)
428 * Works like snd_printk() for debugging purposes. 417 * Works like snd_printk() for debugging purposes.
429 * Ignored when CONFIG_SND_DEBUG_VERBOSE is not set. 418 * Ignored when CONFIG_SND_DEBUG_VERBOSE is not set.
430 */ 419 */
431#define snd_printdd(format, args...) snd_printk(format, ##args) 420#define snd_printdd(format, args...) \
421 __snd_printk(2, __FILE__, __LINE__, format, ##args)
432#else 422#else
433#define snd_printdd(format, args...) /* nothing */ 423#define snd_printdd(format, args...) do { } while (0)
434#endif 424#endif
435 425
436 426