aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/r128_state.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_state.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_state.c')
-rw-r--r--drivers/char/drm/r128_state.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/drivers/char/drm/r128_state.c b/drivers/char/drm/r128_state.c
index 7b334fb7d649..f0e2571e94a9 100644
--- a/drivers/char/drm/r128_state.c
+++ b/drivers/char/drm/r128_state.c
@@ -809,7 +809,7 @@ static int r128_cce_dispatch_blit(DRMFILE filp,
809 break; 809 break;
810 default: 810 default:
811 DRM_ERROR("invalid blit format %d\n", blit->format); 811 DRM_ERROR("invalid blit format %d\n", blit->format);
812 return DRM_ERR(EINVAL); 812 return -EINVAL;
813 } 813 }
814 814
815 /* Flush the pixel cache, and mark the contents as Read Invalid. 815 /* Flush the pixel cache, and mark the contents as Read Invalid.
@@ -832,11 +832,11 @@ static int r128_cce_dispatch_blit(DRMFILE filp,
832 if (buf->filp != filp) { 832 if (buf->filp != filp) {
833 DRM_ERROR("process %d using buffer owned by %p\n", 833 DRM_ERROR("process %d using buffer owned by %p\n",
834 DRM_CURRENTPID, buf->filp); 834 DRM_CURRENTPID, buf->filp);
835 return DRM_ERR(EINVAL); 835 return -EINVAL;
836 } 836 }
837 if (buf->pending) { 837 if (buf->pending) {
838 DRM_ERROR("sending pending buffer %d\n", blit->idx); 838 DRM_ERROR("sending pending buffer %d\n", blit->idx);
839 return DRM_ERR(EINVAL); 839 return -EINVAL;
840 } 840 }
841 841
842 buf_priv->discard = 1; 842 buf_priv->discard = 1;
@@ -900,22 +900,22 @@ static int r128_cce_dispatch_write_span(struct drm_device * dev,
900 900
901 count = depth->n; 901 count = depth->n;
902 if (count > 4096 || count <= 0) 902 if (count > 4096 || count <= 0)
903 return DRM_ERR(EMSGSIZE); 903 return -EMSGSIZE;
904 904
905 if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) { 905 if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) {
906 return DRM_ERR(EFAULT); 906 return -EFAULT;
907 } 907 }
908 if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) { 908 if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) {
909 return DRM_ERR(EFAULT); 909 return -EFAULT;
910 } 910 }
911 911
912 buffer_size = depth->n * sizeof(u32); 912 buffer_size = depth->n * sizeof(u32);
913 buffer = drm_alloc(buffer_size, DRM_MEM_BUFS); 913 buffer = drm_alloc(buffer_size, DRM_MEM_BUFS);
914 if (buffer == NULL) 914 if (buffer == NULL)
915 return DRM_ERR(ENOMEM); 915 return -ENOMEM;
916 if (DRM_COPY_FROM_USER(buffer, depth->buffer, buffer_size)) { 916 if (DRM_COPY_FROM_USER(buffer, depth->buffer, buffer_size)) {
917 drm_free(buffer, buffer_size, DRM_MEM_BUFS); 917 drm_free(buffer, buffer_size, DRM_MEM_BUFS);
918 return DRM_ERR(EFAULT); 918 return -EFAULT;
919 } 919 }
920 920
921 mask_size = depth->n * sizeof(u8); 921 mask_size = depth->n * sizeof(u8);
@@ -923,12 +923,12 @@ static int r128_cce_dispatch_write_span(struct drm_device * dev,
923 mask = drm_alloc(mask_size, DRM_MEM_BUFS); 923 mask = drm_alloc(mask_size, DRM_MEM_BUFS);
924 if (mask == NULL) { 924 if (mask == NULL) {
925 drm_free(buffer, buffer_size, DRM_MEM_BUFS); 925 drm_free(buffer, buffer_size, DRM_MEM_BUFS);
926 return DRM_ERR(ENOMEM); 926 return -ENOMEM;
927 } 927 }
928 if (DRM_COPY_FROM_USER(mask, depth->mask, mask_size)) { 928 if (DRM_COPY_FROM_USER(mask, depth->mask, mask_size)) {
929 drm_free(buffer, buffer_size, DRM_MEM_BUFS); 929 drm_free(buffer, buffer_size, DRM_MEM_BUFS);
930 drm_free(mask, mask_size, DRM_MEM_BUFS); 930 drm_free(mask, mask_size, DRM_MEM_BUFS);
931 return DRM_ERR(EFAULT); 931 return -EFAULT;
932 } 932 }
933 933
934 for (i = 0; i < count; i++, x++) { 934 for (i = 0; i < count; i++, x++) {
@@ -996,28 +996,28 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev,
996 996
997 count = depth->n; 997 count = depth->n;
998 if (count > 4096 || count <= 0) 998 if (count > 4096 || count <= 0)
999 return DRM_ERR(EMSGSIZE); 999 return -EMSGSIZE;
1000 1000
1001 xbuf_size = count * sizeof(*x); 1001 xbuf_size = count * sizeof(*x);
1002 ybuf_size = count * sizeof(*y); 1002 ybuf_size = count * sizeof(*y);
1003 x = drm_alloc(xbuf_size, DRM_MEM_BUFS); 1003 x = drm_alloc(xbuf_size, DRM_MEM_BUFS);
1004 if (x == NULL) { 1004 if (x == NULL) {
1005 return DRM_ERR(ENOMEM); 1005 return -ENOMEM;
1006 } 1006 }
1007 y = drm_alloc(ybuf_size, DRM_MEM_BUFS); 1007 y = drm_alloc(ybuf_size, DRM_MEM_BUFS);
1008 if (y == NULL) { 1008 if (y == NULL) {
1009 drm_free(x, xbuf_size, DRM_MEM_BUFS); 1009 drm_free(x, xbuf_size, DRM_MEM_BUFS);
1010 return DRM_ERR(ENOMEM); 1010 return -ENOMEM;
1011 } 1011 }
1012 if (DRM_COPY_FROM_USER(x, depth->x, xbuf_size)) { 1012 if (DRM_COPY_FROM_USER(x, depth->x, xbuf_size)) {
1013 drm_free(x, xbuf_size, DRM_MEM_BUFS); 1013 drm_free(x, xbuf_size, DRM_MEM_BUFS);
1014 drm_free(y, ybuf_size, DRM_MEM_BUFS); 1014 drm_free(y, ybuf_size, DRM_MEM_BUFS);
1015 return DRM_ERR(EFAULT); 1015 return -EFAULT;
1016 } 1016 }
1017 if (DRM_COPY_FROM_USER(y, depth->y, xbuf_size)) { 1017 if (DRM_COPY_FROM_USER(y, depth->y, xbuf_size)) {
1018 drm_free(x, xbuf_size, DRM_MEM_BUFS); 1018 drm_free(x, xbuf_size, DRM_MEM_BUFS);
1019 drm_free(y, ybuf_size, DRM_MEM_BUFS); 1019 drm_free(y, ybuf_size, DRM_MEM_BUFS);
1020 return DRM_ERR(EFAULT); 1020 return -EFAULT;
1021 } 1021 }
1022 1022
1023 buffer_size = depth->n * sizeof(u32); 1023 buffer_size = depth->n * sizeof(u32);
@@ -1025,13 +1025,13 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev,
1025 if (buffer == NULL) { 1025 if (buffer == NULL) {
1026 drm_free(x, xbuf_size, DRM_MEM_BUFS); 1026 drm_free(x, xbuf_size, DRM_MEM_BUFS);
1027 drm_free(y, ybuf_size, DRM_MEM_BUFS); 1027 drm_free(y, ybuf_size, DRM_MEM_BUFS);
1028 return DRM_ERR(ENOMEM); 1028 return -ENOMEM;
1029 } 1029 }
1030 if (DRM_COPY_FROM_USER(buffer, depth->buffer, buffer_size)) { 1030 if (DRM_COPY_FROM_USER(buffer, depth->buffer, buffer_size)) {
1031 drm_free(x, xbuf_size, DRM_MEM_BUFS); 1031 drm_free(x, xbuf_size, DRM_MEM_BUFS);
1032 drm_free(y, ybuf_size, DRM_MEM_BUFS); 1032 drm_free(y, ybuf_size, DRM_MEM_BUFS);
1033 drm_free(buffer, buffer_size, DRM_MEM_BUFS); 1033 drm_free(buffer, buffer_size, DRM_MEM_BUFS);
1034 return DRM_ERR(EFAULT); 1034 return -EFAULT;
1035 } 1035 }
1036 1036
1037 if (depth->mask) { 1037 if (depth->mask) {
@@ -1041,14 +1041,14 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev,
1041 drm_free(x, xbuf_size, DRM_MEM_BUFS); 1041 drm_free(x, xbuf_size, DRM_MEM_BUFS);
1042 drm_free(y, ybuf_size, DRM_MEM_BUFS); 1042 drm_free(y, ybuf_size, DRM_MEM_BUFS);
1043 drm_free(buffer, buffer_size, DRM_MEM_BUFS); 1043 drm_free(buffer, buffer_size, DRM_MEM_BUFS);
1044 return DRM_ERR(ENOMEM); 1044 return -ENOMEM;
1045 } 1045 }
1046 if (DRM_COPY_FROM_USER(mask, depth->mask, mask_size)) { 1046 if (DRM_COPY_FROM_USER(mask, depth->mask, mask_size)) {
1047 drm_free(x, xbuf_size, DRM_MEM_BUFS); 1047 drm_free(x, xbuf_size, DRM_MEM_BUFS);
1048 drm_free(y, ybuf_size, DRM_MEM_BUFS); 1048 drm_free(y, ybuf_size, DRM_MEM_BUFS);
1049 drm_free(buffer, buffer_size, DRM_MEM_BUFS); 1049 drm_free(buffer, buffer_size, DRM_MEM_BUFS);
1050 drm_free(mask, mask_size, DRM_MEM_BUFS); 1050 drm_free(mask, mask_size, DRM_MEM_BUFS);
1051 return DRM_ERR(EFAULT); 1051 return -EFAULT;
1052 } 1052 }
1053 1053
1054 for (i = 0; i < count; i++) { 1054 for (i = 0; i < count; i++) {
@@ -1115,13 +1115,13 @@ static int r128_cce_dispatch_read_span(struct drm_device * dev,
1115 1115
1116 count = depth->n; 1116 count = depth->n;
1117 if (count > 4096 || count <= 0) 1117 if (count > 4096 || count <= 0)
1118 return DRM_ERR(EMSGSIZE); 1118 return -EMSGSIZE;
1119 1119
1120 if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) { 1120 if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) {
1121 return DRM_ERR(EFAULT); 1121 return -EFAULT;
1122 } 1122 }
1123 if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) { 1123 if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) {
1124 return DRM_ERR(EFAULT); 1124 return -EFAULT;
1125 } 1125 }
1126 1126
1127 BEGIN_RING(7); 1127 BEGIN_RING(7);
@@ -1159,7 +1159,7 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev,
1159 1159
1160 count = depth->n; 1160 count = depth->n;
1161 if (count > 4096 || count <= 0) 1161 if (count > 4096 || count <= 0)
1162 return DRM_ERR(EMSGSIZE); 1162 return -EMSGSIZE;
1163 1163
1164 if (count > dev_priv->depth_pitch) { 1164 if (count > dev_priv->depth_pitch) {
1165 count = dev_priv->depth_pitch; 1165 count = dev_priv->depth_pitch;
@@ -1169,22 +1169,22 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev,
1169 ybuf_size = count * sizeof(*y); 1169 ybuf_size = count * sizeof(*y);
1170 x = drm_alloc(xbuf_size, DRM_MEM_BUFS); 1170 x = drm_alloc(xbuf_size, DRM_MEM_BUFS);
1171 if (x == NULL) { 1171 if (x == NULL) {
1172 return DRM_ERR(ENOMEM); 1172 return -ENOMEM;
1173 } 1173 }
1174 y = drm_alloc(ybuf_size, DRM_MEM_BUFS); 1174 y = drm_alloc(ybuf_size, DRM_MEM_BUFS);
1175 if (y == NULL) { 1175 if (y == NULL) {
1176 drm_free(x, xbuf_size, DRM_MEM_BUFS); 1176 drm_free(x, xbuf_size, DRM_MEM_BUFS);
1177 return DRM_ERR(ENOMEM); 1177 return -ENOMEM;
1178 } 1178 }
1179 if (DRM_COPY_FROM_USER(x, depth->x, xbuf_size)) { 1179 if (DRM_COPY_FROM_USER(x, depth->x, xbuf_size)) {
1180 drm_free(x, xbuf_size, DRM_MEM_BUFS); 1180 drm_free(x, xbuf_size, DRM_MEM_BUFS);
1181 drm_free(y, ybuf_size, DRM_MEM_BUFS); 1181 drm_free(y, ybuf_size, DRM_MEM_BUFS);
1182 return DRM_ERR(EFAULT); 1182 return -EFAULT;
1183 } 1183 }
1184 if (DRM_COPY_FROM_USER(y, depth->y, ybuf_size)) { 1184 if (DRM_COPY_FROM_USER(y, depth->y, ybuf_size)) {
1185 drm_free(x, xbuf_size, DRM_MEM_BUFS); 1185 drm_free(x, xbuf_size, DRM_MEM_BUFS);
1186 drm_free(y, ybuf_size, DRM_MEM_BUFS); 1186 drm_free(y, ybuf_size, DRM_MEM_BUFS);
1187 return DRM_ERR(EFAULT); 1187 return -EFAULT;
1188 } 1188 }
1189 1189
1190 for (i = 0; i < count; i++) { 1190 for (i = 0; i < count; i++) {
@@ -1363,7 +1363,7 @@ static int r128_cce_vertex(DRM_IOCTL_ARGS)
1363 1363
1364 if (!dev_priv) { 1364 if (!dev_priv) {
1365 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 1365 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
1366 return DRM_ERR(EINVAL); 1366 return -EINVAL;
1367 } 1367 }
1368 1368
1369 DRM_COPY_FROM_USER_IOCTL(vertex, (drm_r128_vertex_t __user *) data, 1369 DRM_COPY_FROM_USER_IOCTL(vertex, (drm_r128_vertex_t __user *) data,
@@ -1375,12 +1375,12 @@ static int r128_cce_vertex(DRM_IOCTL_ARGS)
1375 if (vertex.idx < 0 || vertex.idx >= dma->buf_count) { 1375 if (vertex.idx < 0 || vertex.idx >= dma->buf_count) {
1376 DRM_ERROR("buffer index %d (of %d max)\n", 1376 DRM_ERROR("buffer index %d (of %d max)\n",
1377 vertex.idx, dma->buf_count - 1); 1377 vertex.idx, dma->buf_count - 1);
1378 return DRM_ERR(EINVAL); 1378 return -EINVAL;
1379 } 1379 }
1380 if (vertex.prim < 0 || 1380 if (vertex.prim < 0 ||
1381 vertex.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) { 1381 vertex.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) {
1382 DRM_ERROR("buffer prim %d\n", vertex.prim); 1382 DRM_ERROR("buffer prim %d\n", vertex.prim);
1383 return DRM_ERR(EINVAL); 1383 return -EINVAL;
1384 } 1384 }
1385 1385
1386 RING_SPACE_TEST_WITH_RETURN(dev_priv); 1386 RING_SPACE_TEST_WITH_RETURN(dev_priv);
@@ -1392,11 +1392,11 @@ static int r128_cce_vertex(DRM_IOCTL_ARGS)
1392 if (buf->filp != filp) { 1392 if (buf->filp != filp) {
1393 DRM_ERROR("process %d using buffer owned by %p\n", 1393 DRM_ERROR("process %d using buffer owned by %p\n",
1394 DRM_CURRENTPID, buf->filp); 1394 DRM_CURRENTPID, buf->filp);
1395 return DRM_ERR(EINVAL); 1395 return -EINVAL;
1396 } 1396 }
1397 if (buf->pending) { 1397 if (buf->pending) {
1398 DRM_ERROR("sending pending buffer %d\n", vertex.idx); 1398 DRM_ERROR("sending pending buffer %d\n", vertex.idx);
1399 return DRM_ERR(EINVAL); 1399 return -EINVAL;
1400 } 1400 }
1401 1401
1402 buf->used = vertex.count; 1402 buf->used = vertex.count;
@@ -1423,7 +1423,7 @@ static int r128_cce_indices(DRM_IOCTL_ARGS)
1423 1423
1424 if (!dev_priv) { 1424 if (!dev_priv) {
1425 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 1425 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
1426 return DRM_ERR(EINVAL); 1426 return -EINVAL;
1427 } 1427 }
1428 1428
1429 DRM_COPY_FROM_USER_IOCTL(elts, (drm_r128_indices_t __user *) data, 1429 DRM_COPY_FROM_USER_IOCTL(elts, (drm_r128_indices_t __user *) data,
@@ -1435,11 +1435,11 @@ static int r128_cce_indices(DRM_IOCTL_ARGS)
1435 if (elts.idx < 0 || elts.idx >= dma->buf_count) { 1435 if (elts.idx < 0 || elts.idx >= dma->buf_count) {
1436 DRM_ERROR("buffer index %d (of %d max)\n", 1436 DRM_ERROR("buffer index %d (of %d max)\n",
1437 elts.idx, dma->buf_count - 1); 1437 elts.idx, dma->buf_count - 1);
1438 return DRM_ERR(EINVAL); 1438 return -EINVAL;
1439 } 1439 }
1440 if (elts.prim < 0 || elts.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) { 1440 if (elts.prim < 0 || elts.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) {
1441 DRM_ERROR("buffer prim %d\n", elts.prim); 1441 DRM_ERROR("buffer prim %d\n", elts.prim);
1442 return DRM_ERR(EINVAL); 1442 return -EINVAL;
1443 } 1443 }
1444 1444
1445 RING_SPACE_TEST_WITH_RETURN(dev_priv); 1445 RING_SPACE_TEST_WITH_RETURN(dev_priv);
@@ -1451,11 +1451,11 @@ static int r128_cce_indices(DRM_IOCTL_ARGS)
1451 if (buf->filp != filp) { 1451 if (buf->filp != filp) {
1452 DRM_ERROR("process %d using buffer owned by %p\n", 1452 DRM_ERROR("process %d using buffer owned by %p\n",
1453 DRM_CURRENTPID, buf->filp); 1453 DRM_CURRENTPID, buf->filp);
1454 return DRM_ERR(EINVAL); 1454 return -EINVAL;
1455 } 1455 }
1456 if (buf->pending) { 1456 if (buf->pending) {
1457 DRM_ERROR("sending pending buffer %d\n", elts.idx); 1457 DRM_ERROR("sending pending buffer %d\n", elts.idx);
1458 return DRM_ERR(EINVAL); 1458 return -EINVAL;
1459 } 1459 }
1460 1460
1461 count = (elts.end - elts.start) / sizeof(u16); 1461 count = (elts.end - elts.start) / sizeof(u16);
@@ -1463,11 +1463,11 @@ static int r128_cce_indices(DRM_IOCTL_ARGS)
1463 1463
1464 if (elts.start & 0x7) { 1464 if (elts.start & 0x7) {
1465 DRM_ERROR("misaligned buffer 0x%x\n", elts.start); 1465 DRM_ERROR("misaligned buffer 0x%x\n", elts.start);
1466 return DRM_ERR(EINVAL); 1466 return -EINVAL;
1467 } 1467 }
1468 if (elts.start < buf->used) { 1468 if (elts.start < buf->used) {
1469 DRM_ERROR("no header 0x%x - 0x%x\n", elts.start, buf->used); 1469 DRM_ERROR("no header 0x%x - 0x%x\n", elts.start, buf->used);
1470 return DRM_ERR(EINVAL); 1470 return -EINVAL;
1471 } 1471 }
1472 1472
1473 buf->used = elts.end; 1473 buf->used = elts.end;
@@ -1498,7 +1498,7 @@ static int r128_cce_blit(DRM_IOCTL_ARGS)
1498 if (blit.idx < 0 || blit.idx >= dma->buf_count) { 1498 if (blit.idx < 0 || blit.idx >= dma->buf_count) {
1499 DRM_ERROR("buffer index %d (of %d max)\n", 1499 DRM_ERROR("buffer index %d (of %d max)\n",
1500 blit.idx, dma->buf_count - 1); 1500 blit.idx, dma->buf_count - 1);
1501 return DRM_ERR(EINVAL); 1501 return -EINVAL;
1502 } 1502 }
1503 1503
1504 RING_SPACE_TEST_WITH_RETURN(dev_priv); 1504 RING_SPACE_TEST_WITH_RETURN(dev_priv);
@@ -1524,7 +1524,7 @@ static int r128_cce_depth(DRM_IOCTL_ARGS)
1524 1524
1525 RING_SPACE_TEST_WITH_RETURN(dev_priv); 1525 RING_SPACE_TEST_WITH_RETURN(dev_priv);
1526 1526
1527 ret = DRM_ERR(EINVAL); 1527 ret = -EINVAL;
1528 switch (depth.func) { 1528 switch (depth.func) {
1529 case R128_WRITE_SPAN: 1529 case R128_WRITE_SPAN:
1530 ret = r128_cce_dispatch_write_span(dev, &depth); 1530 ret = r128_cce_dispatch_write_span(dev, &depth);
@@ -1557,7 +1557,7 @@ static int r128_cce_stipple(DRM_IOCTL_ARGS)
1557 sizeof(stipple)); 1557 sizeof(stipple));
1558 1558
1559 if (DRM_COPY_FROM_USER(&mask, stipple.mask, 32 * sizeof(u32))) 1559 if (DRM_COPY_FROM_USER(&mask, stipple.mask, 32 * sizeof(u32)))
1560 return DRM_ERR(EFAULT); 1560 return -EFAULT;
1561 1561
1562 RING_SPACE_TEST_WITH_RETURN(dev_priv); 1562 RING_SPACE_TEST_WITH_RETURN(dev_priv);
1563 1563
@@ -1583,7 +1583,7 @@ static int r128_cce_indirect(DRM_IOCTL_ARGS)
1583 1583
1584 if (!dev_priv) { 1584 if (!dev_priv) {
1585 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 1585 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
1586 return DRM_ERR(EINVAL); 1586 return -EINVAL;
1587 } 1587 }
1588 1588
1589 DRM_COPY_FROM_USER_IOCTL(indirect, (drm_r128_indirect_t __user *) data, 1589 DRM_COPY_FROM_USER_IOCTL(indirect, (drm_r128_indirect_t __user *) data,
@@ -1595,7 +1595,7 @@ static int r128_cce_indirect(DRM_IOCTL_ARGS)
1595 if (indirect.idx < 0 || indirect.idx >= dma->buf_count) { 1595 if (indirect.idx < 0 || indirect.idx >= dma->buf_count) {
1596 DRM_ERROR("buffer index %d (of %d max)\n", 1596 DRM_ERROR("buffer index %d (of %d max)\n",
1597 indirect.idx, dma->buf_count - 1); 1597 indirect.idx, dma->buf_count - 1);
1598 return DRM_ERR(EINVAL); 1598 return -EINVAL;
1599 } 1599 }
1600 1600
1601 buf = dma->buflist[indirect.idx]; 1601 buf = dma->buflist[indirect.idx];
@@ -1604,17 +1604,17 @@ static int r128_cce_indirect(DRM_IOCTL_ARGS)
1604 if (buf->filp != filp) { 1604 if (buf->filp != filp) {
1605 DRM_ERROR("process %d using buffer owned by %p\n", 1605 DRM_ERROR("process %d using buffer owned by %p\n",
1606 DRM_CURRENTPID, buf->filp); 1606 DRM_CURRENTPID, buf->filp);
1607 return DRM_ERR(EINVAL); 1607 return -EINVAL;
1608 } 1608 }
1609 if (buf->pending) { 1609 if (buf->pending) {
1610 DRM_ERROR("sending pending buffer %d\n", indirect.idx); 1610 DRM_ERROR("sending pending buffer %d\n", indirect.idx);
1611 return DRM_ERR(EINVAL); 1611 return -EINVAL;
1612 } 1612 }
1613 1613
1614 if (indirect.start < buf->used) { 1614 if (indirect.start < buf->used) {
1615 DRM_ERROR("reusing indirect: start=0x%x actual=0x%x\n", 1615 DRM_ERROR("reusing indirect: start=0x%x actual=0x%x\n",
1616 indirect.start, buf->used); 1616 indirect.start, buf->used);
1617 return DRM_ERR(EINVAL); 1617 return -EINVAL;
1618 } 1618 }
1619 1619
1620 RING_SPACE_TEST_WITH_RETURN(dev_priv); 1620 RING_SPACE_TEST_WITH_RETURN(dev_priv);
@@ -1651,7 +1651,7 @@ static int r128_getparam(DRM_IOCTL_ARGS)
1651 1651
1652 if (!dev_priv) { 1652 if (!dev_priv) {
1653 DRM_ERROR("%s called with no initialization\n", __FUNCTION__); 1653 DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
1654 return DRM_ERR(EINVAL); 1654 return -EINVAL;
1655 } 1655 }
1656 1656
1657 DRM_COPY_FROM_USER_IOCTL(param, (drm_r128_getparam_t __user *) data, 1657 DRM_COPY_FROM_USER_IOCTL(param, (drm_r128_getparam_t __user *) data,
@@ -1664,12 +1664,12 @@ static int r128_getparam(DRM_IOCTL_ARGS)
1664 value = dev->irq; 1664 value = dev->irq;
1665 break; 1665 break;
1666 default: 1666 default:
1667 return DRM_ERR(EINVAL); 1667 return -EINVAL;
1668 } 1668 }
1669 1669
1670 if (DRM_COPY_TO_USER(param.value, &value, sizeof(int))) { 1670 if (DRM_COPY_TO_USER(param.value, &value, sizeof(int))) {
1671 DRM_ERROR("copy_to_user\n"); 1671 DRM_ERROR("copy_to_user\n");
1672 return DRM_ERR(EFAULT); 1672 return -EFAULT;
1673 } 1673 }
1674 1674
1675 return 0; 1675 return 0;