diff options
author | Jaroslav Kysela <perex@perex.cz> | 2009-12-17 11:34:39 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2010-01-07 09:47:10 -0500 |
commit | 741b20cfb9109760937f403d18d731bfde31f56f (patch) | |
tree | 28b7377356039f3abfb85d260648b86e6c3a09ae /sound/core | |
parent | 4757968dbff3d43f373f08de973014a9bd41ef0a (diff) |
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>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/pcm_lib.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 30f410832a2..9621236b2fe 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -126,15 +126,22 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram | |||
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 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG | 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 | #else | 138 | #else |
132 | #define xrun_debug(substream, mask) 0 | 139 | #define xrun_debug(substream, mask) 0 |
133 | #endif | 140 | #endif |
134 | 141 | ||
135 | #define dump_stack_on_xrun(substream) do { \ | 142 | #define dump_stack_on_xrun(substream) do { \ |
136 | if (xrun_debug(substream, 2)) \ | 143 | if (xrun_debug(substream, XRUN_DEBUG_STACK)) \ |
137 | dump_stack(); \ | 144 | dump_stack(); \ |
138 | } while (0) | 145 | } while (0) |
139 | 146 | ||
140 | static void pcm_debug_name(struct snd_pcm_substream *substream, | 147 | static void pcm_debug_name(struct snd_pcm_substream *substream, |
@@ -154,7 +161,7 @@ static void xrun(struct snd_pcm_substream *substream) | |||
154 | if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) | 161 | if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) |
155 | snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp); | 162 | snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp); |
156 | snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); | 163 | snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); |
157 | if (xrun_debug(substream, 1)) { | 164 | if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { |
158 | char name[16]; | 165 | char name[16]; |
159 | pcm_debug_name(substream, name, sizeof(name)); | 166 | pcm_debug_name(substream, name, sizeof(name)); |
160 | snd_printd(KERN_DEBUG "XRUN: %s\n", name); | 167 | snd_printd(KERN_DEBUG "XRUN: %s\n", name); |
@@ -215,7 +222,7 @@ static int snd_pcm_update_hw_ptr_post(struct snd_pcm_substream *substream, | |||
215 | 222 | ||
216 | #define hw_ptr_error(substream, fmt, args...) \ | 223 | #define hw_ptr_error(substream, fmt, args...) \ |
217 | do { \ | 224 | do { \ |
218 | if (xrun_debug(substream, 1)) { \ | 225 | if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { \ |
219 | if (printk_ratelimit()) { \ | 226 | if (printk_ratelimit()) { \ |
220 | snd_printd("PCM: " fmt, ##args); \ | 227 | snd_printd("PCM: " fmt, ##args); \ |
221 | } \ | 228 | } \ |
@@ -237,7 +244,7 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) | |||
237 | xrun(substream); | 244 | xrun(substream); |
238 | return -EPIPE; | 245 | return -EPIPE; |
239 | } | 246 | } |
240 | if (xrun_debug(substream, 8)) { | 247 | if (xrun_debug(substream, XRUN_DEBUG_PERIODUPDATE)) { |
241 | char name[16]; | 248 | char name[16]; |
242 | pcm_debug_name(substream, name, sizeof(name)); | 249 | pcm_debug_name(substream, name, sizeof(name)); |
243 | snd_printd("period_update: %s: pos=0x%x/0x%x/0x%x, " | 250 | snd_printd("period_update: %s: pos=0x%x/0x%x/0x%x, " |
@@ -290,7 +297,7 @@ static int snd_pcm_update_hw_ptr_interrupt(struct snd_pcm_substream *substream) | |||
290 | } | 297 | } |
291 | 298 | ||
292 | /* Do jiffies check only in xrun_debug mode */ | 299 | /* Do jiffies check only in xrun_debug mode */ |
293 | if (!xrun_debug(substream, 4)) | 300 | if (!xrun_debug(substream, XRUN_DEBUG_JIFFIESCHECK)) |
294 | goto no_jiffies_check; | 301 | goto no_jiffies_check; |
295 | 302 | ||
296 | /* Skip the jiffies check for hardwares with BATCH flag. | 303 | /* Skip the jiffies check for hardwares with BATCH flag. |
@@ -369,7 +376,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) | |||
369 | xrun(substream); | 376 | xrun(substream); |
370 | return -EPIPE; | 377 | return -EPIPE; |
371 | } | 378 | } |
372 | if (xrun_debug(substream, 16)) { | 379 | if (xrun_debug(substream, XRUN_DEBUG_HWPTRUPDATE)) { |
373 | char name[16]; | 380 | char name[16]; |
374 | pcm_debug_name(substream, name, sizeof(name)); | 381 | pcm_debug_name(substream, name, sizeof(name)); |
375 | snd_printd("hw_update: %s: pos=0x%x/0x%x/0x%x, " | 382 | snd_printd("hw_update: %s: pos=0x%x/0x%x/0x%x, " |
@@ -403,7 +410,7 @@ int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) | |||
403 | new_hw_ptr = hw_base + pos; | 410 | new_hw_ptr = hw_base + pos; |
404 | } | 411 | } |
405 | /* Do jiffies check only in xrun_debug mode */ | 412 | /* Do jiffies check only in xrun_debug mode */ |
406 | if (!xrun_debug(substream, 4)) | 413 | if (!xrun_debug(substream, XRUN_DEBUG_JIFFIESCHECK)) |
407 | goto no_jiffies_check; | 414 | goto no_jiffies_check; |
408 | if (delta < runtime->delay) | 415 | if (delta < runtime->delay) |
409 | goto no_jiffies_check; | 416 | goto no_jiffies_check; |