aboutsummaryrefslogtreecommitdiff
path: root/linux-core/i830_dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core/i830_dma.c')
-rw-r--r--linux-core/i830_dma.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/linux-core/i830_dma.c b/linux-core/i830_dma.c
index 8cd76cf4..519007f9 100644
--- a/linux-core/i830_dma.c
+++ b/linux-core/i830_dma.c
@@ -160,6 +160,7 @@ static int i830_map_buffer(drm_buf_t *buf, struct file *filp)
drm_i830_buf_priv_t *buf_priv = buf->dev_private;
drm_i830_private_t *dev_priv = dev->dev_private;
struct file_operations *old_fops;
+ unsigned long virtual;
int retcode = 0;
if(buf_priv->currently_mapped == I830_BUF_MAPPED) return -EINVAL;
@@ -168,17 +169,17 @@ static int i830_map_buffer(drm_buf_t *buf, struct file *filp)
old_fops = filp->f_op;
filp->f_op = &i830_buffer_fops;
dev_priv->mmap_buffer = buf;
- buf_priv->virtual = (void __user *)do_mmap(filp, 0, buf->total,
- PROT_READ|PROT_WRITE,
- MAP_SHARED,
- buf->bus_address);
+ virtual = do_mmap(filp, 0, buf->total, PROT_READ|PROT_WRITE,
+ MAP_SHARED, buf->bus_address);
dev_priv->mmap_buffer = NULL;
filp->f_op = old_fops;
- if (IS_ERR(buf_priv->virtual)) {
+ if (IS_ERR((void *)virtual)) { /* ugh */
/* Real error */
DRM_ERROR("mmap error\n");
- retcode = PTR_ERR(buf_priv->virtual);
+ retcode = virtual;
buf_priv->virtual = NULL;
+ } else {
+ buf_priv->virtual = (void __user *)virtual;
}
up_write( &current->mm->mmap_sem );
@@ -470,7 +471,7 @@ static int i830_dma_initialize(drm_device_t *dev,
}
int i830_dma_init(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long __user arg)
+ unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
@@ -478,7 +479,7 @@ int i830_dma_init(struct inode *inode, struct file *filp,
drm_i830_init_t init;
int retcode = 0;
- if (copy_from_user(&init, (void __user *)arg, sizeof(init)))
+ if (copy_from_user(&init, (void * __user) arg, sizeof(init)))
return -EFAULT;
switch(init.func) {
@@ -1172,19 +1173,19 @@ static void i830_dma_dispatch_vertex(drm_device_t *dev,
DRM_DEBUG( "start + used - 4 : %ld\n", start + used - 4);
if (buf_priv->currently_mapped == I830_BUF_MAPPED) {
- u32 *vp = buf_priv->virtual;
+ u32 __user *vp = buf_priv->virtual;
- DRM_PUT_USER_UNCHECKED(&vp[0], (GFX_OP_PRIMITIVE |
+ put_user( (GFX_OP_PRIMITIVE |
sarea_priv->vertex_prim |
- ((used/4)-2)));
+ ((used/4)-2)), &vp[0]);
if (dev_priv->use_mi_batchbuffer_start) {
- DRM_PUT_USER_UNCHECKED(&vp[used/4], MI_BATCH_BUFFER_END);
+ put_user(MI_BATCH_BUFFER_END, &vp[used/4]);
used += 4;
}
if (used & 4) {
- DRM_PUT_USER_UNCHECKED(&vp[used/4], 0);
+ put_user(0, &vp[used/4]);
used += 4;
}
@@ -1322,7 +1323,7 @@ void i830_reclaim_buffers( struct file *filp )
}
int i830_flush_ioctl(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long __user arg)
+ unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
@@ -1337,7 +1338,7 @@ int i830_flush_ioctl(struct inode *inode, struct file *filp,
}
int i830_dma_vertex(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long __user arg)
+ unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
@@ -1372,7 +1373,7 @@ int i830_dma_vertex(struct inode *inode, struct file *filp,
}
int i830_clear_bufs(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long __user arg)
+ unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
@@ -1399,7 +1400,7 @@ int i830_clear_bufs(struct inode *inode, struct file *filp,
}
int i830_swap_bufs(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long __user arg)
+ unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
@@ -1463,7 +1464,7 @@ int i830_flip_bufs(struct inode *inode, struct file *filp,
}
int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long __user arg)
+ unsigned long arg)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
@@ -1477,7 +1478,7 @@ int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
}
int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long __user arg)
+ unsigned long arg)
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
@@ -1514,7 +1515,7 @@ int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
int i830_copybuf(struct inode *inode,
struct file *filp,
unsigned int cmd,
- unsigned long __user arg)
+ unsigned long arg)
{
/* Never copy - 2.4.x doesn't need it */
return 0;
@@ -1529,7 +1530,7 @@ int i830_docopy(struct inode *inode, struct file *filp, unsigned int cmd,
int i830_getparam( struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long __user arg )
+ unsigned long arg )
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
@@ -1563,7 +1564,7 @@ int i830_getparam( struct inode *inode, struct file *filp, unsigned int cmd,
int i830_setparam( struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long __user arg )
+ unsigned long arg )
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;