From: Nishanth Aravamudan <nacc@us.ibm.com>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] Re: [Alsa-devel] [PATCH] sound/cs4231: replace
Date: Wed, 03 Nov 2004 18:03:15 +0000 [thread overview]
Message-ID: <20041103180315.GE2163@us.ibm.com> (raw)
In-Reply-To: <Pine.HPX.4.33n.0411031010440.25361-100000@studcom.urz.uni-halle.de>
[-- Attachment #1: Type: text/plain, Size: 3030 bytes --]
On Wed, Nov 03, 2004 at 10:31:42AM +0100, Clemens Ladisch wrote:
> Nishanth Aravamudan wrote:
> > + time = 250;
> > while (snd_cs4231_in(chip, CS4231_TEST_INIT) & CS4231_CALIB_IN_PROGRESS) {
> > spin_unlock_irqrestore(&chip->lock, flags);
> > if (time <= 0) {
> > snd_printk("mce_down - auto calibration time out (2)\n");
> > return;
> > }
> > - set_current_state(TASK_INTERRUPTIBLE);
> > - time = schedule_timeout(time);
> > + time = msleep_interruptible(time);
> > spin_lock_irqsave(&chip->lock, flags);
> > }
> >
> > Description: Uses msleep_interruptible() instead of schedule_timeout()
> > to guarantee the task delays as expected.
>
> The SPARC driver originated as a copy of the ISA driver and still has
> the problem that was fixed there, i.e., it uses a single 250 ms wait
> (which results in a delay of several seconds if OSS programs try to
> enumerate sample rates).
>
> Like the ISA driver, this driver should check the hardware status more
> often so that the wait can be aborted as soon as the calibration has
> finished.
>
> And this driver doesn't expect do receive signals; using msleep()
> would be just fine.
These changes have been made in the following patch. Does it look better
now?
-Nish
Description: Uses msleep_interruptible() instead of schedule_timeout()
to guarantee the task delays as expected. Changes the type of time to
match the return value of msleep_interruptible().
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
--- 2.6.10-rc1-vanilla/sound/sparc/cs4231.c 2004-10-30 15:34:20.000000000 -0700
+++ 2.6.10-rc1/sound/sparc/cs4231.c 2004-11-03 10:01:47.000000000 -0800
@@ -560,7 +560,6 @@ static void snd_cs4231_mce_down(cs4231_t
{
unsigned long flags;
int timeout;
- signed long time;
spin_lock_irqsave(&chip->lock, flags);
snd_cs4231_busy_wait(chip);
@@ -594,29 +593,29 @@ static void snd_cs4231_mce_down(cs4231_t
#if 0
printk("(2) timeout = %i, jiffies = %li\n", timeout, jiffies);
#endif
- time = HZ / 4;
+ /* in 10ms increments, check condition, up to 250ms */
+ timeout = 25;
while (snd_cs4231_in(chip, CS4231_TEST_INIT) & CS4231_CALIB_IN_PROGRESS) {
spin_unlock_irqrestore(&chip->lock, flags);
- if (time <= 0) {
+ if (--timeout < 0) {
snd_printk("mce_down - auto calibration time out (2)\n");
return;
}
- set_current_state(TASK_INTERRUPTIBLE);
- time = schedule_timeout(time);
+ msleep(10);
spin_lock_irqsave(&chip->lock, flags);
}
#if 0
printk("(3) jiffies = %li\n", jiffies);
#endif
- time = HZ / 10;
+ /* in 10ms increments, check condition, up to 100ms */
+ timeout = 10;
while (__cs4231_readb(chip, CS4231P(chip, REGSEL)) & CS4231_INIT) {
spin_unlock_irqrestore(&chip->lock, flags);
- if (time <= 0) {
+ if (--timeout < 0) {
snd_printk("mce_down - auto calibration time out (3)\n");
return;
}
- set_current_state(TASK_INTERRUPTIBLE);
- time = schedule_timeout(time);
+ msleep(10);
spin_lock_irqsave(&chip->lock, flags);
}
spin_unlock_irqrestore(&chip->lock, flags);
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2004-11-03 18:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-02 19:29 [KJ] [PATCH] sound/cs4231_lib: replace schedule_timeout() with Nishanth Aravamudan
2004-11-03 9:22 ` [KJ] Re: [Alsa-devel] [PATCH] sound/cs4231_lib: replace Clemens Ladisch
2004-11-03 9:31 ` [KJ] Re: [Alsa-devel] [PATCH] sound/cs4231: replace Clemens Ladisch
2004-11-03 18:03 ` [PATCH] sound/cs4231: replace schedule_timeout() with msleep_interruptible() Nishanth Aravamudan
2004-11-03 17:56 ` [PATCH] sound/cs4231_lib: replace schedule_timeout() with msleep() Nishanth Aravamudan
2004-11-03 17:56 ` [KJ] Re: [Alsa-devel] [PATCH] sound/cs4231_lib: replace Nishanth Aravamudan
2004-11-03 18:03 ` Nishanth Aravamudan [this message]
2004-11-04 7:58 ` [PATCH] sound/cs4231: replace schedule_timeout() with msleep_interruptible() Clemens Ladisch
2004-11-04 7:58 ` [KJ] Re: [Alsa-devel] [PATCH] sound/cs4231: replace Clemens Ladisch
2004-11-03 9:22 ` [PATCH] sound/cs4231_lib: replace schedule_timeout() with msleep() Clemens Ladisch
-- strict thread matches above, loose matches on Subject: below --
2004-11-02 19:40 [KJ] [PATCH] sound/cs4231: replace schedule_timeout() with Nishanth Aravamudan
2004-11-03 9:31 ` [PATCH] sound/cs4231: replace schedule_timeout() with msleep_interruptible() Clemens Ladisch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041103180315.GE2163@us.ibm.com \
--to=nacc@us.ibm.com \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.