drm: fix all sparse warning on 32-bit x86

Finally cleaned up the sparse warnings for the drm.

Signed-off-by: Dave Airlie <airlied@linux.ie>
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
index e3d372a..58e513a 100644
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -117,9 +117,9 @@
  * type.  Adds the map to the map list drm_device::maplist. Adds MTRR's where
  * applicable and if supported by the kernel.
  */
-int drm_addmap_core(drm_device_t * dev, unsigned int offset,
-		    unsigned int size, drm_map_type_t type,
-		    drm_map_flags_t flags, drm_map_list_t ** maplist)
+static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
+			   unsigned int size, drm_map_type_t type,
+			   drm_map_flags_t flags, drm_map_list_t ** maplist)
 {
 	drm_map_t *map;
 	drm_map_list_t *list;
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c
index 6380127..bdd168d 100644
--- a/drivers/char/drm/drm_context.c
+++ b/drivers/char/drm/drm_context.c
@@ -232,7 +232,7 @@
 	map = dev->context_sareas[request.ctx_id];
 	up(&dev->struct_sem);
 
-	request.handle = 0;
+	request.handle = NULL;
 	list_for_each_entry(_entry, &dev->maplist->head, head) {
 		if (_entry->map == map) {
 			request.handle =
@@ -240,7 +240,7 @@
 			break;
 		}
 	}
-	if (request.handle == 0)
+	if (request.handle == NULL)
 		return -EINVAL;
 
 	if (copy_to_user(argp, &request, sizeof(request)))
diff --git a/drivers/char/drm/i810_drv.c b/drivers/char/drm/i810_drv.c
index 327e2f1..070cef6 100644
--- a/drivers/char/drm/i810_drv.c
+++ b/drivers/char/drm/i810_drv.c
@@ -74,9 +74,6 @@
 	i810_PCI_IDS
 };
 
-extern drm_ioctl_desc_t i810_ioctls[];
-extern int i810_max_ioctl;
-
 static struct drm_driver driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
diff --git a/drivers/char/drm/i810_drv.h b/drivers/char/drm/i810_drv.h
index 2d6b594..c78f36a 100644
--- a/drivers/char/drm/i810_drv.h
+++ b/drivers/char/drm/i810_drv.h
@@ -121,6 +121,9 @@
 extern void i810_driver_prerelease(drm_device_t * dev, DRMFILE filp);
 extern int i810_driver_device_is_agp(drm_device_t * dev);
 
+extern drm_ioctl_desc_t i810_ioctls[];
+extern int i810_max_ioctl;
+
 #define I810_BASE(reg)		((unsigned long) \
 				dev_priv->mmio_map->handle)
 #define I810_ADDR(reg)		(I810_BASE(reg) + reg)
diff --git a/drivers/char/drm/i830_drv.c b/drivers/char/drm/i830_drv.c
index 6dad356..acd821e8 100644
--- a/drivers/char/drm/i830_drv.c
+++ b/drivers/char/drm/i830_drv.c
@@ -75,9 +75,6 @@
 	i830_PCI_IDS
 };
 
-extern drm_ioctl_desc_t i830_ioctls[];
-extern int i830_max_ioctl;
-
 static struct drm_driver driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
diff --git a/drivers/char/drm/i830_drv.h b/drivers/char/drm/i830_drv.h
index 9983546..bc4bd49 100644
--- a/drivers/char/drm/i830_drv.h
+++ b/drivers/char/drm/i830_drv.h
@@ -120,6 +120,9 @@
 
 } drm_i830_private_t;
 
+extern drm_ioctl_desc_t i830_ioctls[];
+extern int i830_max_ioctl;
+
 /* i830_dma.c */
 extern void i830_reclaim_buffers(drm_device_t * dev, struct file *filp);
 
@@ -139,15 +142,10 @@
 extern void i830_driver_prerelease(drm_device_t * dev, DRMFILE filp);
 extern int i830_driver_device_is_agp(drm_device_t * dev);
 
-#define I830_BASE(reg)		((unsigned long) \
-				dev_priv->mmio_map->handle)
-#define I830_ADDR(reg)		(I830_BASE(reg) + reg)
-#define I830_DEREF(reg)		*(__volatile__ unsigned int *)I830_ADDR(reg)
-#define I830_READ(reg)		readl((volatile u32 *)I830_ADDR(reg))
-#define I830_WRITE(reg,val) 	writel(val, (volatile u32 *)I830_ADDR(reg))
-#define I830_DEREF16(reg)	*(__volatile__ u16 *)I830_ADDR(reg)
-#define I830_READ16(reg) 	I830_DEREF16(reg)
-#define I830_WRITE16(reg,val)	do { I830_DEREF16(reg) = val; } while (0)
+#define I830_READ(reg)          DRM_READ32(dev_priv->mmio_map, reg)
+#define I830_WRITE(reg,val)     DRM_WRITE32(dev_priv->mmio_map, reg, val)
+#define I830_READ16(reg)        DRM_READ16(dev_priv->mmio_map, reg)
+#define I830_WRITE16(reg,val)   DRM_WRITE16(dev_priv->mmio_map, reg, val)
 
 #define I830_VERBOSE 0
 
diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c
index 665da6a..0508240 100644
--- a/drivers/char/drm/i915_drv.c
+++ b/drivers/char/drm/i915_drv.c
@@ -69,9 +69,6 @@
 	i915_PCI_IDS
 };
 
-extern drm_ioctl_desc_t i915_ioctls[];
-extern int i915_max_ioctl;
-
 static struct drm_driver driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h
index 511ef1d..17e457c 100644
--- a/drivers/char/drm/i915_drv.h
+++ b/drivers/char/drm/i915_drv.h
@@ -99,6 +99,9 @@
 	struct mem_block *agp_heap;
 } drm_i915_private_t;
 
+extern drm_ioctl_desc_t i915_ioctls[];
+extern int i915_max_ioctl;
+
 				/* i915_dma.c */
 extern void i915_kernel_lost_context(drm_device_t * dev);
 extern void i915_driver_pretakedown(drm_device_t * dev);
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
index 220037a..0cc7c30 100644
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -78,9 +78,6 @@
 	mga_PCI_IDS
 };
 
-extern drm_ioctl_desc_t mga_ioctls[];
-extern int mga_max_ioctl;
-
 static struct drm_driver driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
@@ -151,7 +148,7 @@
  * \returns
  * If the device is a PCI G450, zero is returned.  Otherwise 2 is returned.
  */
-int mga_driver_device_is_agp(drm_device_t * dev)
+static int mga_driver_device_is_agp(drm_device_t * dev)
 {
 	const struct pci_dev *const pdev = dev->pdev;
 
diff --git a/drivers/char/drm/mga_drv.h b/drivers/char/drm/mga_drv.h
index 05f0f91..474853d 100644
--- a/drivers/char/drm/mga_drv.h
+++ b/drivers/char/drm/mga_drv.h
@@ -148,6 +148,9 @@
 	unsigned int agp_pages;
 } drm_mga_private_t;
 
+extern drm_ioctl_desc_t mga_ioctls[];
+extern int mga_max_ioctl;
+
 				/* mga_dma.c */
 extern int mga_driver_preinit(drm_device_t * dev, unsigned long flags);
 extern int mga_dma_bootstrap(DRM_IOCTL_ARGS);
diff --git a/drivers/char/drm/r128_drv.c b/drivers/char/drm/r128_drv.c
index 4d92246..1661e73 100644
--- a/drivers/char/drm/r128_drv.c
+++ b/drivers/char/drm/r128_drv.c
@@ -66,9 +66,6 @@
 	r128_PCI_IDS
 };
 
-extern drm_ioctl_desc_t r128_ioctls[];
-extern int r128_max_ioctl;
-
 static struct drm_driver driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
diff --git a/drivers/char/drm/r128_drv.h b/drivers/char/drm/r128_drv.h
index 87c5e13..5c79e40 100644
--- a/drivers/char/drm/r128_drv.h
+++ b/drivers/char/drm/r128_drv.h
@@ -128,6 +128,9 @@
 	drm_r128_freelist_t *list_entry;
 } drm_r128_buf_priv_t;
 
+extern drm_ioctl_desc_t r128_ioctls[];
+extern int r128_max_ioctl;
+
 				/* r128_cce.c */
 extern int r128_cce_init(DRM_IOCTL_ARGS);
 extern int r128_cce_start(DRM_IOCTL_ARGS);
diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c
index aa66f46..3a1ac5f 100644
--- a/drivers/char/drm/r300_cmdbuf.c
+++ b/drivers/char/drm/r300_cmdbuf.c
@@ -53,7 +53,7 @@
  * buffer, starting with index n.
  */
 static int r300_emit_cliprects(drm_radeon_private_t * dev_priv,
-			       drm_radeon_cmd_buffer_t * cmdbuf, int n)
+			       drm_radeon_kcmd_buffer_t * cmdbuf, int n)
 {
 	drm_clip_rect_t box;
 	int nr;
@@ -131,7 +131,7 @@
 	return 0;
 }
 
-u8 r300_reg_flags[0x10000 >> 2];
+static u8 r300_reg_flags[0x10000 >> 2];
 
 void r300_init_reg_flags(void)
 {
@@ -260,7 +260,7 @@
 
 static __inline__ int r300_emit_carefully_checked_packet0(drm_radeon_private_t *
 							  dev_priv,
-							  drm_radeon_cmd_buffer_t
+							  drm_radeon_kcmd_buffer_t
 							  * cmdbuf,
 							  drm_r300_cmd_header_t
 							  header)
@@ -281,7 +281,7 @@
 		return DRM_ERR(EINVAL);
 	}
 	for (i = 0; i < sz; i++) {
-		values[i] = ((int __user *)cmdbuf->buf)[i];
+		values[i] = ((int *)cmdbuf->buf)[i];
 		switch (r300_reg_flags[(reg >> 2) + i]) {
 		case MARK_SAFE:
 			break;
@@ -318,7 +318,7 @@
  * Note that checks are performed on contents and addresses of the registers
  */
 static __inline__ int r300_emit_packet0(drm_radeon_private_t * dev_priv,
-					drm_radeon_cmd_buffer_t * cmdbuf,
+					drm_radeon_kcmd_buffer_t * cmdbuf,
 					drm_r300_cmd_header_t header)
 {
 	int reg;
@@ -349,7 +349,7 @@
 
 	BEGIN_RING(1 + sz);
 	OUT_RING(CP_PACKET0(reg, sz - 1));
-	OUT_RING_TABLE((int __user *)cmdbuf->buf, sz);
+	OUT_RING_TABLE((int *)cmdbuf->buf, sz);
 	ADVANCE_RING();
 
 	cmdbuf->buf += sz * 4;
@@ -364,7 +364,7 @@
  * Called by r300_do_cp_cmdbuf.
  */
 static __inline__ int r300_emit_vpu(drm_radeon_private_t * dev_priv,
-				    drm_radeon_cmd_buffer_t * cmdbuf,
+				    drm_radeon_kcmd_buffer_t * cmdbuf,
 				    drm_r300_cmd_header_t header)
 {
 	int sz;
@@ -386,7 +386,7 @@
 	OUT_RING_REG(R300_VAP_PVS_WAITIDLE, 0);
 	OUT_RING_REG(R300_VAP_PVS_UPLOAD_ADDRESS, addr);
 	OUT_RING(CP_PACKET0_TABLE(R300_VAP_PVS_UPLOAD_DATA, sz * 4 - 1));
-	OUT_RING_TABLE((int __user *)cmdbuf->buf, sz * 4);
+	OUT_RING_TABLE((int *)cmdbuf->buf, sz * 4);
 
 	ADVANCE_RING();
 
@@ -401,7 +401,7 @@
  * Called by r300_emit_packet3.
  */
 static __inline__ int r300_emit_clear(drm_radeon_private_t * dev_priv,
-				      drm_radeon_cmd_buffer_t * cmdbuf)
+				      drm_radeon_kcmd_buffer_t * cmdbuf)
 {
 	RING_LOCALS;
 
@@ -412,7 +412,7 @@
 	OUT_RING(CP_PACKET3(R200_3D_DRAW_IMMD_2, 8));
 	OUT_RING(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING |
 		 (1 << R300_PRIM_NUM_VERTICES_SHIFT));
-	OUT_RING_TABLE((int __user *)cmdbuf->buf, 8);
+	OUT_RING_TABLE((int *)cmdbuf->buf, 8);
 	ADVANCE_RING();
 
 	cmdbuf->buf += 8 * 4;
@@ -422,7 +422,7 @@
 }
 
 static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t * dev_priv,
-					       drm_radeon_cmd_buffer_t * cmdbuf,
+					       drm_radeon_kcmd_buffer_t * cmdbuf,
 					       u32 header)
 {
 	int count, i, k;
@@ -490,7 +490,7 @@
 }
 
 static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t * dev_priv,
-					    drm_radeon_cmd_buffer_t * cmdbuf)
+					    drm_radeon_kcmd_buffer_t * cmdbuf)
 {
 	u32 header;
 	int count;
@@ -503,7 +503,7 @@
 	   We need to be smarter. */
 
 	/* obtain first word - actual packet3 header */
-	header = *(u32 __user *) cmdbuf->buf;
+	header = *(u32 *) cmdbuf->buf;
 
 	/* Is it packet 3 ? */
 	if ((header >> 30) != 0x3) {
@@ -541,7 +541,7 @@
 
 	BEGIN_RING(count + 2);
 	OUT_RING(header);
-	OUT_RING_TABLE((int __user *)(cmdbuf->buf + 4), count + 1);
+	OUT_RING_TABLE((int *)(cmdbuf->buf + 4), count + 1);
 	ADVANCE_RING();
 
 	cmdbuf->buf += (count + 2) * 4;
@@ -555,12 +555,12 @@
  * Called by r300_do_cp_cmdbuf.
  */
 static __inline__ int r300_emit_packet3(drm_radeon_private_t * dev_priv,
-					drm_radeon_cmd_buffer_t * cmdbuf,
+					drm_radeon_kcmd_buffer_t * cmdbuf,
 					drm_r300_cmd_header_t header)
 {
 	int n;
 	int ret;
-	char __user *orig_buf = cmdbuf->buf;
+	char *orig_buf = cmdbuf->buf;
 	int orig_bufsz = cmdbuf->bufsz;
 
 	/* This is a do-while-loop so that we run the interior at least once,
@@ -659,7 +659,7 @@
  */
 int r300_do_cp_cmdbuf(drm_device_t * dev,
 		      DRMFILE filp,
-		      drm_file_t * filp_priv, drm_radeon_cmd_buffer_t * cmdbuf)
+		      drm_file_t * filp_priv, drm_radeon_kcmd_buffer_t * cmdbuf)
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
 	drm_device_dma_t *dma = dev->dma;
diff --git a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c
index 7074d01..ee49670d 100644
--- a/drivers/char/drm/radeon_drv.c
+++ b/drivers/char/drm/radeon_drv.c
@@ -71,9 +71,6 @@
 	radeon_PCI_IDS
 };
 
-extern drm_ioctl_desc_t radeon_ioctls[];
-extern int radeon_max_ioctl;
-
 static struct drm_driver driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index 3c74734..120ee5a 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -281,7 +281,17 @@
 	u32 age;
 } drm_radeon_buf_priv_t;
 
+typedef struct drm_radeon_kcmd_buffer {
+	int bufsz;
+	char *buf;
+	int nbox;
+	drm_clip_rect_t __user *boxes;
+} drm_radeon_kcmd_buffer_t;
+
 extern int radeon_no_wb;
+extern drm_ioctl_desc_t radeon_ioctls[];
+extern int radeon_max_ioctl;
+
 				/* radeon_cp.c */
 extern int radeon_cp_init(DRM_IOCTL_ARGS);
 extern int radeon_cp_start(DRM_IOCTL_ARGS);
@@ -340,7 +350,7 @@
 
 extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp,
 			     drm_file_t * filp_priv,
-			     drm_radeon_cmd_buffer_t * cmdbuf);
+			     drm_radeon_kcmd_buffer_t * cmdbuf);
 
 /* Flags for stats.boxes
  */
diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c
index 2eae60b..231ac14 100644
--- a/drivers/char/drm/radeon_state.c
+++ b/drivers/char/drm/radeon_state.c
@@ -40,7 +40,7 @@
 static __inline__ int radeon_check_and_fixup_offset(drm_radeon_private_t *
 						    dev_priv,
 						    drm_file_t * filp_priv,
-						    u32 * offset)
+						    u32 *offset)
 {
 	u32 off = *offset;
 	struct drm_radeon_driver_file_fields *radeon_priv;
@@ -66,7 +66,7 @@
 static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t *
 						     dev_priv,
 						     drm_file_t * filp_priv,
-						     int id, u32 __user * data)
+						     int id, u32 *data)
 {
 	switch (id) {
 
@@ -240,8 +240,7 @@
 static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t *
 						     dev_priv,
 						     drm_file_t * filp_priv,
-						     drm_radeon_cmd_buffer_t *
-						     cmdbuf,
+						     drm_radeon_kcmd_buffer_t *cmdbuf,
 						     unsigned int *cmdsz)
 {
 	u32 *cmd = (u32 *) cmdbuf->buf;
@@ -2564,7 +2563,7 @@
 static int radeon_emit_packets(drm_radeon_private_t * dev_priv,
 			       drm_file_t * filp_priv,
 			       drm_radeon_cmd_header_t header,
-			       drm_radeon_cmd_buffer_t * cmdbuf)
+			       drm_radeon_kcmd_buffer_t *cmdbuf)
 {
 	int id = (int)header.packet.packet_id;
 	int sz, reg;
@@ -2599,7 +2598,7 @@
 
 static __inline__ int radeon_emit_scalars(drm_radeon_private_t * dev_priv,
 					  drm_radeon_cmd_header_t header,
-					  drm_radeon_cmd_buffer_t * cmdbuf)
+					  drm_radeon_kcmd_buffer_t * cmdbuf)
 {
 	int sz = header.scalars.count;
 	int start = header.scalars.offset;
@@ -2621,7 +2620,7 @@
  */
 static __inline__ int radeon_emit_scalars2(drm_radeon_private_t * dev_priv,
 					   drm_radeon_cmd_header_t header,
-					   drm_radeon_cmd_buffer_t * cmdbuf)
+					   drm_radeon_kcmd_buffer_t * cmdbuf)
 {
 	int sz = header.scalars.count;
 	int start = ((unsigned int)header.scalars.offset) + 0x100;
@@ -2641,7 +2640,7 @@
 
 static __inline__ int radeon_emit_vectors(drm_radeon_private_t * dev_priv,
 					  drm_radeon_cmd_header_t header,
-					  drm_radeon_cmd_buffer_t * cmdbuf)
+					  drm_radeon_kcmd_buffer_t * cmdbuf)
 {
 	int sz = header.vectors.count;
 	int start = header.vectors.offset;
@@ -2662,7 +2661,7 @@
 
 static int radeon_emit_packet3(drm_device_t * dev,
 			       drm_file_t * filp_priv,
-			       drm_radeon_cmd_buffer_t * cmdbuf)
+			       drm_radeon_kcmd_buffer_t *cmdbuf)
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
 	unsigned int cmdsz;
@@ -2688,7 +2687,7 @@
 
 static int radeon_emit_packet3_cliprect(drm_device_t * dev,
 					drm_file_t * filp_priv,
-					drm_radeon_cmd_buffer_t * cmdbuf,
+					drm_radeon_kcmd_buffer_t *cmdbuf,
 					int orig_nbox)
 {
 	drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -2785,7 +2784,7 @@
 	drm_device_dma_t *dma = dev->dma;
 	drm_buf_t *buf = NULL;
 	int idx;
-	drm_radeon_cmd_buffer_t cmdbuf;
+	drm_radeon_kcmd_buffer_t cmdbuf;
 	drm_radeon_cmd_header_t header;
 	int orig_nbox, orig_bufsz;
 	char *kbuf = NULL;
@@ -2819,7 +2818,7 @@
 		kbuf = drm_alloc(cmdbuf.bufsz, DRM_MEM_DRIVER);
 		if (kbuf == NULL)
 			return DRM_ERR(ENOMEM);
-		if (DRM_COPY_FROM_USER(kbuf, cmdbuf.buf, cmdbuf.bufsz)) {
+		if (DRM_COPY_FROM_USER(kbuf, (void __user *)cmdbuf.buf, cmdbuf.bufsz)) {
 			drm_free(kbuf, orig_bufsz, DRM_MEM_DRIVER);
 			return DRM_ERR(EFAULT);
 		}
diff --git a/drivers/char/drm/savage_drv.c b/drivers/char/drm/savage_drv.c
index 0906f9a..22d799c 100644
--- a/drivers/char/drm/savage_drv.c
+++ b/drivers/char/drm/savage_drv.c
@@ -59,9 +59,6 @@
 	savage_PCI_IDS
 };
 
-extern drm_ioctl_desc_t savage_ioctls[];
-extern int savage_max_ioctl;
-
 static struct drm_driver driver = {
 	.driver_features =
 	    DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_PCI_DMA,
diff --git a/drivers/char/drm/savage_drv.h b/drivers/char/drm/savage_drv.h
index 358f4fb..a4b0fa9 100644
--- a/drivers/char/drm/savage_drv.h
+++ b/drivers/char/drm/savage_drv.h
@@ -104,6 +104,9 @@
 	S3_LAST
 };
 
+extern drm_ioctl_desc_t savage_ioctls[];
+extern int savage_max_ioctl;
+
 #define S3_SAVAGE3D_SERIES(chip)  ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX))
 
 #define S3_SAVAGE4_SERIES(chip)  ((chip==S3_SAVAGE4)            \
diff --git a/drivers/char/drm/savage_state.c b/drivers/char/drm/savage_state.c
index 39654cb5..e87a5d5 100644
--- a/drivers/char/drm/savage_state.c
+++ b/drivers/char/drm/savage_state.c
@@ -816,10 +816,8 @@
 	if (nbox == 0)
 		return 0;
 
-	DRM_GET_USER_UNCHECKED(mask, &((const drm_savage_cmd_header_t *)data)
-			       ->clear1.mask);
-	DRM_GET_USER_UNCHECKED(value, &((const drm_savage_cmd_header_t *)data)
-			       ->clear1.value);
+	DRM_GET_USER_UNCHECKED(mask, &data->clear1.mask);
+	DRM_GET_USER_UNCHECKED(value, &data->clear1.value);
 
 	clear_cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
 	    BCI_CMD_SEND_COLOR | BCI_CMD_DEST_PBD_NEW;
diff --git a/drivers/char/drm/sis_drv.c b/drivers/char/drm/sis_drv.c
index 6d0cb22..3cef106 100644
--- a/drivers/char/drm/sis_drv.c
+++ b/drivers/char/drm/sis_drv.c
@@ -61,9 +61,6 @@
 	sisdrv_PCI_IDS
 };
 
-extern drm_ioctl_desc_t sis_ioctls[];
-extern int sis_max_ioctl;
-
 static struct drm_driver driver = {
 	.driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR,
 	.context_ctor = sis_init_context,
diff --git a/drivers/char/drm/sis_drv.h b/drivers/char/drm/sis_drv.h
index 4ef3d62..b1fddad 100644
--- a/drivers/char/drm/sis_drv.h
+++ b/drivers/char/drm/sis_drv.h
@@ -49,4 +49,7 @@
 extern int sis_init_context(drm_device_t * dev, int context);
 extern int sis_final_context(drm_device_t * dev, int context);
 
+extern drm_ioctl_desc_t sis_ioctls[];
+extern int sis_max_ioctl;
+
 #endif
diff --git a/drivers/char/drm/via_drv.h b/drivers/char/drm/via_drv.h
index d902dc2..7d5daf4 100644
--- a/drivers/char/drm/via_drv.h
+++ b/drivers/char/drm/via_drv.h
@@ -112,4 +112,7 @@
 extern void via_cleanup_futex(drm_via_private_t * dev_priv);
 extern void via_release_futex(drm_via_private_t * dev_priv, int context);
 
+extern int via_parse_command_stream(drm_device_t * dev, const uint32_t * buf,
+				    unsigned int size);
+
 #endif