summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/drm/drm_irq.c
diff options
context:
space:
mode:
authoroga <oga@openbsd.org>2008-06-19 00:51:27 +0000
committeroga <oga@openbsd.org>2008-06-19 00:51:27 +0000
commitc951e513924a302ca590d43497fbad6f288dcf9c (patch)
tree86a6ffb4aa0fbb8a715d6c4f38425266fd4b6705 /sys/dev/pci/drm/drm_irq.c
parentAttach amdmsr(4) at mainbus in a way that it can be disabled in UKC or the (diff)
downloadwireguard-openbsd-c951e513924a302ca590d43497fbad6f288dcf9c.tar.xz
wireguard-openbsd-c951e513924a302ca590d43497fbad6f288dcf9c.zip
Check the right refcount so that the vblank irq has a hope of being
disabled when wished.
Diffstat (limited to 'sys/dev/pci/drm/drm_irq.c')
-rw-r--r--sys/dev/pci/drm/drm_irq.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/pci/drm/drm_irq.c b/sys/dev/pci/drm/drm_irq.c
index 3f9b0ac4c71..99d2e2b7de8 100644
--- a/sys/dev/pci/drm/drm_irq.c
+++ b/sys/dev/pci/drm/drm_irq.c
@@ -421,10 +421,11 @@ drm_vblank_get(struct drm_device *dev, int crtc)
if (dev->vblank_refcount[crtc] == 1 &&
dev->vblank_enabled[crtc] == 0) {
ret = dev->driver.enable_vblank(dev, crtc);
- if (ret)
+ if (ret) {
atomic_dec(&dev->vblank_refcount[crtc]);
- else
+ } else {
dev->vblank_enabled[crtc] = 1;
+ }
}
DRM_SPINUNLOCK(&dev->vbl_lock);
@@ -437,7 +438,7 @@ drm_vblank_put(struct drm_device *dev, int crtc)
DRM_SPINLOCK(&dev->vbl_lock);
/* Last user schedules interrupt disable */
atomic_dec(&dev->vblank_refcount[crtc]);
- if (&dev->vblank_refcount[crtc] == 0)
+ if (dev->vblank_refcount[crtc] == 0)
timeout_add(&dev->vblank_disable_timer, 5*DRM_HZ);
DRM_SPINUNLOCK(&dev->vbl_lock);
}