diff options
author | Eric Anholt <eric@anholt.net> | 2007-08-25 05:22:43 -0400 |
---|---|---|
committer | Dave Airlie <airlied@optimus.(none)> | 2007-10-14 20:38:19 -0400 |
commit | 20caafa6ecb2487d9b223aa33e7cc704f912a758 (patch) | |
tree | 7df033fdee81305dad0a67ceba79f51ead7c1b8b /drivers/char/drm/savage_state.c | |
parent | 23fd50450a34f2558070ceabb0bfebc1c9604af5 (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/savage_state.c')
-rw-r--r-- | drivers/char/drm/savage_state.c | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/drivers/char/drm/savage_state.c b/drivers/char/drm/savage_state.c index 77497841478..00e59bfd658 100644 --- a/drivers/char/drm/savage_state.c +++ b/drivers/char/drm/savage_state.c | |||
@@ -83,7 +83,7 @@ static int savage_verify_texaddr(drm_savage_private_t * dev_priv, int unit, | |||
83 | { | 83 | { |
84 | if ((addr & 6) != 2) { /* reserved bits */ | 84 | if ((addr & 6) != 2) { /* reserved bits */ |
85 | DRM_ERROR("bad texAddr%d %08x (reserved bits)\n", unit, addr); | 85 | DRM_ERROR("bad texAddr%d %08x (reserved bits)\n", unit, addr); |
86 | return DRM_ERR(EINVAL); | 86 | return -EINVAL; |
87 | } | 87 | } |
88 | if (!(addr & 1)) { /* local */ | 88 | if (!(addr & 1)) { /* local */ |
89 | addr &= ~7; | 89 | addr &= ~7; |
@@ -92,13 +92,13 @@ static int savage_verify_texaddr(drm_savage_private_t * dev_priv, int unit, | |||
92 | DRM_ERROR | 92 | DRM_ERROR |
93 | ("bad texAddr%d %08x (local addr out of range)\n", | 93 | ("bad texAddr%d %08x (local addr out of range)\n", |
94 | unit, addr); | 94 | unit, addr); |
95 | return DRM_ERR(EINVAL); | 95 | return -EINVAL; |
96 | } | 96 | } |
97 | } else { /* AGP */ | 97 | } else { /* AGP */ |
98 | if (!dev_priv->agp_textures) { | 98 | if (!dev_priv->agp_textures) { |
99 | DRM_ERROR("bad texAddr%d %08x (AGP not available)\n", | 99 | DRM_ERROR("bad texAddr%d %08x (AGP not available)\n", |
100 | unit, addr); | 100 | unit, addr); |
101 | return DRM_ERR(EINVAL); | 101 | return -EINVAL; |
102 | } | 102 | } |
103 | addr &= ~7; | 103 | addr &= ~7; |
104 | if (addr < dev_priv->agp_textures->offset || | 104 | if (addr < dev_priv->agp_textures->offset || |
@@ -107,7 +107,7 @@ static int savage_verify_texaddr(drm_savage_private_t * dev_priv, int unit, | |||
107 | DRM_ERROR | 107 | DRM_ERROR |
108 | ("bad texAddr%d %08x (AGP addr out of range)\n", | 108 | ("bad texAddr%d %08x (AGP addr out of range)\n", |
109 | unit, addr); | 109 | unit, addr); |
110 | return DRM_ERR(EINVAL); | 110 | return -EINVAL; |
111 | } | 111 | } |
112 | } | 112 | } |
113 | return 0; | 113 | return 0; |
@@ -133,7 +133,7 @@ static int savage_verify_state_s3d(drm_savage_private_t * dev_priv, | |||
133 | start + count - 1 > SAVAGE_DESTTEXRWWATERMARK_S3D) { | 133 | start + count - 1 > SAVAGE_DESTTEXRWWATERMARK_S3D) { |
134 | DRM_ERROR("invalid register range (0x%04x-0x%04x)\n", | 134 | DRM_ERROR("invalid register range (0x%04x-0x%04x)\n", |
135 | start, start + count - 1); | 135 | start, start + count - 1); |
136 | return DRM_ERR(EINVAL); | 136 | return -EINVAL; |
137 | } | 137 | } |
138 | 138 | ||
139 | SAVE_STATE_MASK(SAVAGE_SCSTART_S3D, s3d.new_scstart, | 139 | SAVE_STATE_MASK(SAVAGE_SCSTART_S3D, s3d.new_scstart, |
@@ -165,7 +165,7 @@ static int savage_verify_state_s4(drm_savage_private_t * dev_priv, | |||
165 | start + count - 1 > SAVAGE_TEXBLENDCOLOR_S4) { | 165 | start + count - 1 > SAVAGE_TEXBLENDCOLOR_S4) { |
166 | DRM_ERROR("invalid register range (0x%04x-0x%04x)\n", | 166 | DRM_ERROR("invalid register range (0x%04x-0x%04x)\n", |
167 | start, start + count - 1); | 167 | start, start + count - 1); |
168 | return DRM_ERR(EINVAL); | 168 | return -EINVAL; |
169 | } | 169 | } |
170 | 170 | ||
171 | SAVE_STATE_MASK(SAVAGE_DRAWCTRL0_S4, s4.new_drawctrl0, | 171 | SAVE_STATE_MASK(SAVAGE_DRAWCTRL0_S4, s4.new_drawctrl0, |
@@ -289,7 +289,7 @@ static int savage_dispatch_dma_prim(drm_savage_private_t * dev_priv, | |||
289 | 289 | ||
290 | if (!dmabuf) { | 290 | if (!dmabuf) { |
291 | DRM_ERROR("called without dma buffers!\n"); | 291 | DRM_ERROR("called without dma buffers!\n"); |
292 | return DRM_ERR(EINVAL); | 292 | return -EINVAL; |
293 | } | 293 | } |
294 | 294 | ||
295 | if (!n) | 295 | if (!n) |
@@ -303,7 +303,7 @@ static int savage_dispatch_dma_prim(drm_savage_private_t * dev_priv, | |||
303 | if (n % 3 != 0) { | 303 | if (n % 3 != 0) { |
304 | DRM_ERROR("wrong number of vertices %u in TRILIST\n", | 304 | DRM_ERROR("wrong number of vertices %u in TRILIST\n", |
305 | n); | 305 | n); |
306 | return DRM_ERR(EINVAL); | 306 | return -EINVAL; |
307 | } | 307 | } |
308 | break; | 308 | break; |
309 | case SAVAGE_PRIM_TRISTRIP: | 309 | case SAVAGE_PRIM_TRISTRIP: |
@@ -312,18 +312,18 @@ static int savage_dispatch_dma_prim(drm_savage_private_t * dev_priv, | |||
312 | DRM_ERROR | 312 | DRM_ERROR |
313 | ("wrong number of vertices %u in TRIFAN/STRIP\n", | 313 | ("wrong number of vertices %u in TRIFAN/STRIP\n", |
314 | n); | 314 | n); |
315 | return DRM_ERR(EINVAL); | 315 | return -EINVAL; |
316 | } | 316 | } |
317 | break; | 317 | break; |
318 | default: | 318 | default: |
319 | DRM_ERROR("invalid primitive type %u\n", prim); | 319 | DRM_ERROR("invalid primitive type %u\n", prim); |
320 | return DRM_ERR(EINVAL); | 320 | return -EINVAL; |
321 | } | 321 | } |
322 | 322 | ||
323 | if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { | 323 | if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { |
324 | if (skip != 0) { | 324 | if (skip != 0) { |
325 | DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip); | 325 | DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip); |
326 | return DRM_ERR(EINVAL); | 326 | return -EINVAL; |
327 | } | 327 | } |
328 | } else { | 328 | } else { |
329 | unsigned int size = 10 - (skip & 1) - (skip >> 1 & 1) - | 329 | unsigned int size = 10 - (skip & 1) - (skip >> 1 & 1) - |
@@ -331,18 +331,18 @@ static int savage_dispatch_dma_prim(drm_savage_private_t * dev_priv, | |||
331 | (skip >> 5 & 1) - (skip >> 6 & 1) - (skip >> 7 & 1); | 331 | (skip >> 5 & 1) - (skip >> 6 & 1) - (skip >> 7 & 1); |
332 | if (skip > SAVAGE_SKIP_ALL_S4 || size != 8) { | 332 | if (skip > SAVAGE_SKIP_ALL_S4 || size != 8) { |
333 | DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip); | 333 | DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip); |
334 | return DRM_ERR(EINVAL); | 334 | return -EINVAL; |
335 | } | 335 | } |
336 | if (reorder) { | 336 | if (reorder) { |
337 | DRM_ERROR("TRILIST_201 used on Savage4 hardware\n"); | 337 | DRM_ERROR("TRILIST_201 used on Savage4 hardware\n"); |
338 | return DRM_ERR(EINVAL); | 338 | return -EINVAL; |
339 | } | 339 | } |
340 | } | 340 | } |
341 | 341 | ||
342 | if (start + n > dmabuf->total / 32) { | 342 | if (start + n > dmabuf->total / 32) { |
343 | DRM_ERROR("vertex indices (%u-%u) out of range (0-%u)\n", | 343 | DRM_ERROR("vertex indices (%u-%u) out of range (0-%u)\n", |
344 | start, start + n - 1, dmabuf->total / 32); | 344 | start, start + n - 1, dmabuf->total / 32); |
345 | return DRM_ERR(EINVAL); | 345 | return -EINVAL; |
346 | } | 346 | } |
347 | 347 | ||
348 | /* Vertex DMA doesn't work with command DMA at the same time, | 348 | /* Vertex DMA doesn't work with command DMA at the same time, |
@@ -440,7 +440,7 @@ static int savage_dispatch_vb_prim(drm_savage_private_t * dev_priv, | |||
440 | if (n % 3 != 0) { | 440 | if (n % 3 != 0) { |
441 | DRM_ERROR("wrong number of vertices %u in TRILIST\n", | 441 | DRM_ERROR("wrong number of vertices %u in TRILIST\n", |
442 | n); | 442 | n); |
443 | return DRM_ERR(EINVAL); | 443 | return -EINVAL; |
444 | } | 444 | } |
445 | break; | 445 | break; |
446 | case SAVAGE_PRIM_TRISTRIP: | 446 | case SAVAGE_PRIM_TRISTRIP: |
@@ -449,24 +449,24 @@ static int savage_dispatch_vb_prim(drm_savage_private_t * dev_priv, | |||
449 | DRM_ERROR | 449 | DRM_ERROR |
450 | ("wrong number of vertices %u in TRIFAN/STRIP\n", | 450 | ("wrong number of vertices %u in TRIFAN/STRIP\n", |
451 | n); | 451 | n); |
452 | return DRM_ERR(EINVAL); | 452 | return -EINVAL; |
453 | } | 453 | } |
454 | break; | 454 | break; |
455 | default: | 455 | default: |
456 | DRM_ERROR("invalid primitive type %u\n", prim); | 456 | DRM_ERROR("invalid primitive type %u\n", prim); |
457 | return DRM_ERR(EINVAL); | 457 | return -EINVAL; |
458 | } | 458 | } |
459 | 459 | ||
460 | if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { | 460 | if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { |
461 | if (skip > SAVAGE_SKIP_ALL_S3D) { | 461 | if (skip > SAVAGE_SKIP_ALL_S3D) { |
462 | DRM_ERROR("invalid skip flags 0x%04x\n", skip); | 462 | DRM_ERROR("invalid skip flags 0x%04x\n", skip); |
463 | return DRM_ERR(EINVAL); | 463 | return -EINVAL; |
464 | } | 464 | } |
465 | vtx_size = 8; /* full vertex */ | 465 | vtx_size = 8; /* full vertex */ |
466 | } else { | 466 | } else { |
467 | if (skip > SAVAGE_SKIP_ALL_S4) { | 467 | if (skip > SAVAGE_SKIP_ALL_S4) { |
468 | DRM_ERROR("invalid skip flags 0x%04x\n", skip); | 468 | DRM_ERROR("invalid skip flags 0x%04x\n", skip); |
469 | return DRM_ERR(EINVAL); | 469 | return -EINVAL; |
470 | } | 470 | } |
471 | vtx_size = 10; /* full vertex */ | 471 | vtx_size = 10; /* full vertex */ |
472 | } | 472 | } |
@@ -478,13 +478,13 @@ static int savage_dispatch_vb_prim(drm_savage_private_t * dev_priv, | |||
478 | if (vtx_size > vb_stride) { | 478 | if (vtx_size > vb_stride) { |
479 | DRM_ERROR("vertex size greater than vb stride (%u > %u)\n", | 479 | DRM_ERROR("vertex size greater than vb stride (%u > %u)\n", |
480 | vtx_size, vb_stride); | 480 | vtx_size, vb_stride); |
481 | return DRM_ERR(EINVAL); | 481 | return -EINVAL; |
482 | } | 482 | } |
483 | 483 | ||
484 | if (start + n > vb_size / (vb_stride * 4)) { | 484 | if (start + n > vb_size / (vb_stride * 4)) { |
485 | DRM_ERROR("vertex indices (%u-%u) out of range (0-%u)\n", | 485 | DRM_ERROR("vertex indices (%u-%u) out of range (0-%u)\n", |
486 | start, start + n - 1, vb_size / (vb_stride * 4)); | 486 | start, start + n - 1, vb_size / (vb_stride * 4)); |
487 | return DRM_ERR(EINVAL); | 487 | return -EINVAL; |
488 | } | 488 | } |
489 | 489 | ||
490 | prim <<= 25; | 490 | prim <<= 25; |
@@ -547,7 +547,7 @@ static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv, | |||
547 | 547 | ||
548 | if (!dmabuf) { | 548 | if (!dmabuf) { |
549 | DRM_ERROR("called without dma buffers!\n"); | 549 | DRM_ERROR("called without dma buffers!\n"); |
550 | return DRM_ERR(EINVAL); | 550 | return -EINVAL; |
551 | } | 551 | } |
552 | 552 | ||
553 | if (!n) | 553 | if (!n) |
@@ -560,7 +560,7 @@ static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv, | |||
560 | case SAVAGE_PRIM_TRILIST: | 560 | case SAVAGE_PRIM_TRILIST: |
561 | if (n % 3 != 0) { | 561 | if (n % 3 != 0) { |
562 | DRM_ERROR("wrong number of indices %u in TRILIST\n", n); | 562 | DRM_ERROR("wrong number of indices %u in TRILIST\n", n); |
563 | return DRM_ERR(EINVAL); | 563 | return -EINVAL; |
564 | } | 564 | } |
565 | break; | 565 | break; |
566 | case SAVAGE_PRIM_TRISTRIP: | 566 | case SAVAGE_PRIM_TRISTRIP: |
@@ -568,18 +568,18 @@ static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv, | |||
568 | if (n < 3) { | 568 | if (n < 3) { |
569 | DRM_ERROR | 569 | DRM_ERROR |
570 | ("wrong number of indices %u in TRIFAN/STRIP\n", n); | 570 | ("wrong number of indices %u in TRIFAN/STRIP\n", n); |
571 | return DRM_ERR(EINVAL); | 571 | return -EINVAL; |
572 | } | 572 | } |
573 | break; | 573 | break; |
574 | default: | 574 | default: |
575 | DRM_ERROR("invalid primitive type %u\n", prim); | 575 | DRM_ERROR("invalid primitive type %u\n", prim); |
576 | return DRM_ERR(EINVAL); | 576 | return -EINVAL; |
577 | } | 577 | } |
578 | 578 | ||
579 | if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { | 579 | if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { |
580 | if (skip != 0) { | 580 | if (skip != 0) { |
581 | DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip); | 581 | DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip); |
582 | return DRM_ERR(EINVAL); | 582 | return -EINVAL; |
583 | } | 583 | } |
584 | } else { | 584 | } else { |
585 | unsigned int size = 10 - (skip & 1) - (skip >> 1 & 1) - | 585 | unsigned int size = 10 - (skip & 1) - (skip >> 1 & 1) - |
@@ -587,11 +587,11 @@ static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv, | |||
587 | (skip >> 5 & 1) - (skip >> 6 & 1) - (skip >> 7 & 1); | 587 | (skip >> 5 & 1) - (skip >> 6 & 1) - (skip >> 7 & 1); |
588 | if (skip > SAVAGE_SKIP_ALL_S4 || size != 8) { | 588 | if (skip > SAVAGE_SKIP_ALL_S4 || size != 8) { |
589 | DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip); | 589 | DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip); |
590 | return DRM_ERR(EINVAL); | 590 | return -EINVAL; |
591 | } | 591 | } |
592 | if (reorder) { | 592 | if (reorder) { |
593 | DRM_ERROR("TRILIST_201 used on Savage4 hardware\n"); | 593 | DRM_ERROR("TRILIST_201 used on Savage4 hardware\n"); |
594 | return DRM_ERR(EINVAL); | 594 | return -EINVAL; |
595 | } | 595 | } |
596 | } | 596 | } |
597 | 597 | ||
@@ -628,7 +628,7 @@ static int savage_dispatch_dma_idx(drm_savage_private_t * dev_priv, | |||
628 | if (idx[i] > dmabuf->total / 32) { | 628 | if (idx[i] > dmabuf->total / 32) { |
629 | DRM_ERROR("idx[%u]=%u out of range (0-%u)\n", | 629 | DRM_ERROR("idx[%u]=%u out of range (0-%u)\n", |
630 | i, idx[i], dmabuf->total / 32); | 630 | i, idx[i], dmabuf->total / 32); |
631 | return DRM_ERR(EINVAL); | 631 | return -EINVAL; |
632 | } | 632 | } |
633 | } | 633 | } |
634 | 634 | ||
@@ -698,7 +698,7 @@ static int savage_dispatch_vb_idx(drm_savage_private_t * dev_priv, | |||
698 | case SAVAGE_PRIM_TRILIST: | 698 | case SAVAGE_PRIM_TRILIST: |
699 | if (n % 3 != 0) { | 699 | if (n % 3 != 0) { |
700 | DRM_ERROR("wrong number of indices %u in TRILIST\n", n); | 700 | DRM_ERROR("wrong number of indices %u in TRILIST\n", n); |
701 | return DRM_ERR(EINVAL); | 701 | return -EINVAL; |
702 | } | 702 | } |
703 | break; | 703 | break; |
704 | case SAVAGE_PRIM_TRISTRIP: | 704 | case SAVAGE_PRIM_TRISTRIP: |
@@ -706,24 +706,24 @@ static int savage_dispatch_vb_idx(drm_savage_private_t * dev_priv, | |||
706 | if (n < 3) { | 706 | if (n < 3) { |
707 | DRM_ERROR | 707 | DRM_ERROR |
708 | ("wrong number of indices %u in TRIFAN/STRIP\n", n); | 708 | ("wrong number of indices %u in TRIFAN/STRIP\n", n); |
709 | return DRM_ERR(EINVAL); | 709 | return -EINVAL; |
710 | } | 710 | } |
711 | break; | 711 | break; |
712 | default: | 712 | default: |
713 | DRM_ERROR("invalid primitive type %u\n", prim); | 713 | DRM_ERROR("invalid primitive type %u\n", prim); |
714 | return DRM_ERR(EINVAL); | 714 | return -EINVAL; |
715 | } | 715 | } |
716 | 716 | ||
717 | if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { | 717 | if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { |
718 | if (skip > SAVAGE_SKIP_ALL_S3D) { | 718 | if (skip > SAVAGE_SKIP_ALL_S3D) { |
719 | DRM_ERROR("invalid skip flags 0x%04x\n", skip); | 719 | DRM_ERROR("invalid skip flags 0x%04x\n", skip); |
720 | return DRM_ERR(EINVAL); | 720 | return -EINVAL; |
721 | } | 721 | } |
722 | vtx_size = 8; /* full vertex */ | 722 | vtx_size = 8; /* full vertex */ |
723 | } else { | 723 | } else { |
724 | if (skip > SAVAGE_SKIP_ALL_S4) { | 724 | if (skip > SAVAGE_SKIP_ALL_S4) { |
725 | DRM_ERROR("invalid skip flags 0x%04x\n", skip); | 725 | DRM_ERROR("invalid skip flags 0x%04x\n", skip); |
726 | return DRM_ERR(EINVAL); | 726 | return -EINVAL; |
727 | } | 727 | } |
728 | vtx_size = 10; /* full vertex */ | 728 | vtx_size = 10; /* full vertex */ |
729 | } | 729 | } |
@@ -735,7 +735,7 @@ static int savage_dispatch_vb_idx(drm_savage_private_t * dev_priv, | |||
735 | if (vtx_size > vb_stride) { | 735 | if (vtx_size > vb_stride) { |
736 | DRM_ERROR("vertex size greater than vb stride (%u > %u)\n", | 736 | DRM_ERROR("vertex size greater than vb stride (%u > %u)\n", |
737 | vtx_size, vb_stride); | 737 | vtx_size, vb_stride); |
738 | return DRM_ERR(EINVAL); | 738 | return -EINVAL; |
739 | } | 739 | } |
740 | 740 | ||
741 | prim <<= 25; | 741 | prim <<= 25; |
@@ -748,7 +748,7 @@ static int savage_dispatch_vb_idx(drm_savage_private_t * dev_priv, | |||
748 | if (idx[i] > vb_size / (vb_stride * 4)) { | 748 | if (idx[i] > vb_size / (vb_stride * 4)) { |
749 | DRM_ERROR("idx[%u]=%u out of range (0-%u)\n", | 749 | DRM_ERROR("idx[%u]=%u out of range (0-%u)\n", |
750 | i, idx[i], vb_size / (vb_stride * 4)); | 750 | i, idx[i], vb_size / (vb_stride * 4)); |
751 | return DRM_ERR(EINVAL); | 751 | return -EINVAL; |
752 | } | 752 | } |
753 | } | 753 | } |
754 | 754 | ||
@@ -942,7 +942,7 @@ static int savage_dispatch_draw(drm_savage_private_t * dev_priv, | |||
942 | DRM_ERROR("IMPLEMENTATION ERROR: " | 942 | DRM_ERROR("IMPLEMENTATION ERROR: " |
943 | "non-drawing-command %d\n", | 943 | "non-drawing-command %d\n", |
944 | cmd_header.cmd.cmd); | 944 | cmd_header.cmd.cmd); |
945 | return DRM_ERR(EINVAL); | 945 | return -EINVAL; |
946 | } | 946 | } |
947 | 947 | ||
948 | if (ret != 0) | 948 | if (ret != 0) |
@@ -979,7 +979,7 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
979 | DRM_ERROR | 979 | DRM_ERROR |
980 | ("vertex buffer index %u out of range (0-%u)\n", | 980 | ("vertex buffer index %u out of range (0-%u)\n", |
981 | cmdbuf.dma_idx, dma->buf_count - 1); | 981 | cmdbuf.dma_idx, dma->buf_count - 1); |
982 | return DRM_ERR(EINVAL); | 982 | return -EINVAL; |
983 | } | 983 | } |
984 | dmabuf = dma->buflist[cmdbuf.dma_idx]; | 984 | dmabuf = dma->buflist[cmdbuf.dma_idx]; |
985 | } else { | 985 | } else { |
@@ -994,26 +994,26 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
994 | if (cmdbuf.size) { | 994 | if (cmdbuf.size) { |
995 | kcmd_addr = drm_alloc(cmdbuf.size * 8, DRM_MEM_DRIVER); | 995 | kcmd_addr = drm_alloc(cmdbuf.size * 8, DRM_MEM_DRIVER); |
996 | if (kcmd_addr == NULL) | 996 | if (kcmd_addr == NULL) |
997 | return DRM_ERR(ENOMEM); | 997 | return -ENOMEM; |
998 | 998 | ||
999 | if (DRM_COPY_FROM_USER(kcmd_addr, cmdbuf.cmd_addr, | 999 | if (DRM_COPY_FROM_USER(kcmd_addr, cmdbuf.cmd_addr, |
1000 | cmdbuf.size * 8)) | 1000 | cmdbuf.size * 8)) |
1001 | { | 1001 | { |
1002 | drm_free(kcmd_addr, cmdbuf.size * 8, DRM_MEM_DRIVER); | 1002 | drm_free(kcmd_addr, cmdbuf.size * 8, DRM_MEM_DRIVER); |
1003 | return DRM_ERR(EFAULT); | 1003 | return -EFAULT; |
1004 | } | 1004 | } |
1005 | cmdbuf.cmd_addr = kcmd_addr; | 1005 | cmdbuf.cmd_addr = kcmd_addr; |
1006 | } | 1006 | } |
1007 | if (cmdbuf.vb_size) { | 1007 | if (cmdbuf.vb_size) { |
1008 | kvb_addr = drm_alloc(cmdbuf.vb_size, DRM_MEM_DRIVER); | 1008 | kvb_addr = drm_alloc(cmdbuf.vb_size, DRM_MEM_DRIVER); |
1009 | if (kvb_addr == NULL) { | 1009 | if (kvb_addr == NULL) { |
1010 | ret = DRM_ERR(ENOMEM); | 1010 | ret = -ENOMEM; |
1011 | goto done; | 1011 | goto done; |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | if (DRM_COPY_FROM_USER(kvb_addr, cmdbuf.vb_addr, | 1014 | if (DRM_COPY_FROM_USER(kvb_addr, cmdbuf.vb_addr, |
1015 | cmdbuf.vb_size)) { | 1015 | cmdbuf.vb_size)) { |
1016 | ret = DRM_ERR(EFAULT); | 1016 | ret = -EFAULT; |
1017 | goto done; | 1017 | goto done; |
1018 | } | 1018 | } |
1019 | cmdbuf.vb_addr = kvb_addr; | 1019 | cmdbuf.vb_addr = kvb_addr; |
@@ -1022,13 +1022,13 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
1022 | kbox_addr = drm_alloc(cmdbuf.nbox * sizeof(struct drm_clip_rect), | 1022 | kbox_addr = drm_alloc(cmdbuf.nbox * sizeof(struct drm_clip_rect), |
1023 | DRM_MEM_DRIVER); | 1023 | DRM_MEM_DRIVER); |
1024 | if (kbox_addr == NULL) { | 1024 | if (kbox_addr == NULL) { |
1025 | ret = DRM_ERR(ENOMEM); | 1025 | ret = -ENOMEM; |
1026 | goto done; | 1026 | goto done; |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | if (DRM_COPY_FROM_USER(kbox_addr, cmdbuf.box_addr, | 1029 | if (DRM_COPY_FROM_USER(kbox_addr, cmdbuf.box_addr, |
1030 | cmdbuf.nbox * sizeof(struct drm_clip_rect))) { | 1030 | cmdbuf.nbox * sizeof(struct drm_clip_rect))) { |
1031 | ret = DRM_ERR(EFAULT); | 1031 | ret = -EFAULT; |
1032 | goto done; | 1032 | goto done; |
1033 | } | 1033 | } |
1034 | cmdbuf.box_addr = kbox_addr; | 1034 | cmdbuf.box_addr = kbox_addr; |
@@ -1061,7 +1061,7 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
1061 | DRM_ERROR("indexed drawing command extends " | 1061 | DRM_ERROR("indexed drawing command extends " |
1062 | "beyond end of command buffer\n"); | 1062 | "beyond end of command buffer\n"); |
1063 | DMA_FLUSH(); | 1063 | DMA_FLUSH(); |
1064 | return DRM_ERR(EINVAL); | 1064 | return -EINVAL; |
1065 | } | 1065 | } |
1066 | /* fall through */ | 1066 | /* fall through */ |
1067 | case SAVAGE_CMD_DMA_PRIM: | 1067 | case SAVAGE_CMD_DMA_PRIM: |
@@ -1094,7 +1094,7 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
1094 | DRM_ERROR("command SAVAGE_CMD_STATE extends " | 1094 | DRM_ERROR("command SAVAGE_CMD_STATE extends " |
1095 | "beyond end of command buffer\n"); | 1095 | "beyond end of command buffer\n"); |
1096 | DMA_FLUSH(); | 1096 | DMA_FLUSH(); |
1097 | ret = DRM_ERR(EINVAL); | 1097 | ret = -EINVAL; |
1098 | goto done; | 1098 | goto done; |
1099 | } | 1099 | } |
1100 | ret = savage_dispatch_state(dev_priv, &cmd_header, | 1100 | ret = savage_dispatch_state(dev_priv, &cmd_header, |
@@ -1107,7 +1107,7 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
1107 | DRM_ERROR("command SAVAGE_CMD_CLEAR extends " | 1107 | DRM_ERROR("command SAVAGE_CMD_CLEAR extends " |
1108 | "beyond end of command buffer\n"); | 1108 | "beyond end of command buffer\n"); |
1109 | DMA_FLUSH(); | 1109 | DMA_FLUSH(); |
1110 | ret = DRM_ERR(EINVAL); | 1110 | ret = -EINVAL; |
1111 | goto done; | 1111 | goto done; |
1112 | } | 1112 | } |
1113 | ret = savage_dispatch_clear(dev_priv, &cmd_header, | 1113 | ret = savage_dispatch_clear(dev_priv, &cmd_header, |
@@ -1123,7 +1123,7 @@ int savage_bci_cmdbuf(DRM_IOCTL_ARGS) | |||
1123 | default: | 1123 | default: |
1124 | DRM_ERROR("invalid command 0x%x\n", cmd_header.cmd.cmd); | 1124 | DRM_ERROR("invalid command 0x%x\n", cmd_header.cmd.cmd); |
1125 | DMA_FLUSH(); | 1125 | DMA_FLUSH(); |
1126 | ret = DRM_ERR(EINVAL); | 1126 | ret = -EINVAL; |
1127 | goto done; | 1127 | goto done; |
1128 | } | 1128 | } |
1129 | 1129 | ||