Re: + cleanup-for-cs5535-audio-driver.patch added to -mm tree

From: Alexey Dobriyan
Date: Wed Sep 21 2005 - 10:24:45 EST


On Wed, Sep 21, 2005 at 03:20:55AM -0700, akpm@xxxxxxxx wrote:
> Cleanup for CS5535 audio driver

> --- devel/sound/pci/cs5535audio/cs5535audio.c
> +++ devel-akpm/sound/pci/cs5535audio/cs5535audio.c

> +static void wait_till_cmd_acked(cs5535audio_t *cs5535au, unsigned long timeout)
> +{
> + unsigned long tmp;
> + do {
> + tmp = cs_readl(cs5535au, ACC_CODEC_CNTL);
> + if (!(tmp & CMD_NEW))
> + break;
> + msleep(10);
> + } while (--timeout);
> + if (!timeout)
> + snd_printk(KERN_ERR "Failure writing to cs5535 codec\n");
> +}

Looks wrong. Should be something like

unsigned long end_jiffies = jiffies + timeout;

while (1) {
if (!(cs_readl(cs5535au, ACC_CODEC_CNTL) & CMD_NEW))
break;
if (time_after(end_jiffies, jiffies))
break;
msleep(10);
}
and printk somewhere

-
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/