summaryrefslogtreecommitdiff
path: root/bsd-core/drm_vm.c
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2005-08-26 00:16:01 +0000
committerEric Anholt <anholt@freebsd.org>2005-08-26 00:16:01 +0000
commit55bea952b326b88f2fa6502321f605f96ee9be66 (patch)
tree9de73f0fa9527d8e3954808e7cb30493f166d1ac /bsd-core/drm_vm.c
parent9942cad1f6078c24bb69a126795635b2f34d65b5 (diff)
[1] Fix BSD DRM for the nonroot changes. [2] Don't attempt to acquire the
DMA lock in a non-DMA driver, as it will be uninitialized. Submitted by: [1] jkim (minor changes by me)
Diffstat (limited to 'bsd-core/drm_vm.c')
-rw-r--r--bsd-core/drm_vm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bsd-core/drm_vm.c b/bsd-core/drm_vm.c
index 419b3cb1..05ac7b15 100644
--- a/bsd-core/drm_vm.c
+++ b/bsd-core/drm_vm.c
@@ -49,10 +49,11 @@ paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
if (!priv->authenticated)
return DRM_ERR(EACCES);
- DRM_SPINLOCK(&dev->dma_lock);
if (dev->dma && offset >= 0 && offset < ptoa(dev->dma->page_count)) {
drm_device_dma_t *dma = dev->dma;
+ DRM_SPINLOCK(&dev->dma_lock);
+
if (dma->pagelist != NULL) {
unsigned long page = offset >> PAGE_SHIFT;
unsigned long phys = dma->pagelist[page];
@@ -68,8 +69,8 @@ paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
DRM_SPINUNLOCK(&dev->dma_lock);
return -1;
}
+ DRM_SPINUNLOCK(&dev->dma_lock);
}
- DRM_SPINUNLOCK(&dev->dma_lock);
/* A sequential search of a linked list is
fine here because: 1) there will only be
@@ -89,7 +90,7 @@ paddr_t drm_mmap(dev_t kdev, off_t offset, int prot)
DRM_DEBUG("can't find map\n");
return -1;
}
- if (((map->flags&_DRM_RESTRICTED) && DRM_SUSER(DRM_CURPROC))) {
+ if (((map->flags&_DRM_RESTRICTED) && !DRM_SUSER(DRM_CURPROC))) {
DRM_UNLOCK();
DRM_DEBUG("restricted map\n");
return -1;