summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drmP.h10
-rw-r--r--linux-core/drm_ioctl.c6
-rw-r--r--linux-core/drm_irq.c6
-rw-r--r--linux-core/drm_stub.c6
-rw-r--r--linux-core/i810_dma.c29
-rw-r--r--linux-core/i830_dma.c45
-rw-r--r--linux-core/i830_irq.c6
7 files changed, 55 insertions, 53 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 066b185d..23c6854c 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -558,7 +558,7 @@ typedef struct drm_ctx_list {
drm_file_t *tag; /**< associated fd private data */
} drm_ctx_list_t;
-#if __HAVE_VBL_IRQ
+#ifdef __HAVE_VBL_IRQ
typedef struct drm_vbl_sig {
struct list_head head;
@@ -661,7 +661,7 @@ typedef struct drm_device {
#endif
/** \name VBLANK IRQ support */
/*@{*/
-#if __HAVE_VBL_IRQ
+#ifdef __HAVE_VBL_IRQ
wait_queue_head_t vbl_queue; /**< VBLANK wait queue */
atomic_t vbl_received;
spinlock_t vbl_lock;
@@ -879,13 +879,13 @@ extern irqreturn_t DRM(irq_handler)( DRM_IRQ_ARGS );
extern void DRM(driver_irq_preinstall)( drm_device_t *dev );
extern void DRM(driver_irq_postinstall)( drm_device_t *dev );
extern void DRM(driver_irq_uninstall)( drm_device_t *dev );
-#if __HAVE_VBL_IRQ
+#ifdef __HAVE_VBL_IRQ
extern int DRM(wait_vblank)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int DRM(vblank_wait)(drm_device_t *dev, unsigned int *vbl_seq);
extern void DRM(vbl_send_signals)( drm_device_t *dev );
#endif
-#if __HAVE_IRQ_BH
+#ifdef __HAVE_IRQ_BH
extern void DRM(irq_immediate_bh)( void *dev );
#endif
#endif
@@ -933,7 +933,7 @@ extern int DRM(proc_cleanup)(int minor,
struct proc_dir_entry *root,
struct proc_dir_entry *dev_root);
-#if __HAVE_SG
+#ifdef __HAVE_SG
/* Scatter Gather Support (drm_scatter.h) */
extern void DRM(sg_cleanup)(drm_sg_mem_t *entry);
extern int DRM(sg_alloc)(struct inode *inode, struct file *filp,
diff --git a/linux-core/drm_ioctl.c b/linux-core/drm_ioctl.c
index 379a4f05..2ecce48f 100644
--- a/linux-core/drm_ioctl.c
+++ b/linux-core/drm_ioctl.c
@@ -54,7 +54,7 @@ int DRM(getunique)(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- drm_unique_t __user *argp = (void __user *)arg;
+ drm_unique_t __user *argp = (void __user *)arg;
drm_unique_t u;
if (copy_from_user(&u, argp, sizeof(u)))
@@ -93,7 +93,7 @@ int DRM(setunique)(struct inode *inode, struct file *filp,
if (dev->unique_len || dev->unique) return -EBUSY;
- if (copy_from_user(&u, (drm_unique_t __user *)arg, sizeof(u)))
+ if (copy_from_user(&u, (drm_unique_t __user *)arg, sizeof(u)))
return -EFAULT;
if (!u.unique_len || u.unique_len > 1024) return -EINVAL;
@@ -234,7 +234,7 @@ int DRM(getclient)( struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- drm_client_t __user *argp = (void __user *)arg;
+ drm_client_t __user *argp = (void __user *)arg;
drm_client_t client;
drm_file_t *pt;
int idx;
diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c
index 035eb70f..aac0b1b0 100644
--- a/linux-core/drm_irq.c
+++ b/linux-core/drm_irq.c
@@ -129,7 +129,7 @@ int DRM(irq_install)( drm_device_t *dev )
dev->dma->this_buffer = NULL;
#endif
-#if __HAVE_IRQ_BH
+#ifdef __HAVE_IRQ_BH
#if !HAS_WORKQUEUE
INIT_LIST_HEAD( &dev->tq.list );
dev->tq.sync = 0;
@@ -140,7 +140,7 @@ int DRM(irq_install)( drm_device_t *dev )
#endif
#endif
-#if __HAVE_VBL_IRQ
+#ifdef __HAVE_VBL_IRQ
init_waitqueue_head(&dev->vbl_queue);
spin_lock_init( &dev->vbl_lock );
@@ -231,7 +231,7 @@ int DRM(control)( struct inode *inode, struct file *filp,
}
}
-#if __HAVE_VBL_IRQ
+#ifdef __HAVE_VBL_IRQ
/**
* Wait for VBLANK.
diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c
index 0df5068c..7ab5e427 100644
--- a/linux-core/drm_stub.c
+++ b/linux-core/drm_stub.c
@@ -179,7 +179,7 @@ int DRM(stub_register)(const char *name, struct file_operations *fops,
DRM_DEBUG("\n");
- /* if we are registering a second device we don't need to worry
+ /* if we are registering a second device we don't need to worry
about inter module get/put and other things as they've been
done already */
if (DRM(numdevs) == 0) {
@@ -211,7 +211,7 @@ int DRM(stub_register)(const char *name, struct file_operations *fops,
inter_module_register("drm", THIS_MODULE, &DRM(stub_info));
}
}
- else
+ else
DRM_DEBUG("already retrieved inter_module information\n");
if (DRM(stub_info).info_register) {
@@ -229,7 +229,7 @@ int DRM(stub_register)(const char *name, struct file_operations *fops,
}
return -1;
}
-
+
/**
* Unregister.
*
diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c
index 144ce113..eb5e192b 100644
--- a/linux-core/i810_dma.c
+++ b/linux-core/i810_dma.c
@@ -466,7 +466,7 @@ int i810_dma_init_compat(drm_i810_init_t *init, unsigned long arg)
{
/* Get v1.1 init data */
- if (copy_from_user(init, (drm_i810_pre12_init_t *)arg,
+ if (copy_from_user(init, (drm_i810_pre12_init_t __user *)arg,
sizeof(drm_i810_pre12_init_t))) {
return -EFAULT;
}
@@ -475,7 +475,7 @@ 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 */
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 __user *)arg,
sizeof(drm_i810_init_t))) {
return -EFAULT;
}
@@ -504,7 +504,7 @@ int i810_dma_init(struct inode *inode, struct file *filp,
int retcode = 0;
/* Get only the init func */
- if (copy_from_user(&init, (void *)arg, sizeof(drm_i810_init_func_t)))
+ if (copy_from_user(&init, (void __user *)arg, sizeof(drm_i810_init_func_t)))
return -EFAULT;
switch(init.func) {
@@ -528,7 +528,7 @@ int i810_dma_init(struct inode *inode, struct file *filp,
default:
case I810_INIT_DMA_1_4:
DRM_INFO("Using v1.4 init.\n");
- if (copy_from_user(&init, (drm_i810_init_t *)arg,
+ if (copy_from_user(&init, (drm_i810_init_t __user *)arg,
sizeof(drm_i810_init_t))) {
return -EFAULT;
}
@@ -851,12 +851,13 @@ static void i810_dma_dispatch_vertex(drm_device_t *dev,
if (buf_priv->currently_mapped == I810_BUF_MAPPED) {
unsigned int prim = (sarea_priv->vertex_prim & PR_MASK);
- DRM_PUT_USER_UNCHECKED((u32 *)buf_priv->virtual,
- (GFX_OP_PRIMITIVE | prim |
- ((used/4)-2)));
+ put_user((GFX_OP_PRIMITIVE | prim |
+ ((used/4)-2)),
+ (u32 __user *)buf_priv->virtual);
if (used & 4) {
- DRM_PUT_USER_UNCHECKED((u32 *)((u32)buf_priv->virtual + used), 0);
+ put_user(0,
+ (u32 __user *)((u32)buf_priv->virtual + used));
used += 4;
}
@@ -1062,7 +1063,7 @@ int i810_dma_vertex(struct inode *inode, struct file *filp,
dev_priv->sarea_priv;
drm_i810_vertex_t vertex;
- if (copy_from_user(&vertex, (drm_i810_vertex_t *)arg, sizeof(vertex)))
+ if (copy_from_user(&vertex, (drm_i810_vertex_t __user *)arg, sizeof(vertex)))
return -EFAULT;
if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
@@ -1097,7 +1098,7 @@ int i810_clear_bufs(struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev;
drm_i810_clear_t clear;
- if (copy_from_user(&clear, (drm_i810_clear_t *)arg, sizeof(clear)))
+ if (copy_from_user(&clear, (drm_i810_clear_t __user *)arg, sizeof(clear)))
return -EFAULT;
if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
@@ -1159,7 +1160,7 @@ int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
dev_priv->sarea_priv;
- if (copy_from_user(&d, (drm_i810_dma_t *)arg, sizeof(d)))
+ 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)) {
@@ -1174,7 +1175,7 @@ int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n",
current->pid, retcode, d.granted);
- if (copy_to_user((drm_dma_t *)arg, &d, sizeof(d)))
+ if (copy_to_user((drm_dma_t __user *)arg, &d, sizeof(d)))
return -EFAULT;
sarea_priv->last_dispatch = (int) hw_status[5];
@@ -1272,7 +1273,7 @@ int i810_dma_mc(struct inode *inode, struct file *filp,
dev_priv->sarea_priv;
drm_i810_mc_t mc;
- if (copy_from_user(&mc, (drm_i810_mc_t *)arg, sizeof(mc)))
+ 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)) {
@@ -1314,7 +1315,7 @@ int i810_ov0_info(struct inode *inode, struct file *filp,
data.offset = dev_priv->overlay_offset;
data.physical = dev_priv->overlay_physical;
- if (copy_to_user((drm_i810_overlay_t *)arg,&data,sizeof(data)))
+ if (copy_to_user((drm_i810_overlay_t __user *)arg,&data,sizeof(data)))
return -EFAULT;
return 0;
}
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;
diff --git a/linux-core/i830_irq.c b/linux-core/i830_irq.c
index fcf2dedd..7a066b6f 100644
--- a/linux-core/i830_irq.c
+++ b/linux-core/i830_irq.c
@@ -122,7 +122,7 @@ int i830_wait_irq(drm_device_t *dev, int irq_nr)
/* Needs the lock as it touches the ring.
*/
int i830_irq_emit( 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;
@@ -140,7 +140,7 @@ int i830_irq_emit( struct inode *inode, struct file *filp, unsigned int cmd,
return -EINVAL;
}
- if (copy_from_user( &emit, (drm_i830_irq_emit_t *)arg, sizeof(emit) ))
+ if (copy_from_user( &emit, (drm_i830_irq_emit_t __user *)arg, sizeof(emit) ))
return -EFAULT;
result = i830_emit_irq( dev );
@@ -169,7 +169,7 @@ int i830_irq_wait( struct inode *inode, struct file *filp, unsigned int cmd,
return -EINVAL;
}
- if (copy_from_user( &irqwait, (drm_i830_irq_wait_t *)arg,
+ if (copy_from_user( &irqwait, (drm_i830_irq_wait_t __user *)arg,
sizeof(irqwait) ))
return -EFAULT;