aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDave Airlie <airlied@starflyer.(none)>2005-09-30 04:37:36 -0400
committerDave Airlie <airlied@linux.ie>2005-09-30 04:37:36 -0400
commitb3a83639895a422b25f72eec0a5d1d88c3ac4e9e (patch)
tree1cd03d53cccb01964ea57564d7be575a29b7fec2 /drivers
parent689b9d74b1c00e1316fbb7d1e912fe1227fdb1ab (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/drm/drm_bufs.c6
-rw-r--r--drivers/char/drm/drm_context.c4
-rw-r--r--drivers/char/drm/i810_drv.c3
-rw-r--r--drivers/char/drm/i810_drv.h3
-rw-r--r--drivers/char/drm/i830_drv.c3
-rw-r--r--drivers/char/drm/i830_drv.h16
-rw-r--r--drivers/char/drm/i915_drv.c3
-rw-r--r--drivers/char/drm/i915_drv.h3
-rw-r--r--drivers/char/drm/mga_drv.c5
-rw-r--r--drivers/char/drm/mga_drv.h3
-rw-r--r--drivers/char/drm/r128_drv.c3
-rw-r--r--drivers/char/drm/r128_drv.h3
-rw-r--r--drivers/char/drm/r300_cmdbuf.c34
-rw-r--r--drivers/char/drm/radeon_drv.c3
-rw-r--r--drivers/char/drm/radeon_drv.h12
-rw-r--r--drivers/char/drm/radeon_state.c23
-rw-r--r--drivers/char/drm/savage_drv.c3
-rw-r--r--drivers/char/drm/savage_drv.h3
-rw-r--r--drivers/char/drm/savage_state.c6
-rw-r--r--drivers/char/drm/sis_drv.c3
-rw-r--r--drivers/char/drm/sis_drv.h3
-rw-r--r--drivers/char/drm/via_drv.h3
22 files changed, 75 insertions, 73 deletions
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
index e3d372ad0076..58e513a44740 100644
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -117,9 +117,9 @@ static __inline__ unsigned int HandleID(unsigned long lhandle,
117 * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where 117 * type. Adds the map to the map list drm_device::maplist. Adds MTRR's where
118 * applicable and if supported by the kernel. 118 * applicable and if supported by the kernel.
119 */ 119 */
120int drm_addmap_core(drm_device_t * dev, unsigned int offset, 120static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
121 unsigned int size, drm_map_type_t type, 121 unsigned int size, drm_map_type_t type,
122 drm_map_flags_t flags, drm_map_list_t ** maplist) 122 drm_map_flags_t flags, drm_map_list_t ** maplist)
123{ 123{
124 drm_map_t *map; 124 drm_map_t *map;
125 drm_map_list_t *list; 125 drm_map_list_t *list;
diff --git a/drivers/char/drm/drm_context.c b/drivers/char/drm/drm_context.c
index 6380127be281..bdd168d88f49 100644
--- a/drivers/char/drm/drm_context.c
+++ b/drivers/char/drm/drm_context.c
@@ -232,7 +232,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
232 map = dev->context_sareas[request.ctx_id]; 232 map = dev->context_sareas[request.ctx_id];
233 up(&dev->struct_sem); 233 up(&dev->struct_sem);
234 234
235 request.handle = 0; 235 request.handle = NULL;
236 list_for_each_entry(_entry, &dev->maplist->head, head) { 236 list_for_each_entry(_entry, &dev->maplist->head, head) {
237 if (_entry->map == map) { 237 if (_entry->map == map) {
238 request.handle = 238 request.handle =
@@ -240,7 +240,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
240 break; 240 break;
241 } 241 }
242 } 242 }
243 if (request.handle == 0) 243 if (request.handle == NULL)
244 return -EINVAL; 244 return -EINVAL;
245 245
246 if (copy_to_user(argp, &request, sizeof(request))) 246 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 327e2f1cc997..070cef6c2b46 100644
--- a/drivers/char/drm/i810_drv.c
+++ b/drivers/char/drm/i810_drv.c
@@ -74,9 +74,6 @@ static struct pci_device_id pciidlist[] = {
74 i810_PCI_IDS 74 i810_PCI_IDS
75}; 75};
76 76
77extern drm_ioctl_desc_t i810_ioctls[];
78extern int i810_max_ioctl;
79
80static struct drm_driver driver = { 77static struct drm_driver driver = {
81 .driver_features = 78 .driver_features =
82 DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | 79 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 2d6b594afa0d..c78f36aaa2f0 100644
--- a/drivers/char/drm/i810_drv.h
+++ b/drivers/char/drm/i810_drv.h
@@ -121,6 +121,9 @@ extern void i810_driver_pretakedown(drm_device_t * dev);
121extern void i810_driver_prerelease(drm_device_t * dev, DRMFILE filp); 121extern void i810_driver_prerelease(drm_device_t * dev, DRMFILE filp);
122extern int i810_driver_device_is_agp(drm_device_t * dev); 122extern int i810_driver_device_is_agp(drm_device_t * dev);
123 123
124extern drm_ioctl_desc_t i810_ioctls[];
125extern int i810_max_ioctl;
126
124#define I810_BASE(reg) ((unsigned long) \ 127#define I810_BASE(reg) ((unsigned long) \
125 dev_priv->mmio_map->handle) 128 dev_priv->mmio_map->handle)
126#define I810_ADDR(reg) (I810_BASE(reg) + reg) 129#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 6dad356450bc..acd821e8fe4d 100644
--- a/drivers/char/drm/i830_drv.c
+++ b/drivers/char/drm/i830_drv.c
@@ -75,9 +75,6 @@ static struct pci_device_id pciidlist[] = {
75 i830_PCI_IDS 75 i830_PCI_IDS
76}; 76};
77 77
78extern drm_ioctl_desc_t i830_ioctls[];
79extern int i830_max_ioctl;
80
81static struct drm_driver driver = { 78static struct drm_driver driver = {
82 .driver_features = 79 .driver_features =
83 DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | 80 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 99835465c44b..bc4bd49fb0cc 100644
--- a/drivers/char/drm/i830_drv.h
+++ b/drivers/char/drm/i830_drv.h
@@ -120,6 +120,9 @@ typedef struct drm_i830_private {
120 120
121} drm_i830_private_t; 121} drm_i830_private_t;
122 122
123extern drm_ioctl_desc_t i830_ioctls[];
124extern int i830_max_ioctl;
125
123/* i830_dma.c */ 126/* i830_dma.c */
124extern void i830_reclaim_buffers(drm_device_t * dev, struct file *filp); 127extern void i830_reclaim_buffers(drm_device_t * dev, struct file *filp);
125 128
@@ -139,15 +142,10 @@ extern int i830_driver_dma_quiescent(drm_device_t * dev);
139extern void i830_driver_prerelease(drm_device_t * dev, DRMFILE filp); 142extern void i830_driver_prerelease(drm_device_t * dev, DRMFILE filp);
140extern int i830_driver_device_is_agp(drm_device_t * dev); 143extern int i830_driver_device_is_agp(drm_device_t * dev);
141 144
142#define I830_BASE(reg) ((unsigned long) \ 145#define I830_READ(reg) DRM_READ32(dev_priv->mmio_map, reg)
143 dev_priv->mmio_map->handle) 146#define I830_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, reg, val)
144#define I830_ADDR(reg) (I830_BASE(reg) + reg) 147#define I830_READ16(reg) DRM_READ16(dev_priv->mmio_map, reg)
145#define I830_DEREF(reg) *(__volatile__ unsigned int *)I830_ADDR(reg) 148#define I830_WRITE16(reg,val) DRM_WRITE16(dev_priv->mmio_map, reg, val)
146#define I830_READ(reg) readl((volatile u32 *)I830_ADDR(reg))
147#define I830_WRITE(reg,val) writel(val, (volatile u32 *)I830_ADDR(reg))
148#define I830_DEREF16(reg) *(__volatile__ u16 *)I830_ADDR(reg)
149#define I830_READ16(reg) I830_DEREF16(reg)
150#define I830_WRITE16(reg,val) do { I830_DEREF16(reg) = val; } while (0)
151 149
152#define I830_VERBOSE 0 150#define I830_VERBOSE 0
153 151
diff --git a/drivers/char/drm/i915_drv.c b/drivers/char/drm/i915_drv.c
index 665da6ac11c6..0508240f4e3b 100644
--- a/drivers/char/drm/i915_drv.c
+++ b/drivers/char/drm/i915_drv.c
@@ -69,9 +69,6 @@ static struct pci_device_id pciidlist[] = {
69 i915_PCI_IDS 69 i915_PCI_IDS
70}; 70};
71 71
72extern drm_ioctl_desc_t i915_ioctls[];
73extern int i915_max_ioctl;
74
75static struct drm_driver driver = { 72static struct drm_driver driver = {
76 .driver_features = 73 .driver_features =
77 DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | 74 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 511ef1d87637..17e457c73dc7 100644
--- a/drivers/char/drm/i915_drv.h
+++ b/drivers/char/drm/i915_drv.h
@@ -99,6 +99,9 @@ typedef struct drm_i915_private {
99 struct mem_block *agp_heap; 99 struct mem_block *agp_heap;
100} drm_i915_private_t; 100} drm_i915_private_t;
101 101
102extern drm_ioctl_desc_t i915_ioctls[];
103extern int i915_max_ioctl;
104
102 /* i915_dma.c */ 105 /* i915_dma.c */
103extern void i915_kernel_lost_context(drm_device_t * dev); 106extern void i915_kernel_lost_context(drm_device_t * dev);
104extern void i915_driver_pretakedown(drm_device_t * dev); 107extern 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 220037a91c09..0cc7c305a7f6 100644
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -78,9 +78,6 @@ static struct pci_device_id pciidlist[] = {
78 mga_PCI_IDS 78 mga_PCI_IDS
79}; 79};
80 80
81extern drm_ioctl_desc_t mga_ioctls[];
82extern int mga_max_ioctl;
83
84static struct drm_driver driver = { 81static struct drm_driver driver = {
85 .driver_features = 82 .driver_features =
86 DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | 83 DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
@@ -151,7 +148,7 @@ MODULE_LICENSE("GPL and additional rights");
151 * \returns 148 * \returns
152 * If the device is a PCI G450, zero is returned. Otherwise 2 is returned. 149 * If the device is a PCI G450, zero is returned. Otherwise 2 is returned.
153 */ 150 */
154int mga_driver_device_is_agp(drm_device_t * dev) 151static int mga_driver_device_is_agp(drm_device_t * dev)
155{ 152{
156 const struct pci_dev *const pdev = dev->pdev; 153 const struct pci_dev *const pdev = dev->pdev;
157 154
diff --git a/drivers/char/drm/mga_drv.h b/drivers/char/drm/mga_drv.h
index 05f0f913dedd..474853deecfa 100644
--- a/drivers/char/drm/mga_drv.h
+++ b/drivers/char/drm/mga_drv.h
@@ -148,6 +148,9 @@ typedef struct drm_mga_private {
148 unsigned int agp_pages; 148 unsigned int agp_pages;
149} drm_mga_private_t; 149} drm_mga_private_t;
150 150
151extern drm_ioctl_desc_t mga_ioctls[];
152extern int mga_max_ioctl;
153
151 /* mga_dma.c */ 154 /* mga_dma.c */
152extern int mga_driver_preinit(drm_device_t * dev, unsigned long flags); 155extern int mga_driver_preinit(drm_device_t * dev, unsigned long flags);
153extern int mga_dma_bootstrap(DRM_IOCTL_ARGS); 156extern int mga_dma_bootstrap(DRM_IOCTL_ARGS);
diff --git a/drivers/char/drm/r128_drv.c b/drivers/char/drm/r128_drv.c
index 4d9224645f04..1661e7351402 100644
--- a/drivers/char/drm/r128_drv.c
+++ b/drivers/char/drm/r128_drv.c
@@ -66,9 +66,6 @@ static struct pci_device_id pciidlist[] = {
66 r128_PCI_IDS 66 r128_PCI_IDS
67}; 67};
68 68
69extern drm_ioctl_desc_t r128_ioctls[];
70extern int r128_max_ioctl;
71
72static struct drm_driver driver = { 69static struct drm_driver driver = {
73 .driver_features = 70 .driver_features =
74 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | 71 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 87c5e1381ba2..5c79e40eb88f 100644
--- a/drivers/char/drm/r128_drv.h
+++ b/drivers/char/drm/r128_drv.h
@@ -128,6 +128,9 @@ typedef struct drm_r128_buf_priv {
128 drm_r128_freelist_t *list_entry; 128 drm_r128_freelist_t *list_entry;
129} drm_r128_buf_priv_t; 129} drm_r128_buf_priv_t;
130 130
131extern drm_ioctl_desc_t r128_ioctls[];
132extern int r128_max_ioctl;
133
131 /* r128_cce.c */ 134 /* r128_cce.c */
132extern int r128_cce_init(DRM_IOCTL_ARGS); 135extern int r128_cce_init(DRM_IOCTL_ARGS);
133extern int r128_cce_start(DRM_IOCTL_ARGS); 136extern int r128_cce_start(DRM_IOCTL_ARGS);
diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c
index aa66f46279e7..3a1ac5f78b43 100644
--- a/drivers/char/drm/r300_cmdbuf.c
+++ b/drivers/char/drm/r300_cmdbuf.c
@@ -53,7 +53,7 @@ static const int r300_cliprect_cntl[4] = {
53 * buffer, starting with index n. 53 * buffer, starting with index n.
54 */ 54 */
55static int r300_emit_cliprects(drm_radeon_private_t * dev_priv, 55static int r300_emit_cliprects(drm_radeon_private_t * dev_priv,
56 drm_radeon_cmd_buffer_t * cmdbuf, int n) 56 drm_radeon_kcmd_buffer_t * cmdbuf, int n)
57{ 57{
58 drm_clip_rect_t box; 58 drm_clip_rect_t box;
59 int nr; 59 int nr;
@@ -131,7 +131,7 @@ static int r300_emit_cliprects(drm_radeon_private_t * dev_priv,
131 return 0; 131 return 0;
132} 132}
133 133
134u8 r300_reg_flags[0x10000 >> 2]; 134static u8 r300_reg_flags[0x10000 >> 2];
135 135
136void r300_init_reg_flags(void) 136void r300_init_reg_flags(void)
137{ 137{
@@ -260,7 +260,7 @@ static __inline__ int r300_check_offset(drm_radeon_private_t * dev_priv,
260 260
261static __inline__ int r300_emit_carefully_checked_packet0(drm_radeon_private_t * 261static __inline__ int r300_emit_carefully_checked_packet0(drm_radeon_private_t *
262 dev_priv, 262 dev_priv,
263 drm_radeon_cmd_buffer_t 263 drm_radeon_kcmd_buffer_t
264 * cmdbuf, 264 * cmdbuf,
265 drm_r300_cmd_header_t 265 drm_r300_cmd_header_t
266 header) 266 header)
@@ -281,7 +281,7 @@ static __inline__ int r300_emit_carefully_checked_packet0(drm_radeon_private_t *
281 return DRM_ERR(EINVAL); 281 return DRM_ERR(EINVAL);
282 } 282 }
283 for (i = 0; i < sz; i++) { 283 for (i = 0; i < sz; i++) {
284 values[i] = ((int __user *)cmdbuf->buf)[i]; 284 values[i] = ((int *)cmdbuf->buf)[i];
285 switch (r300_reg_flags[(reg >> 2) + i]) { 285 switch (r300_reg_flags[(reg >> 2) + i]) {
286 case MARK_SAFE: 286 case MARK_SAFE:
287 break; 287 break;
@@ -318,7 +318,7 @@ static __inline__ int r300_emit_carefully_checked_packet0(drm_radeon_private_t *
318 * Note that checks are performed on contents and addresses of the registers 318 * Note that checks are performed on contents and addresses of the registers
319 */ 319 */
320static __inline__ int r300_emit_packet0(drm_radeon_private_t * dev_priv, 320static __inline__ int r300_emit_packet0(drm_radeon_private_t * dev_priv,
321 drm_radeon_cmd_buffer_t * cmdbuf, 321 drm_radeon_kcmd_buffer_t * cmdbuf,
322 drm_r300_cmd_header_t header) 322 drm_r300_cmd_header_t header)
323{ 323{
324 int reg; 324 int reg;
@@ -349,7 +349,7 @@ static __inline__ int r300_emit_packet0(drm_radeon_private_t * dev_priv,
349 349
350 BEGIN_RING(1 + sz); 350 BEGIN_RING(1 + sz);
351 OUT_RING(CP_PACKET0(reg, sz - 1)); 351 OUT_RING(CP_PACKET0(reg, sz - 1));
352 OUT_RING_TABLE((int __user *)cmdbuf->buf, sz); 352 OUT_RING_TABLE((int *)cmdbuf->buf, sz);
353 ADVANCE_RING(); 353 ADVANCE_RING();
354 354
355 cmdbuf->buf += sz * 4; 355 cmdbuf->buf += sz * 4;
@@ -364,7 +364,7 @@ static __inline__ int r300_emit_packet0(drm_radeon_private_t * dev_priv,
364 * Called by r300_do_cp_cmdbuf. 364 * Called by r300_do_cp_cmdbuf.
365 */ 365 */
366static __inline__ int r300_emit_vpu(drm_radeon_private_t * dev_priv, 366static __inline__ int r300_emit_vpu(drm_radeon_private_t * dev_priv,
367 drm_radeon_cmd_buffer_t * cmdbuf, 367 drm_radeon_kcmd_buffer_t * cmdbuf,
368 drm_r300_cmd_header_t header) 368 drm_r300_cmd_header_t header)
369{ 369{
370 int sz; 370 int sz;
@@ -386,7 +386,7 @@ static __inline__ int r300_emit_vpu(drm_radeon_private_t * dev_priv,
386 OUT_RING_REG(R300_VAP_PVS_WAITIDLE, 0); 386 OUT_RING_REG(R300_VAP_PVS_WAITIDLE, 0);
387 OUT_RING_REG(R300_VAP_PVS_UPLOAD_ADDRESS, addr); 387 OUT_RING_REG(R300_VAP_PVS_UPLOAD_ADDRESS, addr);
388 OUT_RING(CP_PACKET0_TABLE(R300_VAP_PVS_UPLOAD_DATA, sz * 4 - 1)); 388 OUT_RING(CP_PACKET0_TABLE(R300_VAP_PVS_UPLOAD_DATA, sz * 4 - 1));
389 OUT_RING_TABLE((int __user *)cmdbuf->buf, sz * 4); 389 OUT_RING_TABLE((int *)cmdbuf->buf, sz * 4);
390 390
391 ADVANCE_RING(); 391 ADVANCE_RING();
392 392
@@ -401,7 +401,7 @@ static __inline__ int r300_emit_vpu(drm_radeon_private_t * dev_priv,
401 * Called by r300_emit_packet3. 401 * Called by r300_emit_packet3.
402 */ 402 */
403static __inline__ int r300_emit_clear(drm_radeon_private_t * dev_priv, 403static __inline__ int r300_emit_clear(drm_radeon_private_t * dev_priv,
404 drm_radeon_cmd_buffer_t * cmdbuf) 404 drm_radeon_kcmd_buffer_t * cmdbuf)
405{ 405{
406 RING_LOCALS; 406 RING_LOCALS;
407 407
@@ -412,7 +412,7 @@ static __inline__ int r300_emit_clear(drm_radeon_private_t * dev_priv,
412 OUT_RING(CP_PACKET3(R200_3D_DRAW_IMMD_2, 8)); 412 OUT_RING(CP_PACKET3(R200_3D_DRAW_IMMD_2, 8));
413 OUT_RING(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING | 413 OUT_RING(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING |
414 (1 << R300_PRIM_NUM_VERTICES_SHIFT)); 414 (1 << R300_PRIM_NUM_VERTICES_SHIFT));
415 OUT_RING_TABLE((int __user *)cmdbuf->buf, 8); 415 OUT_RING_TABLE((int *)cmdbuf->buf, 8);
416 ADVANCE_RING(); 416 ADVANCE_RING();
417 417
418 cmdbuf->buf += 8 * 4; 418 cmdbuf->buf += 8 * 4;
@@ -422,7 +422,7 @@ static __inline__ int r300_emit_clear(drm_radeon_private_t * dev_priv,
422} 422}
423 423
424static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t * dev_priv, 424static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t * dev_priv,
425 drm_radeon_cmd_buffer_t * cmdbuf, 425 drm_radeon_kcmd_buffer_t * cmdbuf,
426 u32 header) 426 u32 header)
427{ 427{
428 int count, i, k; 428 int count, i, k;
@@ -490,7 +490,7 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t * dev_priv,
490} 490}
491 491
492static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t * dev_priv, 492static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t * dev_priv,
493 drm_radeon_cmd_buffer_t * cmdbuf) 493 drm_radeon_kcmd_buffer_t * cmdbuf)
494{ 494{
495 u32 header; 495 u32 header;
496 int count; 496 int count;
@@ -503,7 +503,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t * dev_priv,
503 We need to be smarter. */ 503 We need to be smarter. */
504 504
505 /* obtain first word - actual packet3 header */ 505 /* obtain first word - actual packet3 header */
506 header = *(u32 __user *) cmdbuf->buf; 506 header = *(u32 *) cmdbuf->buf;
507 507
508 /* Is it packet 3 ? */ 508 /* Is it packet 3 ? */
509 if ((header >> 30) != 0x3) { 509 if ((header >> 30) != 0x3) {
@@ -541,7 +541,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t * dev_priv,
541 541
542 BEGIN_RING(count + 2); 542 BEGIN_RING(count + 2);
543 OUT_RING(header); 543 OUT_RING(header);
544 OUT_RING_TABLE((int __user *)(cmdbuf->buf + 4), count + 1); 544 OUT_RING_TABLE((int *)(cmdbuf->buf + 4), count + 1);
545 ADVANCE_RING(); 545 ADVANCE_RING();
546 546
547 cmdbuf->buf += (count + 2) * 4; 547 cmdbuf->buf += (count + 2) * 4;
@@ -555,12 +555,12 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t * dev_priv,
555 * Called by r300_do_cp_cmdbuf. 555 * Called by r300_do_cp_cmdbuf.
556 */ 556 */
557static __inline__ int r300_emit_packet3(drm_radeon_private_t * dev_priv, 557static __inline__ int r300_emit_packet3(drm_radeon_private_t * dev_priv,
558 drm_radeon_cmd_buffer_t * cmdbuf, 558 drm_radeon_kcmd_buffer_t * cmdbuf,
559 drm_r300_cmd_header_t header) 559 drm_r300_cmd_header_t header)
560{ 560{
561 int n; 561 int n;
562 int ret; 562 int ret;
563 char __user *orig_buf = cmdbuf->buf; 563 char *orig_buf = cmdbuf->buf;
564 int orig_bufsz = cmdbuf->bufsz; 564 int orig_bufsz = cmdbuf->bufsz;
565 565
566 /* This is a do-while-loop so that we run the interior at least once, 566 /* This is a do-while-loop so that we run the interior at least once,
@@ -659,7 +659,7 @@ static void r300_discard_buffer(drm_device_t * dev, drm_buf_t * buf)
659 */ 659 */
660int r300_do_cp_cmdbuf(drm_device_t * dev, 660int r300_do_cp_cmdbuf(drm_device_t * dev,
661 DRMFILE filp, 661 DRMFILE filp,
662 drm_file_t * filp_priv, drm_radeon_cmd_buffer_t * cmdbuf) 662 drm_file_t * filp_priv, drm_radeon_kcmd_buffer_t * cmdbuf)
663{ 663{
664 drm_radeon_private_t *dev_priv = dev->dev_private; 664 drm_radeon_private_t *dev_priv = dev->dev_private;
665 drm_device_dma_t *dma = dev->dma; 665 drm_device_dma_t *dma = dev->dma;
diff --git a/drivers/char/drm/radeon_drv.c b/drivers/char/drm/radeon_drv.c
index 7074d01ed1dd..ee49670d8162 100644
--- a/drivers/char/drm/radeon_drv.c
+++ b/drivers/char/drm/radeon_drv.c
@@ -71,9 +71,6 @@ static struct pci_device_id pciidlist[] = {
71 radeon_PCI_IDS 71 radeon_PCI_IDS
72}; 72};
73 73
74extern drm_ioctl_desc_t radeon_ioctls[];
75extern int radeon_max_ioctl;
76
77static struct drm_driver driver = { 74static struct drm_driver driver = {
78 .driver_features = 75 .driver_features =
79 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG | 76 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 3c7473488665..120ee5a8ebcc 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -281,7 +281,17 @@ typedef struct drm_radeon_buf_priv {
281 u32 age; 281 u32 age;
282} drm_radeon_buf_priv_t; 282} drm_radeon_buf_priv_t;
283 283
284typedef struct drm_radeon_kcmd_buffer {
285 int bufsz;
286 char *buf;
287 int nbox;
288 drm_clip_rect_t __user *boxes;
289} drm_radeon_kcmd_buffer_t;
290
284extern int radeon_no_wb; 291extern int radeon_no_wb;
292extern drm_ioctl_desc_t radeon_ioctls[];
293extern int radeon_max_ioctl;
294
285 /* radeon_cp.c */ 295 /* radeon_cp.c */
286extern int radeon_cp_init(DRM_IOCTL_ARGS); 296extern int radeon_cp_init(DRM_IOCTL_ARGS);
287extern int radeon_cp_start(DRM_IOCTL_ARGS); 297extern int radeon_cp_start(DRM_IOCTL_ARGS);
@@ -340,7 +350,7 @@ extern void r300_init_reg_flags(void);
340 350
341extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp, 351extern int r300_do_cp_cmdbuf(drm_device_t * dev, DRMFILE filp,
342 drm_file_t * filp_priv, 352 drm_file_t * filp_priv,
343 drm_radeon_cmd_buffer_t * cmdbuf); 353 drm_radeon_kcmd_buffer_t * cmdbuf);
344 354
345/* Flags for stats.boxes 355/* Flags for stats.boxes
346 */ 356 */
diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c
index 2eae60bd340f..231ac1438c69 100644
--- a/drivers/char/drm/radeon_state.c
+++ b/drivers/char/drm/radeon_state.c
@@ -40,7 +40,7 @@
40static __inline__ int radeon_check_and_fixup_offset(drm_radeon_private_t * 40static __inline__ int radeon_check_and_fixup_offset(drm_radeon_private_t *
41 dev_priv, 41 dev_priv,
42 drm_file_t * filp_priv, 42 drm_file_t * filp_priv,
43 u32 * offset) 43 u32 *offset)
44{ 44{
45 u32 off = *offset; 45 u32 off = *offset;
46 struct drm_radeon_driver_file_fields *radeon_priv; 46 struct drm_radeon_driver_file_fields *radeon_priv;
@@ -66,7 +66,7 @@ static __inline__ int radeon_check_and_fixup_offset(drm_radeon_private_t *
66static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * 66static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t *
67 dev_priv, 67 dev_priv,
68 drm_file_t * filp_priv, 68 drm_file_t * filp_priv,
69 int id, u32 __user * data) 69 int id, u32 *data)
70{ 70{
71 switch (id) { 71 switch (id) {
72 72
@@ -240,8 +240,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t *
240static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * 240static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t *
241 dev_priv, 241 dev_priv,
242 drm_file_t * filp_priv, 242 drm_file_t * filp_priv,
243 drm_radeon_cmd_buffer_t * 243 drm_radeon_kcmd_buffer_t *cmdbuf,
244 cmdbuf,
245 unsigned int *cmdsz) 244 unsigned int *cmdsz)
246{ 245{
247 u32 *cmd = (u32 *) cmdbuf->buf; 246 u32 *cmd = (u32 *) cmdbuf->buf;
@@ -2564,7 +2563,7 @@ static int radeon_cp_vertex2(DRM_IOCTL_ARGS)
2564static int radeon_emit_packets(drm_radeon_private_t * dev_priv, 2563static int radeon_emit_packets(drm_radeon_private_t * dev_priv,
2565 drm_file_t * filp_priv, 2564 drm_file_t * filp_priv,
2566 drm_radeon_cmd_header_t header, 2565 drm_radeon_cmd_header_t header,
2567 drm_radeon_cmd_buffer_t * cmdbuf) 2566 drm_radeon_kcmd_buffer_t *cmdbuf)
2568{ 2567{
2569 int id = (int)header.packet.packet_id; 2568 int id = (int)header.packet.packet_id;
2570 int sz, reg; 2569 int sz, reg;
@@ -2599,7 +2598,7 @@ static int radeon_emit_packets(drm_radeon_private_t * dev_priv,
2599 2598
2600static __inline__ int radeon_emit_scalars(drm_radeon_private_t * dev_priv, 2599static __inline__ int radeon_emit_scalars(drm_radeon_private_t * dev_priv,
2601 drm_radeon_cmd_header_t header, 2600 drm_radeon_cmd_header_t header,
2602 drm_radeon_cmd_buffer_t * cmdbuf) 2601 drm_radeon_kcmd_buffer_t * cmdbuf)
2603{ 2602{
2604 int sz = header.scalars.count; 2603 int sz = header.scalars.count;
2605 int start = header.scalars.offset; 2604 int start = header.scalars.offset;
@@ -2621,7 +2620,7 @@ static __inline__ int radeon_emit_scalars(drm_radeon_private_t * dev_priv,
2621 */ 2620 */
2622static __inline__ int radeon_emit_scalars2(drm_radeon_private_t * dev_priv, 2621static __inline__ int radeon_emit_scalars2(drm_radeon_private_t * dev_priv,
2623 drm_radeon_cmd_header_t header, 2622 drm_radeon_cmd_header_t header,
2624 drm_radeon_cmd_buffer_t * cmdbuf) 2623 drm_radeon_kcmd_buffer_t * cmdbuf)
2625{ 2624{
2626 int sz = header.scalars.count; 2625 int sz = header.scalars.count;
2627 int start = ((unsigned int)header.scalars.offset) + 0x100; 2626 int start = ((unsigned int)header.scalars.offset) + 0x100;
@@ -2641,7 +2640,7 @@ static __inline__ int radeon_emit_scalars2(drm_radeon_private_t * dev_priv,
2641 2640
2642static __inline__ int radeon_emit_vectors(drm_radeon_private_t * dev_priv, 2641static __inline__ int radeon_emit_vectors(drm_radeon_private_t * dev_priv,
2643 drm_radeon_cmd_header_t header, 2642 drm_radeon_cmd_header_t header,
2644 drm_radeon_cmd_buffer_t * cmdbuf) 2643 drm_radeon_kcmd_buffer_t * cmdbuf)
2645{ 2644{
2646 int sz = header.vectors.count; 2645 int sz = header.vectors.count;
2647 int start = header.vectors.offset; 2646 int start = header.vectors.offset;
@@ -2662,7 +2661,7 @@ static __inline__ int radeon_emit_vectors(drm_radeon_private_t * dev_priv,
2662 2661
2663static int radeon_emit_packet3(drm_device_t * dev, 2662static int radeon_emit_packet3(drm_device_t * dev,
2664 drm_file_t * filp_priv, 2663 drm_file_t * filp_priv,
2665 drm_radeon_cmd_buffer_t * cmdbuf) 2664 drm_radeon_kcmd_buffer_t *cmdbuf)
2666{ 2665{
2667 drm_radeon_private_t *dev_priv = dev->dev_private; 2666 drm_radeon_private_t *dev_priv = dev->dev_private;
2668 unsigned int cmdsz; 2667 unsigned int cmdsz;
@@ -2688,7 +2687,7 @@ static int radeon_emit_packet3(drm_device_t * dev,
2688 2687
2689static int radeon_emit_packet3_cliprect(drm_device_t * dev, 2688static int radeon_emit_packet3_cliprect(drm_device_t * dev,
2690 drm_file_t * filp_priv, 2689 drm_file_t * filp_priv,
2691 drm_radeon_cmd_buffer_t * cmdbuf, 2690 drm_radeon_kcmd_buffer_t *cmdbuf,
2692 int orig_nbox) 2691 int orig_nbox)
2693{ 2692{
2694 drm_radeon_private_t *dev_priv = dev->dev_private; 2693 drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -2785,7 +2784,7 @@ static int radeon_cp_cmdbuf(DRM_IOCTL_ARGS)
2785 drm_device_dma_t *dma = dev->dma; 2784 drm_device_dma_t *dma = dev->dma;
2786 drm_buf_t *buf = NULL; 2785 drm_buf_t *buf = NULL;
2787 int idx; 2786 int idx;
2788 drm_radeon_cmd_buffer_t cmdbuf; 2787 drm_radeon_kcmd_buffer_t cmdbuf;
2789 drm_radeon_cmd_header_t header; 2788 drm_radeon_cmd_header_t header;
2790 int orig_nbox, orig_bufsz; 2789 int orig_nbox, orig_bufsz;
2791 char *kbuf = NULL; 2790 char *kbuf = NULL;
@@ -2819,7 +2818,7 @@ static int radeon_cp_cmdbuf(DRM_IOCTL_ARGS)
2819 kbuf = drm_alloc(cmdbuf.bufsz, DRM_MEM_DRIVER); 2818 kbuf = drm_alloc(cmdbuf.bufsz, DRM_MEM_DRIVER);
2820 if (kbuf == NULL) 2819 if (kbuf == NULL)
2821 return DRM_ERR(ENOMEM); 2820 return DRM_ERR(ENOMEM);
2822 if (DRM_COPY_FROM_USER(kbuf, cmdbuf.buf, cmdbuf.bufsz)) { 2821 if (DRM_COPY_FROM_USER(kbuf, (void __user *)cmdbuf.buf, cmdbuf.bufsz)) {
2823 drm_free(kbuf, orig_bufsz, DRM_MEM_DRIVER); 2822 drm_free(kbuf, orig_bufsz, DRM_MEM_DRIVER);
2824 return DRM_ERR(EFAULT); 2823 return DRM_ERR(EFAULT);
2825 } 2824 }
diff --git a/drivers/char/drm/savage_drv.c b/drivers/char/drm/savage_drv.c
index 0906f9a5d8f9..22d799cde41c 100644
--- a/drivers/char/drm/savage_drv.c
+++ b/drivers/char/drm/savage_drv.c
@@ -59,9 +59,6 @@ static struct pci_device_id pciidlist[] = {
59 savage_PCI_IDS 59 savage_PCI_IDS
60}; 60};
61 61
62extern drm_ioctl_desc_t savage_ioctls[];
63extern int savage_max_ioctl;
64
65static struct drm_driver driver = { 62static struct drm_driver driver = {
66 .driver_features = 63 .driver_features =
67 DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_DMA | DRIVER_PCI_DMA, 64 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 358f4fb2712a..a4b0fa998a95 100644
--- a/drivers/char/drm/savage_drv.h
+++ b/drivers/char/drm/savage_drv.h
@@ -104,6 +104,9 @@ enum savage_family {
104 S3_LAST 104 S3_LAST
105}; 105};
106 106
107extern drm_ioctl_desc_t savage_ioctls[];
108extern int savage_max_ioctl;
109
107#define S3_SAVAGE3D_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX)) 110#define S3_SAVAGE3D_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX))
108 111
109#define S3_SAVAGE4_SERIES(chip) ((chip==S3_SAVAGE4) \ 112#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 39654cb5d570..e87a5d59b99c 100644
--- a/drivers/char/drm/savage_state.c
+++ b/drivers/char/drm/savage_state.c
@@ -816,10 +816,8 @@ static int savage_dispatch_clear(drm_savage_private_t * dev_priv,
816 if (nbox == 0) 816 if (nbox == 0)
817 return 0; 817 return 0;
818 818
819 DRM_GET_USER_UNCHECKED(mask, &((const drm_savage_cmd_header_t *)data) 819 DRM_GET_USER_UNCHECKED(mask, &data->clear1.mask);
820 ->clear1.mask); 820 DRM_GET_USER_UNCHECKED(value, &data->clear1.value);
821 DRM_GET_USER_UNCHECKED(value, &((const drm_savage_cmd_header_t *)data)
822 ->clear1.value);
823 821
824 clear_cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | 822 clear_cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
825 BCI_CMD_SEND_COLOR | BCI_CMD_DEST_PBD_NEW; 823 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 6d0cb2226005..3cef10643a8f 100644
--- a/drivers/char/drm/sis_drv.c
+++ b/drivers/char/drm/sis_drv.c
@@ -61,9 +61,6 @@ static struct pci_device_id pciidlist[] = {
61 sisdrv_PCI_IDS 61 sisdrv_PCI_IDS
62}; 62};
63 63
64extern drm_ioctl_desc_t sis_ioctls[];
65extern int sis_max_ioctl;
66
67static struct drm_driver driver = { 64static struct drm_driver driver = {
68 .driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR, 65 .driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR,
69 .context_ctor = sis_init_context, 66 .context_ctor = sis_init_context,
diff --git a/drivers/char/drm/sis_drv.h b/drivers/char/drm/sis_drv.h
index 4ef3d6226418..b1fddad83a93 100644
--- a/drivers/char/drm/sis_drv.h
+++ b/drivers/char/drm/sis_drv.h
@@ -49,4 +49,7 @@ typedef struct drm_sis_private {
49extern int sis_init_context(drm_device_t * dev, int context); 49extern int sis_init_context(drm_device_t * dev, int context);
50extern int sis_final_context(drm_device_t * dev, int context); 50extern int sis_final_context(drm_device_t * dev, int context);
51 51
52extern drm_ioctl_desc_t sis_ioctls[];
53extern int sis_max_ioctl;
54
52#endif 55#endif
diff --git a/drivers/char/drm/via_drv.h b/drivers/char/drm/via_drv.h
index d902dc2f4fae..7d5daf43797e 100644
--- a/drivers/char/drm/via_drv.h
+++ b/drivers/char/drm/via_drv.h
@@ -112,4 +112,7 @@ extern void via_init_futex(drm_via_private_t * dev_priv);
112extern void via_cleanup_futex(drm_via_private_t * dev_priv); 112extern void via_cleanup_futex(drm_via_private_t * dev_priv);
113extern void via_release_futex(drm_via_private_t * dev_priv, int context); 113extern void via_release_futex(drm_via_private_t * dev_priv, int context);
114 114
115extern int via_parse_command_stream(drm_device_t * dev, const uint32_t * buf,
116 unsigned int size);
117
115#endif 118#endif