[alsa-devel] [PATCH] cs4231-lib: improved waiting after mce_down

Takashi Iwai tiwai at suse.de
Mon Sep 10 23:31:23 CEST 2007


At Sun, 9 Sep 2007 22:11:31 +0200,
Krzysztof Helt wrote:
> 
> -	/* in 10 ms increments, check condition, up to 250 ms */
> -	timeout = 25;
> +	time = HZ / 4;

Use msecs_to_jiffies(250) instead.

>  	while (snd_cs4231_in(chip, CS4231_TEST_INIT) & CS4231_CALIB_IN_PROGRESS) {
> -		if (--timeout < 0) {
> -			snd_printk("mce_down - auto calibration time out (2)\n");
> +		spin_unlock_irqrestore(&chip->reg_lock, flags);
> +		if (time <= 0) {
> +			snd_printk(KERN_ERR "mce_down - "
> +				   "auto calibration time out (2)\n");
>  			return;
>  		}
> -		msleep(10);
> +		time = schedule_timeout(time);
> +		spin_lock_irqsave(&chip->reg_lock, flags);
>  	}
> -#if 0
> -	printk("(3) jiffies = %li\n", jiffies);
> -#endif
> -	/* in 10 ms increments, check condition, up to 100 ms */
> -	timeout = 10;
> +
> +	snd_printd("(3) jiffies = %li\n", jiffies);
> +
> +	time = HZ / 10;

Here, too.


thanks,

Takashi


More information about the Alsa-devel mailing list