From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753225AbZHTGdV (ORCPT ); Thu, 20 Aug 2009 02:33:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752955AbZHTGdV (ORCPT ); Thu, 20 Aug 2009 02:33:21 -0400 Received: from cantor2.suse.de ([195.135.220.15]:43099 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752275AbZHTGdU (ORCPT ); Thu, 20 Aug 2009 02:33:20 -0400 Date: Thu, 20 Aug 2009 08:33:21 +0200 Message-ID: From: Takashi Iwai To: Bartlomiej Zolnierkiewicz Cc: Jack Byer , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ali5451: fix timeout handling in snd_ali_{codecs,timer}_ready() In-Reply-To: <200908192209.50994.bzolnier@gmail.com> References: <200908192209.50994.bzolnier@gmail.com> User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.7 Emacs/23.1 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Wed, 19 Aug 2009 22:09:50 +0200, Bartlomiej Zolnierkiewicz wrote: > > From: Bartlomiej Zolnierkiewicz > Subject: [PATCH] ali5451: fix timeout handling in snd_ali_{codecs,timer}_ready() > > Modify loops in such way that the register value is checked also after > the timeout condition, just in case the heavy interrupt load etc. caused > the thread to sleep for the time period exceeding the timeout value. > > While at it remove an extra ALI_STIMER read from snd_ali_stimer_ready(). > > Reported-by: Jack Byer > Signed-off-by: Bartlomiej Zolnierkiewicz > --- > sound/pci/ali5451/ali5451.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > Index: b/sound/pci/ali5451/ali5451.c > =================================================================== > --- a/sound/pci/ali5451/ali5451.c > +++ b/sound/pci/ali5451/ali5451.c > @@ -314,8 +314,11 @@ static int snd_ali_codec_ready(struct sn > res = snd_ali_5451_peek(codec,port); > if (!(res & 0x8000)) > return 0; > + if (!time_after_eq(end_time, jiffies)) > + break; > schedule_timeout_uninterruptible(1); > - } while (time_after_eq(end_time, jiffies)); > + } while (1); Using for (;;) is more generic. I see your patch keeps the changes minimal, but I'm afraid that the result, do {} while(1), can be misleading. Could you replace with for (;;) ? thanks, Takashi