diff options
Diffstat (limited to 'drivers/char/drm/mga_dma.c')
-rw-r--r-- | drivers/char/drm/mga_dma.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/char/drm/mga_dma.c b/drivers/char/drm/mga_dma.c index 9c73a6e3861b..0f23760eb629 100644 --- a/drivers/char/drm/mga_dma.c +++ b/drivers/char/drm/mga_dma.c | |||
@@ -71,7 +71,7 @@ int mga_do_wait_for_idle(drm_mga_private_t * dev_priv) | |||
71 | DRM_ERROR("failed!\n"); | 71 | DRM_ERROR("failed!\n"); |
72 | DRM_INFO(" status=0x%08x\n", status); | 72 | DRM_INFO(" status=0x%08x\n", status); |
73 | #endif | 73 | #endif |
74 | return DRM_ERR(EBUSY); | 74 | return -EBUSY; |
75 | } | 75 | } |
76 | 76 | ||
77 | static int mga_do_dma_reset(drm_mga_private_t * dev_priv) | 77 | static int mga_do_dma_reset(drm_mga_private_t * dev_priv) |
@@ -256,7 +256,7 @@ static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_pr | |||
256 | 256 | ||
257 | dev_priv->head = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); | 257 | dev_priv->head = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); |
258 | if (dev_priv->head == NULL) | 258 | if (dev_priv->head == NULL) |
259 | return DRM_ERR(ENOMEM); | 259 | return -ENOMEM; |
260 | 260 | ||
261 | memset(dev_priv->head, 0, sizeof(drm_mga_freelist_t)); | 261 | memset(dev_priv->head, 0, sizeof(drm_mga_freelist_t)); |
262 | SET_AGE(&dev_priv->head->age, MGA_BUFFER_USED, 0); | 262 | SET_AGE(&dev_priv->head->age, MGA_BUFFER_USED, 0); |
@@ -267,7 +267,7 @@ static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_pr | |||
267 | 267 | ||
268 | entry = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); | 268 | entry = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); |
269 | if (entry == NULL) | 269 | if (entry == NULL) |
270 | return DRM_ERR(ENOMEM); | 270 | return -ENOMEM; |
271 | 271 | ||
272 | memset(entry, 0, sizeof(drm_mga_freelist_t)); | 272 | memset(entry, 0, sizeof(drm_mga_freelist_t)); |
273 | 273 | ||
@@ -399,7 +399,7 @@ int mga_driver_load(struct drm_device * dev, unsigned long flags) | |||
399 | 399 | ||
400 | dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER); | 400 | dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER); |
401 | if (!dev_priv) | 401 | if (!dev_priv) |
402 | return DRM_ERR(ENOMEM); | 402 | return -ENOMEM; |
403 | 403 | ||
404 | dev->dev_private = (void *)dev_priv; | 404 | dev->dev_private = (void *)dev_priv; |
405 | memset(dev_priv, 0, sizeof(drm_mga_private_t)); | 405 | memset(dev_priv, 0, sizeof(drm_mga_private_t)); |
@@ -578,7 +578,7 @@ static int mga_do_agp_dma_bootstrap(struct drm_device * dev, | |||
578 | DRM_ERROR("failed to ioremap agp regions! (%p, %p, %p)\n", | 578 | DRM_ERROR("failed to ioremap agp regions! (%p, %p, %p)\n", |
579 | dev_priv->warp->handle, dev_priv->primary->handle, | 579 | dev_priv->warp->handle, dev_priv->primary->handle, |
580 | dev->agp_buffer_map->handle); | 580 | dev->agp_buffer_map->handle); |
581 | return DRM_ERR(ENOMEM); | 581 | return -ENOMEM; |
582 | } | 582 | } |
583 | 583 | ||
584 | dev_priv->dma_access = MGA_PAGPXFER; | 584 | dev_priv->dma_access = MGA_PAGPXFER; |
@@ -622,7 +622,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device * dev, | |||
622 | 622 | ||
623 | if (dev->dma == NULL) { | 623 | if (dev->dma == NULL) { |
624 | DRM_ERROR("dev->dma is NULL\n"); | 624 | DRM_ERROR("dev->dma is NULL\n"); |
625 | return DRM_ERR(EFAULT); | 625 | return -EFAULT; |
626 | } | 626 | } |
627 | 627 | ||
628 | /* Make drm_addbufs happy by not trying to create a mapping for less | 628 | /* Make drm_addbufs happy by not trying to create a mapping for less |
@@ -656,7 +656,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device * dev, | |||
656 | 656 | ||
657 | if (err != 0) { | 657 | if (err != 0) { |
658 | DRM_ERROR("Unable to allocate primary DMA region: %d\n", err); | 658 | DRM_ERROR("Unable to allocate primary DMA region: %d\n", err); |
659 | return DRM_ERR(ENOMEM); | 659 | return -ENOMEM; |
660 | } | 660 | } |
661 | 661 | ||
662 | if (dev_priv->primary->size != dma_bs->primary_size) { | 662 | if (dev_priv->primary->size != dma_bs->primary_size) { |
@@ -826,7 +826,7 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init) | |||
826 | dev_priv->sarea = drm_getsarea(dev); | 826 | dev_priv->sarea = drm_getsarea(dev); |
827 | if (!dev_priv->sarea) { | 827 | if (!dev_priv->sarea) { |
828 | DRM_ERROR("failed to find sarea!\n"); | 828 | DRM_ERROR("failed to find sarea!\n"); |
829 | return DRM_ERR(EINVAL); | 829 | return -EINVAL; |
830 | } | 830 | } |
831 | 831 | ||
832 | if (!dev_priv->used_new_dma_init) { | 832 | if (!dev_priv->used_new_dma_init) { |
@@ -837,29 +837,29 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init) | |||
837 | dev_priv->status = drm_core_findmap(dev, init->status_offset); | 837 | dev_priv->status = drm_core_findmap(dev, init->status_offset); |
838 | if (!dev_priv->status) { | 838 | if (!dev_priv->status) { |
839 | DRM_ERROR("failed to find status page!\n"); | 839 | DRM_ERROR("failed to find status page!\n"); |
840 | return DRM_ERR(EINVAL); | 840 | return -EINVAL; |
841 | } | 841 | } |
842 | dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); | 842 | dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); |
843 | if (!dev_priv->mmio) { | 843 | if (!dev_priv->mmio) { |
844 | DRM_ERROR("failed to find mmio region!\n"); | 844 | DRM_ERROR("failed to find mmio region!\n"); |
845 | return DRM_ERR(EINVAL); | 845 | return -EINVAL; |
846 | } | 846 | } |
847 | dev_priv->warp = drm_core_findmap(dev, init->warp_offset); | 847 | dev_priv->warp = drm_core_findmap(dev, init->warp_offset); |
848 | if (!dev_priv->warp) { | 848 | if (!dev_priv->warp) { |
849 | DRM_ERROR("failed to find warp microcode region!\n"); | 849 | DRM_ERROR("failed to find warp microcode region!\n"); |
850 | return DRM_ERR(EINVAL); | 850 | return -EINVAL; |
851 | } | 851 | } |
852 | dev_priv->primary = drm_core_findmap(dev, init->primary_offset); | 852 | dev_priv->primary = drm_core_findmap(dev, init->primary_offset); |
853 | if (!dev_priv->primary) { | 853 | if (!dev_priv->primary) { |
854 | DRM_ERROR("failed to find primary dma region!\n"); | 854 | DRM_ERROR("failed to find primary dma region!\n"); |
855 | return DRM_ERR(EINVAL); | 855 | return -EINVAL; |
856 | } | 856 | } |
857 | dev->agp_buffer_token = init->buffers_offset; | 857 | dev->agp_buffer_token = init->buffers_offset; |
858 | dev->agp_buffer_map = | 858 | dev->agp_buffer_map = |
859 | drm_core_findmap(dev, init->buffers_offset); | 859 | drm_core_findmap(dev, init->buffers_offset); |
860 | if (!dev->agp_buffer_map) { | 860 | if (!dev->agp_buffer_map) { |
861 | DRM_ERROR("failed to find dma buffer region!\n"); | 861 | DRM_ERROR("failed to find dma buffer region!\n"); |
862 | return DRM_ERR(EINVAL); | 862 | return -EINVAL; |
863 | } | 863 | } |
864 | 864 | ||
865 | drm_core_ioremap(dev_priv->warp, dev); | 865 | drm_core_ioremap(dev_priv->warp, dev); |
@@ -877,7 +877,7 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init) | |||
877 | ((dev->agp_buffer_map == NULL) || | 877 | ((dev->agp_buffer_map == NULL) || |
878 | (dev->agp_buffer_map->handle == NULL)))) { | 878 | (dev->agp_buffer_map->handle == NULL)))) { |
879 | DRM_ERROR("failed to ioremap agp regions!\n"); | 879 | DRM_ERROR("failed to ioremap agp regions!\n"); |
880 | return DRM_ERR(ENOMEM); | 880 | return -ENOMEM; |
881 | } | 881 | } |
882 | 882 | ||
883 | ret = mga_warp_install_microcode(dev_priv); | 883 | ret = mga_warp_install_microcode(dev_priv); |
@@ -927,7 +927,7 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init) | |||
927 | 927 | ||
928 | if (mga_freelist_init(dev, dev_priv) < 0) { | 928 | if (mga_freelist_init(dev, dev_priv) < 0) { |
929 | DRM_ERROR("could not initialize freelist\n"); | 929 | DRM_ERROR("could not initialize freelist\n"); |
930 | return DRM_ERR(ENOMEM); | 930 | return -ENOMEM; |
931 | } | 931 | } |
932 | 932 | ||
933 | return 0; | 933 | return 0; |
@@ -1029,7 +1029,7 @@ int mga_dma_init(DRM_IOCTL_ARGS) | |||
1029 | return mga_do_cleanup_dma(dev, FULL_CLEANUP); | 1029 | return mga_do_cleanup_dma(dev, FULL_CLEANUP); |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | return DRM_ERR(EINVAL); | 1032 | return -EINVAL; |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | /* ================================================================ | 1035 | /* ================================================================ |
@@ -1094,16 +1094,16 @@ static int mga_dma_get_buffers(DRMFILE filp, struct drm_device * dev, struct drm | |||
1094 | for (i = d->granted_count; i < d->request_count; i++) { | 1094 | for (i = d->granted_count; i < d->request_count; i++) { |
1095 | buf = mga_freelist_get(dev); | 1095 | buf = mga_freelist_get(dev); |
1096 | if (!buf) | 1096 | if (!buf) |
1097 | return DRM_ERR(EAGAIN); | 1097 | return -EAGAIN; |
1098 | 1098 | ||
1099 | buf->filp = filp; | 1099 | buf->filp = filp; |
1100 | 1100 | ||
1101 | if (DRM_COPY_TO_USER(&d->request_indices[i], | 1101 | if (DRM_COPY_TO_USER(&d->request_indices[i], |
1102 | &buf->idx, sizeof(buf->idx))) | 1102 | &buf->idx, sizeof(buf->idx))) |
1103 | return DRM_ERR(EFAULT); | 1103 | return -EFAULT; |
1104 | if (DRM_COPY_TO_USER(&d->request_sizes[i], | 1104 | if (DRM_COPY_TO_USER(&d->request_sizes[i], |
1105 | &buf->total, sizeof(buf->total))) | 1105 | &buf->total, sizeof(buf->total))) |
1106 | return DRM_ERR(EFAULT); | 1106 | return -EFAULT; |
1107 | 1107 | ||
1108 | d->granted_count++; | 1108 | d->granted_count++; |
1109 | } | 1109 | } |
@@ -1128,7 +1128,7 @@ int mga_dma_buffers(DRM_IOCTL_ARGS) | |||
1128 | if (d.send_count != 0) { | 1128 | if (d.send_count != 0) { |
1129 | DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", | 1129 | DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", |
1130 | DRM_CURRENTPID, d.send_count); | 1130 | DRM_CURRENTPID, d.send_count); |
1131 | return DRM_ERR(EINVAL); | 1131 | return -EINVAL; |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | /* We'll send you buffers. | 1134 | /* We'll send you buffers. |
@@ -1136,7 +1136,7 @@ int mga_dma_buffers(DRM_IOCTL_ARGS) | |||
1136 | if (d.request_count < 0 || d.request_count > dma->buf_count) { | 1136 | if (d.request_count < 0 || d.request_count > dma->buf_count) { |
1137 | DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", | 1137 | DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", |
1138 | DRM_CURRENTPID, d.request_count, dma->buf_count); | 1138 | DRM_CURRENTPID, d.request_count, dma->buf_count); |
1139 | return DRM_ERR(EINVAL); | 1139 | return -EINVAL; |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | WRAP_TEST_WITH_RETURN(dev_priv); | 1142 | WRAP_TEST_WITH_RETURN(dev_priv); |