diff options
author | Dave Airlie <airlied@linux.ie> | 2004-11-11 11:09:11 +0000 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2004-11-11 11:09:11 +0000 |
commit | f0a86288fa4d7b951f33f7b1a6ef36106c7df788 (patch) | |
tree | 8707efa038d18e563a4e2e415e5ba9c5249f5925 /linux-core/i810_dma.c | |
parent | 4b4df875b26bd08ae62f26b8ced6a050425752ac (diff) |
patch from bug 1803 - will try and push to kernel soon
Diffstat (limited to 'linux-core/i810_dma.c')
-rw-r--r-- | linux-core/i810_dma.c | 45 |
1 files changed, 9 insertions, 36 deletions
diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c index e98313523..ab33cb198 100644 --- a/linux-core/i810_dma.c +++ b/linux-core/i810_dma.c @@ -1008,10 +1008,7 @@ int i810_flush_ioctl(struct inode *inode, struct file *filp, drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->head->dev; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_flush_ioctl called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); i810_flush_queue(dev); return 0; @@ -1033,10 +1030,7 @@ int i810_dma_vertex(struct inode *inode, struct file *filp, (&vertex, (drm_i810_vertex_t __user *) arg, sizeof(vertex))) return -EFAULT; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_dma_vertex called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n", vertex.idx, vertex.used, vertex.discard); @@ -1067,10 +1061,7 @@ int i810_clear_bufs(struct inode *inode, struct file *filp, (&clear, (drm_i810_clear_t __user *) arg, sizeof(clear))) return -EFAULT; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_clear_bufs called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); /* GH: Someone's doing nasty things... */ if (!dev->dev_private) { @@ -1090,10 +1081,7 @@ int i810_swap_bufs(struct inode *inode, struct file *filp, DRM_DEBUG("i810_swap_bufs\n"); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_swap_buf called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); i810_dma_dispatch_swap(dev); return 0; @@ -1128,10 +1116,7 @@ int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, if (copy_from_user(&d, (drm_i810_dma_t __user *) arg, sizeof(d))) return -EFAULT; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_dma called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); d.granted = 0; @@ -1236,10 +1221,7 @@ int i810_dma_mc(struct inode *inode, struct file *filp, if (copy_from_user(&mc, (drm_i810_mc_t __user *) arg, sizeof(mc))) return -EFAULT; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_dma_mc called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); if (mc.idx >= dma->buf_count || mc.idx < 0) return -EINVAL; @@ -1288,10 +1270,7 @@ int i810_fstatus(struct inode *inode, struct file *filp, drm_device_t *dev = priv->head->dev; drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_fstatus called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); return I810_READ(0x30008); } @@ -1302,10 +1281,7 @@ int i810_ov0_flip(struct inode *inode, struct file *filp, drm_device_t *dev = priv->head->dev; drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_ov0_flip called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); //Tell the overlay to update I810_WRITE(0x30000, dev_priv->overlay_physical | 0x80000000); @@ -1345,10 +1321,7 @@ int i810_flip_bufs(struct inode *inode, struct file *filp, DRM_DEBUG("%s\n", __FUNCTION__); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("i810_flip_buf called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN(dev, filp); if (!dev_priv->page_flipping) i810_do_init_pageflip(dev); |