diff options
Diffstat (limited to 'drivers/char/drm/i915_dma.c')
-rw-r--r-- | drivers/char/drm/i915_dma.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c index 8e7d713a5a15..a7566ff1a3ea 100644 --- a/drivers/char/drm/i915_dma.c +++ b/drivers/char/drm/i915_dma.c | |||
@@ -70,7 +70,7 @@ int i915_wait_ring(struct drm_device * dev, int n, const char *caller) | |||
70 | last_head = ring->head; | 70 | last_head = ring->head; |
71 | } | 71 | } |
72 | 72 | ||
73 | return DRM_ERR(EBUSY); | 73 | return -EBUSY; |
74 | } | 74 | } |
75 | 75 | ||
76 | void i915_kernel_lost_context(struct drm_device * dev) | 76 | void i915_kernel_lost_context(struct drm_device * dev) |
@@ -137,7 +137,7 @@ static int i915_initialize(struct drm_device * dev, | |||
137 | DRM_ERROR("can not find sarea!\n"); | 137 | DRM_ERROR("can not find sarea!\n"); |
138 | dev->dev_private = (void *)dev_priv; | 138 | dev->dev_private = (void *)dev_priv; |
139 | i915_dma_cleanup(dev); | 139 | i915_dma_cleanup(dev); |
140 | return DRM_ERR(EINVAL); | 140 | return -EINVAL; |
141 | } | 141 | } |
142 | 142 | ||
143 | dev_priv->mmio_map = drm_core_findmap(dev, init->mmio_offset); | 143 | dev_priv->mmio_map = drm_core_findmap(dev, init->mmio_offset); |
@@ -145,7 +145,7 @@ static int i915_initialize(struct drm_device * dev, | |||
145 | dev->dev_private = (void *)dev_priv; | 145 | dev->dev_private = (void *)dev_priv; |
146 | i915_dma_cleanup(dev); | 146 | i915_dma_cleanup(dev); |
147 | DRM_ERROR("can not find mmio map!\n"); | 147 | DRM_ERROR("can not find mmio map!\n"); |
148 | return DRM_ERR(EINVAL); | 148 | return -EINVAL; |
149 | } | 149 | } |
150 | 150 | ||
151 | dev_priv->sarea_priv = (drm_i915_sarea_t *) | 151 | dev_priv->sarea_priv = (drm_i915_sarea_t *) |
@@ -169,7 +169,7 @@ static int i915_initialize(struct drm_device * dev, | |||
169 | i915_dma_cleanup(dev); | 169 | i915_dma_cleanup(dev); |
170 | DRM_ERROR("can not ioremap virtual address for" | 170 | DRM_ERROR("can not ioremap virtual address for" |
171 | " ring buffer\n"); | 171 | " ring buffer\n"); |
172 | return DRM_ERR(ENOMEM); | 172 | return -ENOMEM; |
173 | } | 173 | } |
174 | 174 | ||
175 | dev_priv->ring.virtual_start = dev_priv->ring.map.handle; | 175 | dev_priv->ring.virtual_start = dev_priv->ring.map.handle; |
@@ -200,7 +200,7 @@ static int i915_initialize(struct drm_device * dev, | |||
200 | dev->dev_private = (void *)dev_priv; | 200 | dev->dev_private = (void *)dev_priv; |
201 | i915_dma_cleanup(dev); | 201 | i915_dma_cleanup(dev); |
202 | DRM_ERROR("Can not allocate hardware status page\n"); | 202 | DRM_ERROR("Can not allocate hardware status page\n"); |
203 | return DRM_ERR(ENOMEM); | 203 | return -ENOMEM; |
204 | } | 204 | } |
205 | dev_priv->hw_status_page = dev_priv->status_page_dmah->vaddr; | 205 | dev_priv->hw_status_page = dev_priv->status_page_dmah->vaddr; |
206 | dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr; | 206 | dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr; |
@@ -221,24 +221,24 @@ static int i915_dma_resume(struct drm_device * dev) | |||
221 | 221 | ||
222 | if (!dev_priv->sarea) { | 222 | if (!dev_priv->sarea) { |
223 | DRM_ERROR("can not find sarea!\n"); | 223 | DRM_ERROR("can not find sarea!\n"); |
224 | return DRM_ERR(EINVAL); | 224 | return -EINVAL; |
225 | } | 225 | } |
226 | 226 | ||
227 | if (!dev_priv->mmio_map) { | 227 | if (!dev_priv->mmio_map) { |
228 | DRM_ERROR("can not find mmio map!\n"); | 228 | DRM_ERROR("can not find mmio map!\n"); |
229 | return DRM_ERR(EINVAL); | 229 | return -EINVAL; |
230 | } | 230 | } |
231 | 231 | ||
232 | if (dev_priv->ring.map.handle == NULL) { | 232 | if (dev_priv->ring.map.handle == NULL) { |
233 | DRM_ERROR("can not ioremap virtual address for" | 233 | DRM_ERROR("can not ioremap virtual address for" |
234 | " ring buffer\n"); | 234 | " ring buffer\n"); |
235 | return DRM_ERR(ENOMEM); | 235 | return -ENOMEM; |
236 | } | 236 | } |
237 | 237 | ||
238 | /* Program Hardware Status Page */ | 238 | /* Program Hardware Status Page */ |
239 | if (!dev_priv->hw_status_page) { | 239 | if (!dev_priv->hw_status_page) { |
240 | DRM_ERROR("Can not find hardware status page\n"); | 240 | DRM_ERROR("Can not find hardware status page\n"); |
241 | return DRM_ERR(EINVAL); | 241 | return -EINVAL; |
242 | } | 242 | } |
243 | DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page); | 243 | DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page); |
244 | 244 | ||
@@ -266,7 +266,7 @@ static int i915_dma_init(DRM_IOCTL_ARGS) | |||
266 | dev_priv = drm_alloc(sizeof(drm_i915_private_t), | 266 | dev_priv = drm_alloc(sizeof(drm_i915_private_t), |
267 | DRM_MEM_DRIVER); | 267 | DRM_MEM_DRIVER); |
268 | if (dev_priv == NULL) | 268 | if (dev_priv == NULL) |
269 | return DRM_ERR(ENOMEM); | 269 | return -ENOMEM; |
270 | retcode = i915_initialize(dev, dev_priv, &init); | 270 | retcode = i915_initialize(dev, dev_priv, &init); |
271 | break; | 271 | break; |
272 | case I915_CLEANUP_DMA: | 272 | case I915_CLEANUP_DMA: |
@@ -276,7 +276,7 @@ static int i915_dma_init(DRM_IOCTL_ARGS) | |||
276 | retcode = i915_dma_resume(dev); | 276 | retcode = i915_dma_resume(dev); |
277 | break; | 277 | break; |
278 | default: | 278 | default: |
279 | retcode = DRM_ERR(EINVAL); | 279 | retcode = -EINVAL; |
280 | break; | 280 | break; |
281 | } | 281 | } |
282 | 282 | ||
@@ -366,7 +366,7 @@ static int i915_emit_cmds(struct drm_device * dev, int __user * buffer, int dwor | |||
366 | RING_LOCALS; | 366 | RING_LOCALS; |
367 | 367 | ||
368 | if ((dwords+1) * sizeof(int) >= dev_priv->ring.Size - 8) | 368 | if ((dwords+1) * sizeof(int) >= dev_priv->ring.Size - 8) |
369 | return DRM_ERR(EINVAL); | 369 | return -EINVAL; |
370 | 370 | ||
371 | BEGIN_LP_RING((dwords+1)&~1); | 371 | BEGIN_LP_RING((dwords+1)&~1); |
372 | 372 | ||
@@ -374,17 +374,17 @@ static int i915_emit_cmds(struct drm_device * dev, int __user * buffer, int dwor | |||
374 | int cmd, sz; | 374 | int cmd, sz; |
375 | 375 | ||
376 | if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], sizeof(cmd))) | 376 | if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], sizeof(cmd))) |
377 | return DRM_ERR(EINVAL); | 377 | return -EINVAL; |
378 | 378 | ||
379 | if ((sz = validate_cmd(cmd)) == 0 || i + sz > dwords) | 379 | if ((sz = validate_cmd(cmd)) == 0 || i + sz > dwords) |
380 | return DRM_ERR(EINVAL); | 380 | return -EINVAL; |
381 | 381 | ||
382 | OUT_RING(cmd); | 382 | OUT_RING(cmd); |
383 | 383 | ||
384 | while (++i, --sz) { | 384 | while (++i, --sz) { |
385 | if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], | 385 | if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], |
386 | sizeof(cmd))) { | 386 | sizeof(cmd))) { |
387 | return DRM_ERR(EINVAL); | 387 | return -EINVAL; |
388 | } | 388 | } |
389 | OUT_RING(cmd); | 389 | OUT_RING(cmd); |
390 | } | 390 | } |
@@ -407,13 +407,13 @@ static int i915_emit_box(struct drm_device * dev, | |||
407 | RING_LOCALS; | 407 | RING_LOCALS; |
408 | 408 | ||
409 | if (DRM_COPY_FROM_USER_UNCHECKED(&box, &boxes[i], sizeof(box))) { | 409 | if (DRM_COPY_FROM_USER_UNCHECKED(&box, &boxes[i], sizeof(box))) { |
410 | return DRM_ERR(EFAULT); | 410 | return -EFAULT; |
411 | } | 411 | } |
412 | 412 | ||
413 | if (box.y2 <= box.y1 || box.x2 <= box.x1 || box.y2 <= 0 || box.x2 <= 0) { | 413 | if (box.y2 <= box.y1 || box.x2 <= box.x1 || box.y2 <= 0 || box.x2 <= 0) { |
414 | DRM_ERROR("Bad box %d,%d..%d,%d\n", | 414 | DRM_ERROR("Bad box %d,%d..%d,%d\n", |
415 | box.x1, box.y1, box.x2, box.y2); | 415 | box.x1, box.y1, box.x2, box.y2); |
416 | return DRM_ERR(EINVAL); | 416 | return -EINVAL; |
417 | } | 417 | } |
418 | 418 | ||
419 | if (IS_I965G(dev)) { | 419 | if (IS_I965G(dev)) { |
@@ -467,7 +467,7 @@ static int i915_dispatch_cmdbuffer(struct drm_device * dev, | |||
467 | 467 | ||
468 | if (cmd->sz & 0x3) { | 468 | if (cmd->sz & 0x3) { |
469 | DRM_ERROR("alignment"); | 469 | DRM_ERROR("alignment"); |
470 | return DRM_ERR(EINVAL); | 470 | return -EINVAL; |
471 | } | 471 | } |
472 | 472 | ||
473 | i915_kernel_lost_context(dev); | 473 | i915_kernel_lost_context(dev); |
@@ -502,7 +502,7 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev, | |||
502 | 502 | ||
503 | if ((batch->start | batch->used) & 0x7) { | 503 | if ((batch->start | batch->used) & 0x7) { |
504 | DRM_ERROR("alignment"); | 504 | DRM_ERROR("alignment"); |
505 | return DRM_ERR(EINVAL); | 505 | return -EINVAL; |
506 | } | 506 | } |
507 | 507 | ||
508 | i915_kernel_lost_context(dev); | 508 | i915_kernel_lost_context(dev); |
@@ -619,7 +619,7 @@ static int i915_batchbuffer(DRM_IOCTL_ARGS) | |||
619 | 619 | ||
620 | if (!dev_priv->allow_batchbuffer) { | 620 | if (!dev_priv->allow_batchbuffer) { |
621 | DRM_ERROR("Batchbuffer ioctl disabled\n"); | 621 | DRM_ERROR("Batchbuffer ioctl disabled\n"); |
622 | return DRM_ERR(EINVAL); | 622 | return -EINVAL; |
623 | } | 623 | } |
624 | 624 | ||
625 | DRM_COPY_FROM_USER_IOCTL(batch, (drm_i915_batchbuffer_t __user *) data, | 625 | DRM_COPY_FROM_USER_IOCTL(batch, (drm_i915_batchbuffer_t __user *) data, |
@@ -633,7 +633,7 @@ static int i915_batchbuffer(DRM_IOCTL_ARGS) | |||
633 | if (batch.num_cliprects && DRM_VERIFYAREA_READ(batch.cliprects, | 633 | if (batch.num_cliprects && DRM_VERIFYAREA_READ(batch.cliprects, |
634 | batch.num_cliprects * | 634 | batch.num_cliprects * |
635 | sizeof(struct drm_clip_rect))) | 635 | sizeof(struct drm_clip_rect))) |
636 | return DRM_ERR(EFAULT); | 636 | return -EFAULT; |
637 | 637 | ||
638 | ret = i915_dispatch_batchbuffer(dev, &batch); | 638 | ret = i915_dispatch_batchbuffer(dev, &batch); |
639 | 639 | ||
@@ -664,7 +664,7 @@ static int i915_cmdbuffer(DRM_IOCTL_ARGS) | |||
664 | cmdbuf.num_cliprects * | 664 | cmdbuf.num_cliprects * |
665 | sizeof(struct drm_clip_rect))) { | 665 | sizeof(struct drm_clip_rect))) { |
666 | DRM_ERROR("Fault accessing cliprects\n"); | 666 | DRM_ERROR("Fault accessing cliprects\n"); |
667 | return DRM_ERR(EFAULT); | 667 | return -EFAULT; |
668 | } | 668 | } |
669 | 669 | ||
670 | ret = i915_dispatch_cmdbuffer(dev, &cmdbuf); | 670 | ret = i915_dispatch_cmdbuffer(dev, &cmdbuf); |
@@ -697,7 +697,7 @@ static int i915_getparam(DRM_IOCTL_ARGS) | |||
697 | 697 | ||
698 | if (!dev_priv) { | 698 | if (!dev_priv) { |
699 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); | 699 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); |
700 | return DRM_ERR(EINVAL); | 700 | return -EINVAL; |
701 | } | 701 | } |
702 | 702 | ||
703 | DRM_COPY_FROM_USER_IOCTL(param, (drm_i915_getparam_t __user *) data, | 703 | DRM_COPY_FROM_USER_IOCTL(param, (drm_i915_getparam_t __user *) data, |
@@ -715,12 +715,12 @@ static int i915_getparam(DRM_IOCTL_ARGS) | |||
715 | break; | 715 | break; |
716 | default: | 716 | default: |
717 | DRM_ERROR("Unknown parameter %d\n", param.param); | 717 | DRM_ERROR("Unknown parameter %d\n", param.param); |
718 | return DRM_ERR(EINVAL); | 718 | return -EINVAL; |
719 | } | 719 | } |
720 | 720 | ||
721 | if (DRM_COPY_TO_USER(param.value, &value, sizeof(int))) { | 721 | if (DRM_COPY_TO_USER(param.value, &value, sizeof(int))) { |
722 | DRM_ERROR("DRM_COPY_TO_USER failed\n"); | 722 | DRM_ERROR("DRM_COPY_TO_USER failed\n"); |
723 | return DRM_ERR(EFAULT); | 723 | return -EFAULT; |
724 | } | 724 | } |
725 | 725 | ||
726 | return 0; | 726 | return 0; |
@@ -734,7 +734,7 @@ static int i915_setparam(DRM_IOCTL_ARGS) | |||
734 | 734 | ||
735 | if (!dev_priv) { | 735 | if (!dev_priv) { |
736 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); | 736 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); |
737 | return DRM_ERR(EINVAL); | 737 | return -EINVAL; |
738 | } | 738 | } |
739 | 739 | ||
740 | DRM_COPY_FROM_USER_IOCTL(param, (drm_i915_setparam_t __user *) data, | 740 | DRM_COPY_FROM_USER_IOCTL(param, (drm_i915_setparam_t __user *) data, |
@@ -753,7 +753,7 @@ static int i915_setparam(DRM_IOCTL_ARGS) | |||
753 | break; | 753 | break; |
754 | default: | 754 | default: |
755 | DRM_ERROR("unknown parameter %d\n", param.param); | 755 | DRM_ERROR("unknown parameter %d\n", param.param); |
756 | return DRM_ERR(EINVAL); | 756 | return -EINVAL; |
757 | } | 757 | } |
758 | 758 | ||
759 | return 0; | 759 | return 0; |
@@ -767,7 +767,7 @@ static int i915_set_status_page(DRM_IOCTL_ARGS) | |||
767 | 767 | ||
768 | if (!dev_priv) { | 768 | if (!dev_priv) { |
769 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); | 769 | DRM_ERROR("%s called with no initialization\n", __FUNCTION__); |
770 | return DRM_ERR(EINVAL); | 770 | return -EINVAL; |
771 | } | 771 | } |
772 | DRM_COPY_FROM_USER_IOCTL(hws, (drm_i915_hws_addr_t __user *) data, | 772 | DRM_COPY_FROM_USER_IOCTL(hws, (drm_i915_hws_addr_t __user *) data, |
773 | sizeof(hws)); | 773 | sizeof(hws)); |
@@ -788,7 +788,7 @@ static int i915_set_status_page(DRM_IOCTL_ARGS) | |||
788 | dev_priv->status_gfx_addr = 0; | 788 | dev_priv->status_gfx_addr = 0; |
789 | DRM_ERROR("can not ioremap virtual address for" | 789 | DRM_ERROR("can not ioremap virtual address for" |
790 | " G33 hw status page\n"); | 790 | " G33 hw status page\n"); |
791 | return DRM_ERR(ENOMEM); | 791 | return -ENOMEM; |
792 | } | 792 | } |
793 | dev_priv->hw_status_page = dev_priv->hws_map.handle; | 793 | dev_priv->hw_status_page = dev_priv->hws_map.handle; |
794 | 794 | ||