All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ad1848_lib: waiting loops done after cs4231_lib
@ 2007-09-13 13:11 Krzysztof Helt
  2007-09-13 17:37 ` Rene Herman
  2007-09-17 10:54 ` Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Krzysztof Helt @ 2007-09-13 13:11 UTC (permalink / raw)
  To: ALSA devel

[-- Attachment #1: Type: text/plain, Size: 179 bytes --]

From: Krzysztof Helt <krzysztof.h1@wp.pl>

This patch fixes ad1848_lib waiting loops to be the same as in the cs4231_lib.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>

---

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ad1848-sync.diff --]
[-- Type: text/x-patch; name="ad1848-sync.diff", Size: 1620 bytes --]

diff -urp alsa-driver-1.0.15rc2/sound/isa/ad1848/ad1848_lib.c alsa-driver.new/sound/isa/ad1848/ad1848_lib.c
--- alsa-driver-1.0.15rc2/sound/isa/ad1848/ad1848_lib.c	2007-09-12 13:33:51.000000000 +0200
+++ alsa-driver.new/sound/isa/ad1848/ad1848_lib.c	2007-09-13 14:41:44.000000000 +0200
@@ -205,7 +205,7 @@ static void snd_ad1848_mce_down(struct s
 {
 	unsigned long flags;
 	int timeout;
-	signed long time;
+	unsigned long end_time;
 
 	spin_lock_irqsave(&chip->reg_lock, flags);
 	for (timeout = 5; timeout > 0; timeout--)
@@ -240,27 +240,27 @@ static void snd_ad1848_mce_down(struct s
 
 	snd_printdd("(2) jiffies = %lu\n", jiffies);
 
-	time = msecs_to_jiffies(250);
+	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 <= 0) {
+		if (time_after(jiffies, end_time)) {
 			snd_printk(KERN_ERR "mce_down - auto calibration time out (2)\n");
 			return;
 		}
-		time = schedule_timeout(time);
+		msleep(1);
 		spin_lock_irqsave(&chip->reg_lock, flags);
 	}
 
 	snd_printdd("(3) jiffies = %lu\n", jiffies);
 
-	time = msecs_to_jiffies(100);
+	end_time = jiffies + msecs_to_jiffies(100);
 	while (inb(AD1848P(chip, REGSEL)) & AD1848_INIT) {
 		spin_unlock_irqrestore(&chip->reg_lock, flags);
-		if (time <= 0) {
+		if (time_after(jiffies, end_time)) {
 			snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n");
 			return;
 		}
-		time = schedule_timeout(time);
+		msleep(1);
 		spin_lock_irqsave(&chip->reg_lock, flags);
 	}
 	spin_unlock_irqrestore(&chip->reg_lock, flags);

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-09-17 10:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-13 13:11 [PATCH] ad1848_lib: waiting loops done after cs4231_lib Krzysztof Helt
2007-09-13 17:37 ` Rene Herman
2007-09-17 10:54 ` Takashi Iwai

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.