summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2013-04-26 09:17:22 +1000
committerBen Skeggs <bskeggs@redhat.com>2013-04-26 15:38:15 +1000
commit6d1d1cc97b8b24e9f7842de13f4b00393392c990 (patch)
tree0131b2513c29a79a86e971c1395ed23cf3e8b654 /drivers/gpu
parent10caad339c458df47e5a9e16e148087fcde98fec (diff)
downloadlinux-6d1d1cc97b8b24e9f7842de13f4b00393392c990.tar.gz
linux-6d1d1cc97b8b24e9f7842de13f4b00393392c990.tar.bz2
linux-6d1d1cc97b8b24e9f7842de13f4b00393392c990.zip
drm/nouveau/timer: allow alarms to be cancelled
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/timer/nv04.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/timer/nv04.c b/drivers/gpu/drm/nouveau/core/subdev/timer/nv04.c
index 8e1bae4f12e8..9469b8275675 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/timer/nv04.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/timer/nv04.c
@@ -96,11 +96,16 @@ nv04_timer_alarm(struct nouveau_timer *ptimer, u64 time,
/* append new alarm to list, in soonest-alarm-first order */
spin_lock_irqsave(&priv->lock, flags);
- list_for_each_entry(list, &priv->alarms, head) {
- if (list->timestamp > alarm->timestamp)
- break;
+ if (!time) {
+ if (!list_empty(&alarm->head))
+ list_del(&alarm->head);
+ } else {
+ list_for_each_entry(list, &priv->alarms, head) {
+ if (list->timestamp > alarm->timestamp)
+ break;
+ }
+ list_add_tail(&alarm->head, &list->head);
}
- list_add_tail(&alarm->head, &list->head);
spin_unlock_irqrestore(&priv->lock, flags);
/* process pending alarms */