Commit d99ca6ca authored by Linus Torvalds's avatar Linus Torvalds

DRI CVS merge: whitespace cleanups for i810_dma.c

parent bd4b19c1
...@@ -83,7 +83,7 @@ static drm_buf_t *i810_freelist_get(drm_device_t *dev) ...@@ -83,7 +83,7 @@ static drm_buf_t *i810_freelist_get(drm_device_t *dev)
/* In use is already a pointer */ /* In use is already a pointer */
used = cmpxchg(buf_priv->in_use, I810_BUF_FREE, used = cmpxchg(buf_priv->in_use, I810_BUF_FREE,
I810_BUF_CLIENT); I810_BUF_CLIENT);
if(used == I810_BUF_FREE) { if (used == I810_BUF_FREE) {
return buf; return buf;
} }
} }
...@@ -101,7 +101,7 @@ static int i810_freelist_put(drm_device_t *dev, drm_buf_t *buf) ...@@ -101,7 +101,7 @@ static int i810_freelist_put(drm_device_t *dev, drm_buf_t *buf)
/* In use is already a pointer */ /* In use is already a pointer */
used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_FREE); used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_FREE);
if(used != I810_BUF_CLIENT) { if (used != I810_BUF_CLIENT) {
DRM_ERROR("Freeing buffer thats not in use : %d\n", buf->idx); DRM_ERROR("Freeing buffer thats not in use : %d\n", buf->idx);
return -EINVAL; return -EINVAL;
} }
...@@ -154,7 +154,8 @@ static int i810_map_buffer(drm_buf_t *buf, struct file *filp) ...@@ -154,7 +154,8 @@ static int i810_map_buffer(drm_buf_t *buf, struct file *filp)
struct file_operations *old_fops; struct file_operations *old_fops;
int retcode = 0; int retcode = 0;
if(buf_priv->currently_mapped == I810_BUF_MAPPED) return -EINVAL; if (buf_priv->currently_mapped == I810_BUF_MAPPED)
return -EINVAL;
down_write( &current->mm->mmap_sem ); down_write( &current->mm->mmap_sem );
old_fops = filp->f_op; old_fops = filp->f_op;
...@@ -182,7 +183,7 @@ static int i810_unmap_buffer(drm_buf_t *buf) ...@@ -182,7 +183,7 @@ static int i810_unmap_buffer(drm_buf_t *buf)
drm_i810_buf_priv_t *buf_priv = buf->dev_private; drm_i810_buf_priv_t *buf_priv = buf->dev_private;
int retcode = 0; int retcode = 0;
if(buf_priv->currently_mapped != I810_BUF_MAPPED) if (buf_priv->currently_mapped != I810_BUF_MAPPED)
return -EINVAL; return -EINVAL;
down_write(&current->mm->mmap_sem); down_write(&current->mm->mmap_sem);
...@@ -212,7 +213,7 @@ static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d, ...@@ -212,7 +213,7 @@ static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d,
} }
retcode = i810_map_buffer(buf, filp); retcode = i810_map_buffer(buf, filp);
if(retcode) { if (retcode) {
i810_freelist_put(dev, buf); i810_freelist_put(dev, buf);
DRM_ERROR("mapbuf failed, retcode %d\n", retcode); DRM_ERROR("mapbuf failed, retcode %d\n", retcode);
return retcode; return retcode;
...@@ -244,7 +245,7 @@ int i810_dma_cleanup(drm_device_t *dev) ...@@ -244,7 +245,7 @@ int i810_dma_cleanup(drm_device_t *dev)
drm_i810_private_t *dev_priv = drm_i810_private_t *dev_priv =
(drm_i810_private_t *) dev->dev_private; (drm_i810_private_t *) dev->dev_private;
if(dev_priv->ring.virtual_start) { if (dev_priv->ring.virtual_start) {
DRM(ioremapfree)((void *) dev_priv->ring.virtual_start, DRM(ioremapfree)((void *) dev_priv->ring.virtual_start,
dev_priv->ring.Size, dev); dev_priv->ring.Size, dev);
} }
...@@ -289,7 +290,7 @@ static int i810_wait_ring(drm_device_t *dev, int n) ...@@ -289,7 +290,7 @@ static int i810_wait_ring(drm_device_t *dev, int n)
} }
iters++; iters++;
if(time_before(end, jiffies)) { if (time_before(end, jiffies)) {
DRM_ERROR("space: %d wanted %d\n", ring->space, n); DRM_ERROR("space: %d wanted %d\n", ring->space, n);
DRM_ERROR("lockup\n"); DRM_ERROR("lockup\n");
goto out_wait_ring; goto out_wait_ring;
...@@ -319,7 +320,7 @@ static int i810_freelist_init(drm_device_t *dev, drm_i810_private_t *dev_priv) ...@@ -319,7 +320,7 @@ static int i810_freelist_init(drm_device_t *dev, drm_i810_private_t *dev_priv)
u32 *hw_status = (u32 *)(dev_priv->hw_status_page + my_idx); u32 *hw_status = (u32 *)(dev_priv->hw_status_page + my_idx);
int i; int i;
if(dma->buf_count > 1019) { if (dma->buf_count > 1019) {
/* Not enough space in the status page for the freelist */ /* Not enough space in the status page for the freelist */
return -EINVAL; return -EINVAL;
} }
...@@ -350,28 +351,28 @@ static int i810_dma_initialize(drm_device_t *dev, ...@@ -350,28 +351,28 @@ static int i810_dma_initialize(drm_device_t *dev,
list_for_each(list, &dev->maplist->head) { list_for_each(list, &dev->maplist->head) {
drm_map_list_t *r_list = list_entry(list, drm_map_list_t, head); drm_map_list_t *r_list = list_entry(list, drm_map_list_t, head);
if( r_list->map && if (r_list->map &&
r_list->map->type == _DRM_SHM && r_list->map->type == _DRM_SHM &&
r_list->map->flags & _DRM_CONTAINS_LOCK ) { r_list->map->flags & _DRM_CONTAINS_LOCK ) {
dev_priv->sarea_map = r_list->map; dev_priv->sarea_map = r_list->map;
break; break;
} }
} }
if(!dev_priv->sarea_map) { if (!dev_priv->sarea_map) {
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
i810_dma_cleanup(dev); i810_dma_cleanup(dev);
DRM_ERROR("can not find sarea!\n"); DRM_ERROR("can not find sarea!\n");
return -EINVAL; return -EINVAL;
} }
DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset ); DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset );
if(!dev_priv->mmio_map) { if (!dev_priv->mmio_map) {
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
i810_dma_cleanup(dev); i810_dma_cleanup(dev);
DRM_ERROR("can not find mmio map!\n"); DRM_ERROR("can not find mmio map!\n");
return -EINVAL; return -EINVAL;
} }
DRM_FIND_MAP( dev_priv->buffer_map, init->buffers_offset ); DRM_FIND_MAP( dev_priv->buffer_map, init->buffers_offset );
if(!dev_priv->buffer_map) { if (!dev_priv->buffer_map) {
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
i810_dma_cleanup(dev); i810_dma_cleanup(dev);
DRM_ERROR("can not find dma buffer map!\n"); DRM_ERROR("can not find dma buffer map!\n");
...@@ -431,7 +432,7 @@ static int i810_dma_initialize(drm_device_t *dev, ...@@ -431,7 +432,7 @@ static int i810_dma_initialize(drm_device_t *dev,
DRM_DEBUG("Enabled hardware status page\n"); DRM_DEBUG("Enabled hardware status page\n");
/* Now we need to init our freelist */ /* Now we need to init our freelist */
if(i810_freelist_init(dev, dev_priv) != 0) { if (i810_freelist_init(dev, dev_priv) != 0) {
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
i810_dma_cleanup(dev); i810_dma_cleanup(dev);
DRM_ERROR("Not enough space in the status page for" DRM_ERROR("Not enough space in the status page for"
...@@ -467,8 +468,8 @@ int i810_dma_init_compat(drm_i810_init_t *init, unsigned long arg) ...@@ -467,8 +468,8 @@ int i810_dma_init_compat(drm_i810_init_t *init, unsigned long arg)
/* This is a v1.2 client, just get the v1.2 init data */ /* This is a v1.2 client, just get the v1.2 init data */
DRM_INFO("Using POST v1.2 init.\n"); DRM_INFO("Using POST v1.2 init.\n");
if(copy_from_user(init, (drm_i810_init_t *)arg, if (copy_from_user(init, (drm_i810_init_t *)arg,
sizeof(drm_i810_init_t))) { sizeof(drm_i810_init_t))) {
return -EFAULT; return -EFAULT;
} }
} else { } else {
...@@ -496,7 +497,7 @@ int i810_dma_init(struct inode *inode, struct file *filp, ...@@ -496,7 +497,7 @@ int i810_dma_init(struct inode *inode, struct file *filp,
int retcode = 0; int retcode = 0;
/* Get only the init func */ /* Get only the init func */
if (copy_from_user(&init, (void *)arg, sizeof(drm_i810_init_func_t))) if (copy_from_user(&init, (void *)arg, sizeof(drm_i810_init_func_t)))
return -EFAULT; return -EFAULT;
switch(init.func) { switch(init.func) {
...@@ -513,9 +514,9 @@ int i810_dma_init(struct inode *inode, struct file *filp, ...@@ -513,9 +514,9 @@ int i810_dma_init(struct inode *inode, struct file *filp,
dev_priv = DRM(alloc)(sizeof(drm_i810_private_t), dev_priv = DRM(alloc)(sizeof(drm_i810_private_t),
DRM_MEM_DRIVER); DRM_MEM_DRIVER);
if (dev_priv == NULL) if (dev_priv == NULL)
return -ENOMEM; return -ENOMEM;
retcode = i810_dma_initialize(dev, dev_priv, &init); retcode = i810_dma_initialize(dev, dev_priv, &init);
break; break;
default: default:
case I810_INIT_DMA_1_4: case I810_INIT_DMA_1_4:
...@@ -526,15 +527,15 @@ int i810_dma_init(struct inode *inode, struct file *filp, ...@@ -526,15 +527,15 @@ int i810_dma_init(struct inode *inode, struct file *filp,
} }
dev_priv = DRM(alloc)(sizeof(drm_i810_private_t), dev_priv = DRM(alloc)(sizeof(drm_i810_private_t),
DRM_MEM_DRIVER); DRM_MEM_DRIVER);
if (dev_priv == NULL) if (dev_priv == NULL)
return -ENOMEM; return -ENOMEM;
retcode = i810_dma_initialize(dev, dev_priv, &init); retcode = i810_dma_initialize(dev, dev_priv, &init);
break; break;
case I810_CLEANUP_DMA: case I810_CLEANUP_DMA:
DRM_INFO("DMA Cleanup\n"); DRM_INFO("DMA Cleanup\n");
retcode = i810_dma_cleanup(dev); retcode = i810_dma_cleanup(dev);
break; break;
} }
return retcode; return retcode;
...@@ -1019,7 +1020,7 @@ void i810_reclaim_buffers(struct file *filp) ...@@ -1019,7 +1020,7 @@ void i810_reclaim_buffers(struct file *filp)
if (used == I810_BUF_CLIENT) if (used == I810_BUF_CLIENT)
DRM_DEBUG("reclaimed from client\n"); DRM_DEBUG("reclaimed from client\n");
if(buf_priv->currently_mapped == I810_BUF_MAPPED) if (buf_priv->currently_mapped == I810_BUF_MAPPED)
buf_priv->currently_mapped = I810_BUF_UNMAPPED; buf_priv->currently_mapped = I810_BUF_UNMAPPED;
} }
} }
...@@ -1031,7 +1032,7 @@ int i810_flush_ioctl(struct inode *inode, struct file *filp, ...@@ -1031,7 +1032,7 @@ int i810_flush_ioctl(struct inode *inode, struct file *filp,
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->dev;
if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i810_flush_ioctl called without lock held\n"); DRM_ERROR("i810_flush_ioctl called without lock held\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1056,7 +1057,7 @@ int i810_dma_vertex(struct inode *inode, struct file *filp, ...@@ -1056,7 +1057,7 @@ int i810_dma_vertex(struct inode *inode, struct file *filp,
if (copy_from_user(&vertex, (drm_i810_vertex_t *)arg, sizeof(vertex))) if (copy_from_user(&vertex, (drm_i810_vertex_t *)arg, sizeof(vertex)))
return -EFAULT; return -EFAULT;
if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i810_dma_vertex called without lock held\n"); DRM_ERROR("i810_dma_vertex called without lock held\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1064,7 +1065,8 @@ int i810_dma_vertex(struct inode *inode, struct file *filp, ...@@ -1064,7 +1065,8 @@ int i810_dma_vertex(struct inode *inode, struct file *filp,
DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n", DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n",
vertex.idx, vertex.used, vertex.discard); vertex.idx, vertex.used, vertex.discard);
if(vertex.idx < 0 || vertex.idx > dma->buf_count) return -EINVAL; if (vertex.idx < 0 || vertex.idx > dma->buf_count)
return -EINVAL;
i810_dma_dispatch_vertex( dev, i810_dma_dispatch_vertex( dev,
dma->buflist[ vertex.idx ], dma->buflist[ vertex.idx ],
...@@ -1090,7 +1092,7 @@ int i810_clear_bufs(struct inode *inode, struct file *filp, ...@@ -1090,7 +1092,7 @@ int i810_clear_bufs(struct inode *inode, struct file *filp,
if (copy_from_user(&clear, (drm_i810_clear_t *)arg, sizeof(clear))) if (copy_from_user(&clear, (drm_i810_clear_t *)arg, sizeof(clear)))
return -EFAULT; return -EFAULT;
if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i810_clear_bufs called without lock held\n"); DRM_ERROR("i810_clear_bufs called without lock held\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1114,7 +1116,7 @@ int i810_swap_bufs(struct inode *inode, struct file *filp, ...@@ -1114,7 +1116,7 @@ int i810_swap_bufs(struct inode *inode, struct file *filp,
DRM_DEBUG("i810_swap_bufs\n"); DRM_DEBUG("i810_swap_bufs\n");
if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i810_swap_buf called without lock held\n"); DRM_ERROR("i810_swap_buf called without lock held\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1152,7 +1154,7 @@ int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -1152,7 +1154,7 @@ int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
if (copy_from_user(&d, (drm_i810_dma_t *)arg, sizeof(d))) if (copy_from_user(&d, (drm_i810_dma_t *)arg, sizeof(d)))
return -EFAULT; return -EFAULT;
if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i810_dma called without lock held\n"); DRM_ERROR("i810_dma called without lock held\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1202,7 +1204,7 @@ static void i810_dma_dispatch_mc(drm_device_t *dev, drm_buf_t *buf, int used, ...@@ -1202,7 +1204,7 @@ static void i810_dma_dispatch_mc(drm_device_t *dev, drm_buf_t *buf, int used,
u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT,
I810_BUF_HARDWARE); I810_BUF_HARDWARE);
if(u != I810_BUF_CLIENT) { if (u != I810_BUF_CLIENT) {
DRM_DEBUG("MC found buffer that isn't mine!\n"); DRM_DEBUG("MC found buffer that isn't mine!\n");
} }
...@@ -1266,7 +1268,7 @@ int i810_dma_mc(struct inode *inode, struct file *filp, ...@@ -1266,7 +1268,7 @@ int i810_dma_mc(struct inode *inode, struct file *filp,
return -EFAULT; return -EFAULT;
if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i810_dma_mc called without lock held\n"); DRM_ERROR("i810_dma_mc called without lock held\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1314,7 +1316,7 @@ int i810_fstatus(struct inode *inode, struct file *filp, ...@@ -1314,7 +1316,7 @@ int i810_fstatus(struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->dev;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i810_fstatus called without lock held\n"); DRM_ERROR("i810_fstatus called without lock held\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1328,7 +1330,7 @@ int i810_ov0_flip(struct inode *inode, struct file *filp, ...@@ -1328,7 +1330,7 @@ int i810_ov0_flip(struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->dev;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i810_ov0_flip called without lock held\n"); DRM_ERROR("i810_ov0_flip called without lock held\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1373,7 +1375,7 @@ int i810_flip_bufs(struct inode *inode, struct file *filp, ...@@ -1373,7 +1375,7 @@ int i810_flip_bufs(struct inode *inode, struct file *filp,
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("%s\n", __FUNCTION__);
if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i810_flip_buf called without lock held\n"); DRM_ERROR("i810_flip_buf called without lock held\n");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment