Re: drivers/sound/i810_audio.c bug and patch

From: Mike Fedyk
Date: Wed Sep 03 2003 - 20:47:14 EST


On Thu, Sep 04, 2003 at 01:31:40AM +0200, Mehmet Ceyran wrote:
> I found out that the driver gives the sound chip 10 chances to become
> ready and my sound chip fails to do that in time. The following patch
> gives the chip 100 tries instead of 10:
>
> ---8<---
> --- i810_audio.c 2003-09-02 13:58:02.000000000 +0200
> +++ i810_audio.c.new 2003-09-02 13:58:12.000000000 +0200
> @@ -2727,7 +2727,7 @@
> i810_ac97_get(codec, AC97_POWER_CONTROL) &
> ~0x7f00);
>
> /* wait for analog ready */
> - for (i=10; i && ((i810_ac97_get(codec, AC97_POWER_CONTROL) &
> 0xf) != 0xf); i--)
> + for (i=100; i && ((i810_ac97_get(codec, AC97_POWER_CONTROL) &
> 0xf) != 0xf); i--)
> {
> set_current_state(TASK_UNINTERRUPTIBLE);
> schedule_timeout(HZ/20);
> --->8---
>
> Well, why not? The loop will only go through it's body 100 times if the
> hardware is actually not available or corrupt and even in this case the
> whole block won't take much time. It works for me and it should work for
> all the other people using this driver too:

Why busy wait especially when you can sleep 1ms each time and poll less?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/