From: Takashi Iwai Subject: Re: [PATCH] cs4231-lib: improved waiting after mce_down Date: Mon, 10 Sep 2007 23:31:23 +0200 Message-ID: References: <20070909221131.06372eb2.krzysztof.h1@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (ns.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id BC978103894 for ; Mon, 10 Sep 2007 23:31:23 +0200 (CEST) In-Reply-To: <20070909221131.06372eb2.krzysztof.h1@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Krzysztof Helt Cc: Alsa-devel List-Id: alsa-devel@alsa-project.org 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