Re: Questionable code in sys/dev/sound/pcm/channel.c

From: Conrad J. Sabatier <conrads_at_cox.net>
Date: Mon, 26 Jul 2004 16:47:09 -0500 (CDT)
On 26-Jul-2004 Conrad J. Sabatier wrote:
> I'm a little perplexed at the following bit of logic in chn_write()
> (which is where the "interrupt timeout, channel dead" messages are
> being generated).
> 
> Within an else branch within the main while loop, we have:
> 
>             else {
>                 timeout = (hz * sndbuf_getblksz(bs)) /
> (sndbuf_getspd(bs) * sndbuf_getbps(bs));
>                 if (timeout < 1)
>                     timeout = 1;
>                 timeout = 1;
> 
> Why the formulaic calculation of timeout, if it's simply going to be
> unconditionally set to 1 immediately afterwards anyway?  What's going
> on here?
> 
> Also, at the end of the function:
> 
>     if (count <= 0) {
>         c->flags |= CHN_F_DEAD;
>         printf("%s: play interrupt timeout, channel dead\n",
> c->name);
>     }
> 
>     return ret;
> }
> 
> Could it be that the conditional test is wrong here?  Perhaps
> we should be using (count < 0) instead?

I'm now running a kernel built with this last conditional test changed
to "if (count < 0)" and sound is still working OK.  Have yet to see if
this eliminates the interrupt timeout messages.  Perhaps a few other
people might try it and see?

I still don't know what to make of the earlier business with the
setting of "timeout".  Looks to me like something that just got
overlooked in the course of a series of edits.

-- 
Conrad J. Sabatier <conrads_at_cox.net> -- "In Unix veritas"
Received on Mon Jul 26 2004 - 19:47:10 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:03 UTC