From: Rene Herman <rene.herman@gmail.com>
To: ALSA devel <alsa-devel@alsa-project.org>
Cc: Takashi Iwai <tiwai@suse.de>,
Krzysztof Helt <krzysztof.h1@gmail.com>,
Trent Piepho <xyzzy@speakeasy.org>
Subject: Current ad1848/cs4231 mce_down code
Date: Tue, 18 Sep 2007 02:53:28 +0200 [thread overview]
Message-ID: <46EF2188.60704@gmail.com> (raw)
By the way, while looking at the current mce_down code:
http://hg.alsa-project.org/alsa-kernel/file/0028e39ead78/isa/ad1848/ad1848_lib.c
http://hg.alsa-project.org/alsa-kernel/file/0028e39ead78/isa/cs423x/cs4231_lib.c
we have the ad1848 loops doing:
end_time = jiffies + msecs_to_jiffies(250);
while (snd_ad1848_in(chip, AD1848_TEST_INIT) & AD1848_CALIB_IN_PROGRESS) {
spin_unlock_irqrestore(&chip->reg_lock, flags);
(---)
if (time_after(jiffies, end_time)) {
snd_printk(KERN_ERR " [ timeout ] ")
return;
}
msleep(1);
spin_lock_irqsave(&chip->reg_lock, flags);
}
At (---) we are no longer atomic, so imagine being pre-empted there. When we
get back, we may/will well be past end_time and although by now calibration
has long finished, we bail out believing we've timed out.
Should it rather be this (probably with a "goto eror" type of setup, but as
far as the logic is concerned)?
end_time = jiffies + msecs_to_jiffies(250);
while (snd_ad1848_in(chip, AD1848_TEST_INIT) & AD1848_CALIB_IN_PROGRESS) {
if (time_after(jiffies, end_time)) {
spin_unlock_irqrestore(&chip->reg_lock, flags);
snd_printk(KERN_ERR " [ timeout ] ")
return;
}
spin_unlock_irqrestore(&chip->reg_lock, flags);
msleep(1);
spin_lock_irqsave(&chip->reg_lock, flags);
}
Moreover, we aren't under lock at all in the cs4231 version (which also
means that msleep(1) thing is in fact fine there). Can't we do that for
ad1848 as well?
(but as said, minimal fix for now is the msleep(1) under lock fix in ad1848)
Rene.
next reply other threads:[~2007-09-18 0:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-18 0:53 Rene Herman [this message]
2007-09-18 7:28 ` Current ad1848/cs4231 mce_down code Krzysztof Helt
2007-09-18 7:33 ` Rene Herman
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=46EF2188.60704@gmail.com \
--to=rene.herman@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=krzysztof.h1@gmail.com \
--cc=tiwai@suse.de \
--cc=xyzzy@speakeasy.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.