[PATCH] [UBUNTU:sound/core/] Fix timer correction/calculation
crimsun at fungus.sh.nu
crimsun at fungus.sh.nu
Tue Oct 10 08:01:59 UTC 2006
From 3b69de424e4f92e2ed045aea3ae13bf54a88a1b8 Mon Sep 17 00:00:00 2001
From: Daniel T. Chen <crimsun at garnish.localdomain>
Date: Tue, 10 Oct 2006 03:40:31 -0400
Subject: [PATCH] [UBUNTU:sound/core/] Fix timer correction/calculation
UpstreamStatus: Added in upstream alsa-kernel hg changesets:
da37d0e9b91f [http://hg-mirror.alsa-project.org/alsa-kernel?cmd=changeset;node=da37d0e9b91f9efd7b08023a76dd9d59f0a25e2b;style=raw]
1a61fd175bd0 [http://hg-mirror.alsa-project.org/alsa-kernel?cmd=changeset;node=1a61fd175bd060cd433f3eb892549527f8f299d6;style=raw]
1d3ba756c7f5 [http://hg-mirror.alsa-project.org/alsa-kernel?cmd=changeset;node=1d3ba756c7f5efc13883e430bb50fe39d072e2f5;style=raw]
bc57c976d87a [http://hg-mirror.alsa-project.org/alsa-kernel?cmd=changeset;node=bc57c976d87a33afdc884e04b7df78661146bf7e;style=raw]
These patches from Clemens Ladisch correct (accumulated) lost ticks,
adjusted value when the timer stops, and timer rescheduling.
This commit is applicable to both Dapper and Edgy linux-source.
Signed-off-by: Daniel T Chen <crimsun at ubuntu.com>
---
sound/core/timer.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 1e6613a..7ed2de0 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -717,7 +717,7 @@ void snd_timer_interrupt(snd_timer_t * t
}
}
if (timer->flags & SNDRV_TIMER_FLG_RESCHED)
- snd_timer_reschedule(timer, ticks_left);
+ snd_timer_reschedule(timer, timer->sticks);
if (timer->running) {
if (timer->hw.flags & SNDRV_TIMER_HW_STOP) {
timer->hw.stop(timer);
@@ -976,7 +976,7 @@ static void snd_timer_s_function(unsigne
struct snd_timer_system_private *priv = timer->private_data;
unsigned long jiff = jiffies;
if (time_after(jiff, priv->last_expires))
- priv->correction = (long)jiff - (long)priv->last_expires;
+ priv->correction += (long)jiff - (long)priv->last_expires;
snd_timer_interrupt(timer, (long)jiff - (long)priv->last_jiffies);
}
@@ -992,7 +992,7 @@ static int snd_timer_s_start(snd_timer_t
njiff++;
} else {
njiff += timer->sticks - priv->correction;
- priv->correction -= timer->sticks;
+ priv->correction = 0;
}
priv->last_expires = priv->tlist.expires = njiff;
add_timer(&priv->tlist);
@@ -1011,6 +1011,7 @@ static int snd_timer_s_stop(snd_timer_t
timer->sticks = priv->last_expires - jiff;
else
timer->sticks = 1;
+ priv->correction = 0;
return 0;
}
--
1.4.1
--
Daniel T. Chen crimsun at ubuntu.com
GPG key: 0xC88ABDA3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20061010/994071c2/attachment.sig>
More information about the kernel-team
mailing list