Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: pcm_lib.c - convert second xrun_debug() parameter to use defines

To increase code readability, convert send xrun_debug() argument to
use defines.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>

+17 -10
+17 -10
sound/core/pcm_lib.c
··· 126 126 } 127 127 } 128 128 129 + #define XRUN_DEBUG_BASIC (1<<0) 130 + #define XRUN_DEBUG_STACK (1<<1) /* dump also stack */ 131 + #define XRUN_DEBUG_JIFFIESCHECK (1<<2) /* do jiffies check */ 132 + #define XRUN_DEBUG_PERIODUPDATE (1<<3) /* full period update info */ 133 + #define XRUN_DEBUG_HWPTRUPDATE (1<<4) /* full hwptr update info */ 134 + 129 135 #ifdef CONFIG_SND_PCM_XRUN_DEBUG 130 - #define xrun_debug(substream, mask) ((substream)->pstr->xrun_debug & (mask)) 136 + #define xrun_debug(substream, mask) \ 137 + ((substream)->pstr->xrun_debug & (mask)) 131 138 #else 132 139 #define xrun_debug(substream, mask) 0 133 140 #endif 134 141 135 - #define dump_stack_on_xrun(substream) do { \ 136 - if (xrun_debug(substream, 2)) \ 137 - dump_stack(); \ 142 + #define dump_stack_on_xrun(substream) do { \ 143 + if (xrun_debug(substream, XRUN_DEBUG_STACK)) \ 144 + dump_stack(); \ 138 145 } while (0) 139 146 140 147 static void pcm_debug_name(struct snd_pcm_substream *substream, ··· 161 154 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) 162 155 snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp); 163 156 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); 164 - if (xrun_debug(substream, 1)) { 157 + if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { 165 158 char name[16]; 166 159 pcm_debug_name(substream, name, sizeof(name)); 167 160 snd_printd(KERN_DEBUG "XRUN: %s\n", name); ··· 222 215 223 216 #define hw_ptr_error(substream, fmt, args...) \ 224 217 do { \ 225 - if (xrun_debug(substream, 1)) { \ 218 + if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { \ 226 219 if (printk_ratelimit()) { \ 227 220 snd_printd("PCM: " fmt, ##args); \ 228 221 } \ ··· 244 237 xrun(substream); 245 238 return -EPIPE; 246 239 } 247 - if (xrun_debug(substream, 8)) { 240 + if (xrun_debug(substream, XRUN_DEBUG_PERIODUPDATE)) { 248 241 char name[16]; 249 242 pcm_debug_name(substream, name, sizeof(name)); 250 243 snd_printd("period_update: %s: pos=0x%x/0x%x/0x%x, " ··· 297 290 } 298 291 299 292 /* Do jiffies check only in xrun_debug mode */ 300 - if (!xrun_debug(substream, 4)) 293 + if (!xrun_debug(substream, XRUN_DEBUG_JIFFIESCHECK)) 301 294 goto no_jiffies_check; 302 295 303 296 /* Skip the jiffies check for hardwares with BATCH flag. ··· 376 369 xrun(substream); 377 370 return -EPIPE; 378 371 } 379 - if (xrun_debug(substream, 16)) { 372 + if (xrun_debug(substream, XRUN_DEBUG_HWPTRUPDATE)) { 380 373 char name[16]; 381 374 pcm_debug_name(substream, name, sizeof(name)); 382 375 snd_printd("hw_update: %s: pos=0x%x/0x%x/0x%x, " ··· 410 403 new_hw_ptr = hw_base + pos; 411 404 } 412 405 /* Do jiffies check only in xrun_debug mode */ 413 - if (!xrun_debug(substream, 4)) 406 + if (!xrun_debug(substream, XRUN_DEBUG_JIFFIESCHECK)) 414 407 goto no_jiffies_check; 415 408 if (delta < runtime->delay) 416 409 goto no_jiffies_check;