| 1 |
From: Takashi Iwai <tiwai@suse.de>
|
| 2 |
Date: Thu, 19 Mar 2009 09:01:47 +0000 (+0100)
|
| 3 |
Subject: ALSA: pcm - Reset invalid position even without debug option
|
| 4 |
X-Git-Url: http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff_plain;h=f28f43ce9ae6573952d2348bb6da859cad762143
|
| 5 |
|
| 6 |
ALSA: pcm - Reset invalid position even without debug option
|
| 7 |
|
| 8 |
Always reset the invalind hw_ptr position returned by the pointer
|
| 9 |
callback. The behavior should be consitent independently from the
|
| 10 |
debug option.
|
| 11 |
|
| 12 |
Also, add the printk_ratelimit() check to avoid flooding debug
|
| 13 |
prints.
|
| 14 |
|
| 15 |
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
| 16 |
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
| 17 |
---
|
| 18 |
|
| 19 |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
|
| 20 |
index 3026547..92ed6d8 100644
|
| 21 |
--- a/sound/core/pcm_lib.c
|
| 22 |
+++ b/sound/core/pcm_lib.c
|
| 23 |
@@ -159,11 +159,15 @@ snd_pcm_update_hw_ptr_pos(struct snd_pcm_substream *substream,
|
| 24 |
pos = substream->ops->pointer(substream);
|
| 25 |
if (pos == SNDRV_PCM_POS_XRUN)
|
| 26 |
return pos; /* XRUN */
|
| 27 |
-#ifdef CONFIG_SND_DEBUG
|
| 28 |
if (pos >= runtime->buffer_size) {
|
| 29 |
- snd_printk(KERN_ERR "BUG: stream = %i, pos = 0x%lx, buffer size = 0x%lx, period size = 0x%lx\n", substream->stream, pos, runtime->buffer_size, runtime->period_size);
|
| 30 |
+ if (printk_ratelimit()) {
|
| 31 |
+ snd_printd(KERN_ERR "BUG: stream = %i, pos = 0x%lx, "
|
| 32 |
+ "buffer size = 0x%lx, period size = 0x%lx\n",
|
| 33 |
+ substream->stream, pos, runtime->buffer_size,
|
| 34 |
+ runtime->period_size);
|
| 35 |
+ }
|
| 36 |
+ pos = 0;
|
| 37 |
}
|
| 38 |
-#endif
|
| 39 |
pos -= pos % runtime->min_align;
|
| 40 |
return pos;
|
| 41 |
}
|