aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/r128_cce.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-08-25 05:22:43 -0400
committerDave Airlie <airlied@optimus.(none)>2007-10-14 20:38:19 -0400
commit20caafa6ecb2487d9b223aa33e7cc704f912a758 (patch)
tree7df033fdee81305dad0a67ceba79f51ead7c1b8b /drivers/char/drm/r128_cce.c
parent23fd50450a34f2558070ceabb0bfebc1c9604af5 (diff)
drm: Remove DRM_ERR OS macro.
This was used to make all ioctl handlers return -errno on linux and errno on *BSD. Instead, just return -errno in shared code, and flip sign on return f shared code to *BSD code. Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/r128_cce.c')
-rw-r--r--drivers/char/drm/r128_cce.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/drivers/char/drm/r128_cce.c b/drivers/char/drm/r128_cce.c
index b163ed09bd81..15e873627d53 100644
--- a/drivers/char/drm/r128_cce.c
+++ b/drivers/char/drm/r128_cce.c
@@ -129,7 +129,7 @@ static int r128_do_pixcache_flush(drm_r128_private_t * dev_priv)
129#if R128_FIFO_DEBUG 129#if R128_FIFO_DEBUG
130 DRM_ERROR("failed!\n"); 130 DRM_ERROR("failed!\n");
131#endif 131#endif
132 return DRM_ERR(EBUSY); 132 return -EBUSY;
133} 133}
134 134
135static int r128_do_wait_for_fifo(drm_r128_private_t * dev_priv, int entries) 135static int r128_do_wait_for_fifo(drm_r128_private_t * dev_priv, int entries)
@@ -146,7 +146,7 @@ static int r128_do_wait_for_fifo(drm_r128_private_t * dev_priv, int entries)
146#if R128_FIFO_DEBUG 146#if R128_FIFO_DEBUG
147 DRM_ERROR("failed!\n"); 147 DRM_ERROR("failed!\n");
148#endif 148#endif
149 return DRM_ERR(EBUSY); 149 return -EBUSY;
150} 150}
151 151
152static int r128_do_wait_for_idle(drm_r128_private_t * dev_priv) 152static int r128_do_wait_for_idle(drm_r128_private_t * dev_priv)
@@ -168,7 +168,7 @@ static int r128_do_wait_for_idle(drm_r128_private_t * dev_priv)
168#if R128_FIFO_DEBUG 168#if R128_FIFO_DEBUG
169 DRM_ERROR("failed!\n"); 169 DRM_ERROR("failed!\n");
170#endif 170#endif
171 return DRM_ERR(EBUSY); 171 return -EBUSY;
172} 172}
173 173
174/* ================================================================ 174/* ================================================================
@@ -227,7 +227,7 @@ int r128_do_cce_idle(drm_r128_private_t * dev_priv)
227 DRM_ERROR("failed!\n"); 227 DRM_ERROR("failed!\n");
228 r128_status(dev_priv); 228 r128_status(dev_priv);
229#endif 229#endif
230 return DRM_ERR(EBUSY); 230 return -EBUSY;
231} 231}
232 232
233/* Start the Concurrent Command Engine. 233/* Start the Concurrent Command Engine.
@@ -355,7 +355,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
355 355
356 dev_priv = drm_alloc(sizeof(drm_r128_private_t), DRM_MEM_DRIVER); 356 dev_priv = drm_alloc(sizeof(drm_r128_private_t), DRM_MEM_DRIVER);
357 if (dev_priv == NULL) 357 if (dev_priv == NULL)
358 return DRM_ERR(ENOMEM); 358 return -ENOMEM;
359 359
360 memset(dev_priv, 0, sizeof(drm_r128_private_t)); 360 memset(dev_priv, 0, sizeof(drm_r128_private_t));
361 361
@@ -365,7 +365,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
365 DRM_ERROR("PCI GART memory not allocated!\n"); 365 DRM_ERROR("PCI GART memory not allocated!\n");
366 dev->dev_private = (void *)dev_priv; 366 dev->dev_private = (void *)dev_priv;
367 r128_do_cleanup_cce(dev); 367 r128_do_cleanup_cce(dev);
368 return DRM_ERR(EINVAL); 368 return -EINVAL;
369 } 369 }
370 370
371 dev_priv->usec_timeout = init->usec_timeout; 371 dev_priv->usec_timeout = init->usec_timeout;
@@ -374,7 +374,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
374 DRM_DEBUG("TIMEOUT problem!\n"); 374 DRM_DEBUG("TIMEOUT problem!\n");
375 dev->dev_private = (void *)dev_priv; 375 dev->dev_private = (void *)dev_priv;
376 r128_do_cleanup_cce(dev); 376 r128_do_cleanup_cce(dev);
377 return DRM_ERR(EINVAL); 377 return -EINVAL;
378 } 378 }
379 379
380 dev_priv->cce_mode = init->cce_mode; 380 dev_priv->cce_mode = init->cce_mode;
@@ -394,7 +394,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
394 DRM_DEBUG("Bad cce_mode!\n"); 394 DRM_DEBUG("Bad cce_mode!\n");
395 dev->dev_private = (void *)dev_priv; 395 dev->dev_private = (void *)dev_priv;
396 r128_do_cleanup_cce(dev); 396 r128_do_cleanup_cce(dev);
397 return DRM_ERR(EINVAL); 397 return -EINVAL;
398 } 398 }
399 399
400 switch (init->cce_mode) { 400 switch (init->cce_mode) {
@@ -461,7 +461,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
461 DRM_ERROR("could not find sarea!\n"); 461 DRM_ERROR("could not find sarea!\n");
462 dev->dev_private = (void *)dev_priv; 462 dev->dev_private = (void *)dev_priv;
463 r128_do_cleanup_cce(dev); 463 r128_do_cleanup_cce(dev);
464 return DRM_ERR(EINVAL); 464 return -EINVAL;
465 } 465 }
466 466
467 dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); 467 dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset);
@@ -469,21 +469,21 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
469 DRM_ERROR("could not find mmio region!\n"); 469 DRM_ERROR("could not find mmio region!\n");
470 dev->dev_private = (void *)dev_priv; 470 dev->dev_private = (void *)dev_priv;
471 r128_do_cleanup_cce(dev); 471 r128_do_cleanup_cce(dev);
472 return DRM_ERR(EINVAL); 472 return -EINVAL;
473 } 473 }
474 dev_priv->cce_ring = drm_core_findmap(dev, init->ring_offset); 474 dev_priv->cce_ring = drm_core_findmap(dev, init->ring_offset);
475 if (!dev_priv->cce_ring) { 475 if (!dev_priv->cce_ring) {
476 DRM_ERROR("could not find cce ring region!\n"); 476 DRM_ERROR("could not find cce ring region!\n");
477 dev->dev_private = (void *)dev_priv; 477 dev->dev_private = (void *)dev_priv;
478 r128_do_cleanup_cce(dev); 478 r128_do_cleanup_cce(dev);
479 return DRM_ERR(EINVAL); 479 return -EINVAL;
480 } 480 }
481 dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset); 481 dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset);
482 if (!dev_priv->ring_rptr) { 482 if (!dev_priv->ring_rptr) {
483 DRM_ERROR("could not find ring read pointer!\n"); 483 DRM_ERROR("could not find ring read pointer!\n");
484 dev->dev_private = (void *)dev_priv; 484 dev->dev_private = (void *)dev_priv;
485 r128_do_cleanup_cce(dev); 485 r128_do_cleanup_cce(dev);
486 return DRM_ERR(EINVAL); 486 return -EINVAL;
487 } 487 }
488 dev->agp_buffer_token = init->buffers_offset; 488 dev->agp_buffer_token = init->buffers_offset;
489 dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); 489 dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset);
@@ -491,7 +491,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
491 DRM_ERROR("could not find dma buffer region!\n"); 491 DRM_ERROR("could not find dma buffer region!\n");
492 dev->dev_private = (void *)dev_priv; 492 dev->dev_private = (void *)dev_priv;
493 r128_do_cleanup_cce(dev); 493 r128_do_cleanup_cce(dev);
494 return DRM_ERR(EINVAL); 494 return -EINVAL;
495 } 495 }
496 496
497 if (!dev_priv->is_pci) { 497 if (!dev_priv->is_pci) {
@@ -501,7 +501,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
501 DRM_ERROR("could not find agp texture region!\n"); 501 DRM_ERROR("could not find agp texture region!\n");
502 dev->dev_private = (void *)dev_priv; 502 dev->dev_private = (void *)dev_priv;
503 r128_do_cleanup_cce(dev); 503 r128_do_cleanup_cce(dev);
504 return DRM_ERR(EINVAL); 504 return -EINVAL;
505 } 505 }
506 } 506 }
507 507
@@ -520,7 +520,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
520 DRM_ERROR("Could not ioremap agp regions!\n"); 520 DRM_ERROR("Could not ioremap agp regions!\n");
521 dev->dev_private = (void *)dev_priv; 521 dev->dev_private = (void *)dev_priv;
522 r128_do_cleanup_cce(dev); 522 r128_do_cleanup_cce(dev);
523 return DRM_ERR(ENOMEM); 523 return -ENOMEM;
524 } 524 }
525 } else 525 } else
526#endif 526#endif
@@ -567,7 +567,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init)
567 DRM_ERROR("failed to init PCI GART!\n"); 567 DRM_ERROR("failed to init PCI GART!\n");
568 dev->dev_private = (void *)dev_priv; 568 dev->dev_private = (void *)dev_priv;
569 r128_do_cleanup_cce(dev); 569 r128_do_cleanup_cce(dev);
570 return DRM_ERR(ENOMEM); 570 return -ENOMEM;
571 } 571 }
572 R128_WRITE(R128_PCI_GART_PAGE, dev_priv->gart_info.bus_addr); 572 R128_WRITE(R128_PCI_GART_PAGE, dev_priv->gart_info.bus_addr);
573#if __OS_HAS_AGP 573#if __OS_HAS_AGP
@@ -644,7 +644,7 @@ int r128_cce_init(DRM_IOCTL_ARGS)
644 return r128_do_cleanup_cce(dev); 644 return r128_do_cleanup_cce(dev);
645 } 645 }
646 646
647 return DRM_ERR(EINVAL); 647 return -EINVAL;
648} 648}
649 649
650int r128_cce_start(DRM_IOCTL_ARGS) 650int r128_cce_start(DRM_IOCTL_ARGS)
@@ -721,7 +721,7 @@ int r128_cce_reset(DRM_IOCTL_ARGS)
721 721
722 if (!dev_priv) { 722 if (!dev_priv) {
723 DRM_DEBUG("%s called before init done\n", __FUNCTION__); 723 DRM_DEBUG("%s called before init done\n", __FUNCTION__);
724 return DRM_ERR(EINVAL); 724 return -EINVAL;
725 } 725 }
726 726
727 r128_do_cce_reset(dev_priv); 727 r128_do_cce_reset(dev_priv);
@@ -759,7 +759,7 @@ int r128_engine_reset(DRM_IOCTL_ARGS)
759 759
760int r128_fullscreen(DRM_IOCTL_ARGS) 760int r128_fullscreen(DRM_IOCTL_ARGS)
761{ 761{
762 return DRM_ERR(EINVAL); 762 return -EINVAL;
763} 763}
764 764
765/* ================================================================ 765/* ================================================================
@@ -780,7 +780,7 @@ static int r128_freelist_init(struct drm_device * dev)
780 780
781 dev_priv->head = drm_alloc(sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER); 781 dev_priv->head = drm_alloc(sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER);
782 if (dev_priv->head == NULL) 782 if (dev_priv->head == NULL)
783 return DRM_ERR(ENOMEM); 783 return -ENOMEM;
784 784
785 memset(dev_priv->head, 0, sizeof(drm_r128_freelist_t)); 785 memset(dev_priv->head, 0, sizeof(drm_r128_freelist_t));
786 dev_priv->head->age = R128_BUFFER_USED; 786 dev_priv->head->age = R128_BUFFER_USED;
@@ -791,7 +791,7 @@ static int r128_freelist_init(struct drm_device * dev)
791 791
792 entry = drm_alloc(sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER); 792 entry = drm_alloc(sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER);
793 if (!entry) 793 if (!entry)
794 return DRM_ERR(ENOMEM); 794 return -ENOMEM;
795 795
796 entry->age = R128_BUFFER_FREE; 796 entry->age = R128_BUFFER_FREE;
797 entry->buf = buf; 797 entry->buf = buf;
@@ -883,7 +883,7 @@ int r128_wait_ring(drm_r128_private_t * dev_priv, int n)
883 883
884 /* FIXME: This is being ignored... */ 884 /* FIXME: This is being ignored... */
885 DRM_ERROR("failed!\n"); 885 DRM_ERROR("failed!\n");
886 return DRM_ERR(EBUSY); 886 return -EBUSY;
887} 887}
888 888
889static int r128_cce_get_buffers(DRMFILE filp, struct drm_device * dev, struct drm_dma * d) 889static int r128_cce_get_buffers(DRMFILE filp, struct drm_device * dev, struct drm_dma * d)
@@ -894,16 +894,16 @@ static int r128_cce_get_buffers(DRMFILE filp, struct drm_device * dev, struct dr
894 for (i = d->granted_count; i < d->request_count; i++) { 894 for (i = d->granted_count; i < d->request_count; i++) {
895 buf = r128_freelist_get(dev); 895 buf = r128_freelist_get(dev);
896 if (!buf) 896 if (!buf)
897 return DRM_ERR(EAGAIN); 897 return -EAGAIN;
898 898
899 buf->filp = filp; 899 buf->filp = filp;
900 900
901 if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx, 901 if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx,
902 sizeof(buf->idx))) 902 sizeof(buf->idx)))
903 return DRM_ERR(EFAULT); 903 return -EFAULT;
904 if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total, 904 if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total,
905 sizeof(buf->total))) 905 sizeof(buf->total)))
906 return DRM_ERR(EFAULT); 906 return -EFAULT;
907 907
908 d->granted_count++; 908 d->granted_count++;
909 } 909 }
@@ -927,7 +927,7 @@ int r128_cce_buffers(DRM_IOCTL_ARGS)
927 if (d.send_count != 0) { 927 if (d.send_count != 0) {
928 DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", 928 DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n",
929 DRM_CURRENTPID, d.send_count); 929 DRM_CURRENTPID, d.send_count);
930 return DRM_ERR(EINVAL); 930 return -EINVAL;
931 } 931 }
932 932
933 /* We'll send you buffers. 933 /* We'll send you buffers.
@@ -935,7 +935,7 @@ int r128_cce_buffers(DRM_IOCTL_ARGS)
935 if (d.request_count < 0 || d.request_count > dma->buf_count) { 935 if (d.request_count < 0 || d.request_count > dma->buf_count) {
936 DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", 936 DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n",
937 DRM_CURRENTPID, d.request_count, dma->buf_count); 937 DRM_CURRENTPID, d.request_count, dma->buf_count);
938 return DRM_ERR(EINVAL); 938 return -EINVAL;
939 } 939 }
940 940
941 d.granted_count = 0; 941 d.granted_count = 0;