[alsa-devel] [PATCH] ALSA: get rid of CONFIG_SND_VERBOSE_PRINTK

Joe Perches joe at perches.com
Tue Jun 4 21:45:34 CEST 2013


On Tue, 2013-06-04 at 15:32 -0400, Alan Stern wrote:
> Similarly, snd_printdd() can be translated to a macro that expands to 
> dev_dbg when CONFIG_SND_VERBOSE_DEBUG is enabled, and to nothing 
> otherwise.
> 
> Does this seem reasonable?

A somewhat common convention is to use

	prefix_dbg(level, fmt, ...)

where level is either a numeric value or bitmask,
and also is either a #define or a MODULE_PARAM

today sound/misc.c has:

------------------------------------------

#ifdef CONFIG_SND_DEBUG

#ifdef CONFIG_SND_DEBUG_VERBOSE
#define DEFAULT_DEBUG_LEVEL	2
#else
#define DEFAULT_DEBUG_LEVEL	1
#endif

static int debug = DEFAULT_DEBUG_LEVEL;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Debug level (0 = disable)");

#endif /* CONFIG_SND_DEBUG */

------------------------------------------

I suggest converting all the remaining

snd_printd(...) to snd_dbg(1, ...)
and
snd_printdd(...) to snd_dbg(2, ...)

so that debug module param control can be used for
all these and if the DEFAULT_DEBUG_LEVEL isn't
high enough, the various snd_dbg(2, ...) can be
completely optimized away if appropriate.





More information about the Alsa-devel mailing list