[patch] snd-pcsp: silent misleading warning

From: Stas Sergeev
Date: Sat May 17 2008 - 11:51:43 EST


Hello.

Roberto Oppedisano wrote:
> I noticed that when I run
> aplay -D plughw:2,0 /usr/share/sounds/KDE_Logout.wav
> I get a flood of:
> [ 417.338143] PCSP: playback_ptr inconsistent (4642 4661 18645)
It turns out that the buffer size you
get, is not evenly devided by period size.
18645 % 4661 = 1.
That (wrongly) triggers the warning.
This may very well be an alsa bug, or
may not, but the code in the driver is
handling that properly, so there is no
need for such a verbose warning.

The attached patch shuts down the warning.
Takashi, could you please apply?
# HG changeset patch
# User Stas Sergeev <stsp@xxxxxxxxxxxxxxxxxxxxx>
# Date 1211038849 -14400
# Node ID 2278b9a6058f5b45081f8227902df585474a81a6
# Parent 49d310de8ac42e5c495cf39440f4fde307b39c75
It appears that alsa allows a sound buffer with size not
evenly devided by the period size. This triggers a warning in
snd-pcsp and floods the log. As a quick fix, the warning should
be disabled.

Signed-off-by: Stas Sergeev <stsp@xxxxxxxx>

diff -r 49d310de8ac4 -r 2278b9a6058f drivers/pcsp/pcsp_lib.c
--- a/drivers/pcsp/pcsp_lib.c Sat May 17 02:04:12 2008 +0400
+++ b/drivers/pcsp/pcsp_lib.c Sat May 17 19:40:49 2008 +0400
@@ -119,9 +119,11 @@ enum hrtimer_restart pcsp_do_timer(struc
chip->playback_ptr += PCSP_INDEX_INC() * fmt_size;
periods_elapsed = chip->playback_ptr - chip->period_ptr;
if (periods_elapsed < 0) {
- printk(KERN_WARNING "PCSP: playback_ptr inconsistent "
+#if PCSP_DEBUG
+ printk(KERN_INFO "PCSP: buffer_bytes mod period_bytes != 0 ? "
"(%zi %zi %zi)\n",
chip->playback_ptr, period_bytes, buffer_bytes);
+#endif
periods_elapsed += buffer_bytes;
}
periods_elapsed /= period_bytes;