diff options
Diffstat (limited to 'drivers/char/drm/savage_bci.c')
-rw-r--r-- | drivers/char/drm/savage_bci.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/drivers/char/drm/savage_bci.c b/drivers/char/drm/savage_bci.c index 18c7235f6b73..e1e88ca1c53c 100644 --- a/drivers/char/drm/savage_bci.c +++ b/drivers/char/drm/savage_bci.c | |||
@@ -60,7 +60,7 @@ savage_bci_wait_fifo_shadow(drm_savage_private_t * dev_priv, unsigned int n) | |||
60 | DRM_ERROR("failed!\n"); | 60 | DRM_ERROR("failed!\n"); |
61 | DRM_INFO(" status=0x%08x, threshold=0x%08x\n", status, threshold); | 61 | DRM_INFO(" status=0x%08x, threshold=0x%08x\n", status, threshold); |
62 | #endif | 62 | #endif |
63 | return DRM_ERR(EBUSY); | 63 | return -EBUSY; |
64 | } | 64 | } |
65 | 65 | ||
66 | static int | 66 | static int |
@@ -81,7 +81,7 @@ savage_bci_wait_fifo_s3d(drm_savage_private_t * dev_priv, unsigned int n) | |||
81 | DRM_ERROR("failed!\n"); | 81 | DRM_ERROR("failed!\n"); |
82 | DRM_INFO(" status=0x%08x\n", status); | 82 | DRM_INFO(" status=0x%08x\n", status); |
83 | #endif | 83 | #endif |
84 | return DRM_ERR(EBUSY); | 84 | return -EBUSY; |
85 | } | 85 | } |
86 | 86 | ||
87 | static int | 87 | static int |
@@ -102,7 +102,7 @@ savage_bci_wait_fifo_s4(drm_savage_private_t * dev_priv, unsigned int n) | |||
102 | DRM_ERROR("failed!\n"); | 102 | DRM_ERROR("failed!\n"); |
103 | DRM_INFO(" status=0x%08x\n", status); | 103 | DRM_INFO(" status=0x%08x\n", status); |
104 | #endif | 104 | #endif |
105 | return DRM_ERR(EBUSY); | 105 | return -EBUSY; |
106 | } | 106 | } |
107 | 107 | ||
108 | /* | 108 | /* |
@@ -136,7 +136,7 @@ savage_bci_wait_event_shadow(drm_savage_private_t * dev_priv, uint16_t e) | |||
136 | DRM_INFO(" status=0x%08x, e=0x%04x\n", status, e); | 136 | DRM_INFO(" status=0x%08x, e=0x%04x\n", status, e); |
137 | #endif | 137 | #endif |
138 | 138 | ||
139 | return DRM_ERR(EBUSY); | 139 | return -EBUSY; |
140 | } | 140 | } |
141 | 141 | ||
142 | static int | 142 | static int |
@@ -158,7 +158,7 @@ savage_bci_wait_event_reg(drm_savage_private_t * dev_priv, uint16_t e) | |||
158 | DRM_INFO(" status=0x%08x, e=0x%04x\n", status, e); | 158 | DRM_INFO(" status=0x%08x, e=0x%04x\n", status, e); |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | return DRM_ERR(EBUSY); | 161 | return -EBUSY; |
162 | } | 162 | } |
163 | 163 | ||
164 | uint16_t savage_bci_emit_event(drm_savage_private_t * dev_priv, | 164 | uint16_t savage_bci_emit_event(drm_savage_private_t * dev_priv, |
@@ -301,7 +301,7 @@ static int savage_dma_init(drm_savage_private_t * dev_priv) | |||
301 | dev_priv->dma_pages = drm_alloc(sizeof(drm_savage_dma_page_t) * | 301 | dev_priv->dma_pages = drm_alloc(sizeof(drm_savage_dma_page_t) * |
302 | dev_priv->nr_dma_pages, DRM_MEM_DRIVER); | 302 | dev_priv->nr_dma_pages, DRM_MEM_DRIVER); |
303 | if (dev_priv->dma_pages == NULL) | 303 | if (dev_priv->dma_pages == NULL) |
304 | return DRM_ERR(ENOMEM); | 304 | return -ENOMEM; |
305 | 305 | ||
306 | for (i = 0; i < dev_priv->nr_dma_pages; ++i) { | 306 | for (i = 0; i < dev_priv->nr_dma_pages; ++i) { |
307 | SET_AGE(&dev_priv->dma_pages[i].age, 0, 0); | 307 | SET_AGE(&dev_priv->dma_pages[i].age, 0, 0); |
@@ -541,7 +541,7 @@ int savage_driver_load(struct drm_device *dev, unsigned long chipset) | |||
541 | 541 | ||
542 | dev_priv = drm_alloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER); | 542 | dev_priv = drm_alloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER); |
543 | if (dev_priv == NULL) | 543 | if (dev_priv == NULL) |
544 | return DRM_ERR(ENOMEM); | 544 | return -ENOMEM; |
545 | 545 | ||
546 | memset(dev_priv, 0, sizeof(drm_savage_private_t)); | 546 | memset(dev_priv, 0, sizeof(drm_savage_private_t)); |
547 | dev->dev_private = (void *)dev_priv; | 547 | dev->dev_private = (void *)dev_priv; |
@@ -682,16 +682,16 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) | |||
682 | 682 | ||
683 | if (init->fb_bpp != 16 && init->fb_bpp != 32) { | 683 | if (init->fb_bpp != 16 && init->fb_bpp != 32) { |
684 | DRM_ERROR("invalid frame buffer bpp %d!\n", init->fb_bpp); | 684 | DRM_ERROR("invalid frame buffer bpp %d!\n", init->fb_bpp); |
685 | return DRM_ERR(EINVAL); | 685 | return -EINVAL; |
686 | } | 686 | } |
687 | if (init->depth_bpp != 16 && init->depth_bpp != 32) { | 687 | if (init->depth_bpp != 16 && init->depth_bpp != 32) { |
688 | DRM_ERROR("invalid depth buffer bpp %d!\n", init->fb_bpp); | 688 | DRM_ERROR("invalid depth buffer bpp %d!\n", init->fb_bpp); |
689 | return DRM_ERR(EINVAL); | 689 | return -EINVAL; |
690 | } | 690 | } |
691 | if (init->dma_type != SAVAGE_DMA_AGP && | 691 | if (init->dma_type != SAVAGE_DMA_AGP && |
692 | init->dma_type != SAVAGE_DMA_PCI) { | 692 | init->dma_type != SAVAGE_DMA_PCI) { |
693 | DRM_ERROR("invalid dma memory type %d!\n", init->dma_type); | 693 | DRM_ERROR("invalid dma memory type %d!\n", init->dma_type); |
694 | return DRM_ERR(EINVAL); | 694 | return -EINVAL; |
695 | } | 695 | } |
696 | 696 | ||
697 | dev_priv->cob_size = init->cob_size; | 697 | dev_priv->cob_size = init->cob_size; |
@@ -715,14 +715,14 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) | |||
715 | if (!dev_priv->sarea) { | 715 | if (!dev_priv->sarea) { |
716 | DRM_ERROR("could not find sarea!\n"); | 716 | DRM_ERROR("could not find sarea!\n"); |
717 | savage_do_cleanup_bci(dev); | 717 | savage_do_cleanup_bci(dev); |
718 | return DRM_ERR(EINVAL); | 718 | return -EINVAL; |
719 | } | 719 | } |
720 | if (init->status_offset != 0) { | 720 | if (init->status_offset != 0) { |
721 | dev_priv->status = drm_core_findmap(dev, init->status_offset); | 721 | dev_priv->status = drm_core_findmap(dev, init->status_offset); |
722 | if (!dev_priv->status) { | 722 | if (!dev_priv->status) { |
723 | DRM_ERROR("could not find shadow status region!\n"); | 723 | DRM_ERROR("could not find shadow status region!\n"); |
724 | savage_do_cleanup_bci(dev); | 724 | savage_do_cleanup_bci(dev); |
725 | return DRM_ERR(EINVAL); | 725 | return -EINVAL; |
726 | } | 726 | } |
727 | } else { | 727 | } else { |
728 | dev_priv->status = NULL; | 728 | dev_priv->status = NULL; |
@@ -734,13 +734,13 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) | |||
734 | if (!dev->agp_buffer_map) { | 734 | if (!dev->agp_buffer_map) { |
735 | DRM_ERROR("could not find DMA buffer region!\n"); | 735 | DRM_ERROR("could not find DMA buffer region!\n"); |
736 | savage_do_cleanup_bci(dev); | 736 | savage_do_cleanup_bci(dev); |
737 | return DRM_ERR(EINVAL); | 737 | return -EINVAL; |
738 | } | 738 | } |
739 | drm_core_ioremap(dev->agp_buffer_map, dev); | 739 | drm_core_ioremap(dev->agp_buffer_map, dev); |
740 | if (!dev->agp_buffer_map) { | 740 | if (!dev->agp_buffer_map) { |
741 | DRM_ERROR("failed to ioremap DMA buffer region!\n"); | 741 | DRM_ERROR("failed to ioremap DMA buffer region!\n"); |
742 | savage_do_cleanup_bci(dev); | 742 | savage_do_cleanup_bci(dev); |
743 | return DRM_ERR(ENOMEM); | 743 | return -ENOMEM; |
744 | } | 744 | } |
745 | } | 745 | } |
746 | if (init->agp_textures_offset) { | 746 | if (init->agp_textures_offset) { |
@@ -749,7 +749,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) | |||
749 | if (!dev_priv->agp_textures) { | 749 | if (!dev_priv->agp_textures) { |
750 | DRM_ERROR("could not find agp texture region!\n"); | 750 | DRM_ERROR("could not find agp texture region!\n"); |
751 | savage_do_cleanup_bci(dev); | 751 | savage_do_cleanup_bci(dev); |
752 | return DRM_ERR(EINVAL); | 752 | return -EINVAL; |
753 | } | 753 | } |
754 | } else { | 754 | } else { |
755 | dev_priv->agp_textures = NULL; | 755 | dev_priv->agp_textures = NULL; |
@@ -760,39 +760,39 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) | |||
760 | DRM_ERROR("command DMA not supported on " | 760 | DRM_ERROR("command DMA not supported on " |
761 | "Savage3D/MX/IX.\n"); | 761 | "Savage3D/MX/IX.\n"); |
762 | savage_do_cleanup_bci(dev); | 762 | savage_do_cleanup_bci(dev); |
763 | return DRM_ERR(EINVAL); | 763 | return -EINVAL; |
764 | } | 764 | } |
765 | if (dev->dma && dev->dma->buflist) { | 765 | if (dev->dma && dev->dma->buflist) { |
766 | DRM_ERROR("command and vertex DMA not supported " | 766 | DRM_ERROR("command and vertex DMA not supported " |
767 | "at the same time.\n"); | 767 | "at the same time.\n"); |
768 | savage_do_cleanup_bci(dev); | 768 | savage_do_cleanup_bci(dev); |
769 | return DRM_ERR(EINVAL); | 769 | return -EINVAL; |
770 | } | 770 | } |
771 | dev_priv->cmd_dma = drm_core_findmap(dev, init->cmd_dma_offset); | 771 | dev_priv->cmd_dma = drm_core_findmap(dev, init->cmd_dma_offset); |
772 | if (!dev_priv->cmd_dma) { | 772 | if (!dev_priv->cmd_dma) { |
773 | DRM_ERROR("could not find command DMA region!\n"); | 773 | DRM_ERROR("could not find command DMA region!\n"); |
774 | savage_do_cleanup_bci(dev); | 774 | savage_do_cleanup_bci(dev); |
775 | return DRM_ERR(EINVAL); | 775 | return -EINVAL; |
776 | } | 776 | } |
777 | if (dev_priv->dma_type == SAVAGE_DMA_AGP) { | 777 | if (dev_priv->dma_type == SAVAGE_DMA_AGP) { |
778 | if (dev_priv->cmd_dma->type != _DRM_AGP) { | 778 | if (dev_priv->cmd_dma->type != _DRM_AGP) { |
779 | DRM_ERROR("AGP command DMA region is not a " | 779 | DRM_ERROR("AGP command DMA region is not a " |
780 | "_DRM_AGP map!\n"); | 780 | "_DRM_AGP map!\n"); |
781 | savage_do_cleanup_bci(dev); | 781 | savage_do_cleanup_bci(dev); |
782 | return DRM_ERR(EINVAL); | 782 | return -EINVAL; |
783 | } | 783 | } |
784 | drm_core_ioremap(dev_priv->cmd_dma, dev); | 784 | drm_core_ioremap(dev_priv->cmd_dma, dev); |
785 | if (!dev_priv->cmd_dma->handle) { | 785 | if (!dev_priv->cmd_dma->handle) { |
786 | DRM_ERROR("failed to ioremap command " | 786 | DRM_ERROR("failed to ioremap command " |
787 | "DMA region!\n"); | 787 | "DMA region!\n"); |
788 | savage_do_cleanup_bci(dev); | 788 | savage_do_cleanup_bci(dev); |
789 | return DRM_ERR(ENOMEM); | 789 | return -ENOMEM; |
790 | } | 790 | } |
791 | } else if (dev_priv->cmd_dma->type != _DRM_CONSISTENT) { | 791 | } else if (dev_priv->cmd_dma->type != _DRM_CONSISTENT) { |
792 | DRM_ERROR("PCI command DMA region is not a " | 792 | DRM_ERROR("PCI command DMA region is not a " |
793 | "_DRM_CONSISTENT map!\n"); | 793 | "_DRM_CONSISTENT map!\n"); |
794 | savage_do_cleanup_bci(dev); | 794 | savage_do_cleanup_bci(dev); |
795 | return DRM_ERR(EINVAL); | 795 | return -EINVAL; |
796 | } | 796 | } |
797 | } else { | 797 | } else { |
798 | dev_priv->cmd_dma = NULL; | 798 | dev_priv->cmd_dma = NULL; |
@@ -809,7 +809,7 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) | |||
809 | if (!dev_priv->fake_dma.handle) { | 809 | if (!dev_priv->fake_dma.handle) { |
810 | DRM_ERROR("could not allocate faked DMA buffer!\n"); | 810 | DRM_ERROR("could not allocate faked DMA buffer!\n"); |
811 | savage_do_cleanup_bci(dev); | 811 | savage_do_cleanup_bci(dev); |
812 | return DRM_ERR(ENOMEM); | 812 | return -ENOMEM; |
813 | } | 813 | } |
814 | dev_priv->cmd_dma = &dev_priv->fake_dma; | 814 | dev_priv->cmd_dma = &dev_priv->fake_dma; |
815 | dev_priv->dma_flush = savage_fake_dma_flush; | 815 | dev_priv->dma_flush = savage_fake_dma_flush; |
@@ -886,13 +886,13 @@ static int savage_do_init_bci(struct drm_device * dev, drm_savage_init_t * init) | |||
886 | if (savage_freelist_init(dev) < 0) { | 886 | if (savage_freelist_init(dev) < 0) { |
887 | DRM_ERROR("could not initialize freelist\n"); | 887 | DRM_ERROR("could not initialize freelist\n"); |
888 | savage_do_cleanup_bci(dev); | 888 | savage_do_cleanup_bci(dev); |
889 | return DRM_ERR(ENOMEM); | 889 | return -ENOMEM; |
890 | } | 890 | } |
891 | 891 | ||
892 | if (savage_dma_init(dev_priv) < 0) { | 892 | if (savage_dma_init(dev_priv) < 0) { |
893 | DRM_ERROR("could not initialize command DMA\n"); | 893 | DRM_ERROR("could not initialize command DMA\n"); |
894 | savage_do_cleanup_bci(dev); | 894 | savage_do_cleanup_bci(dev); |
895 | return DRM_ERR(ENOMEM); | 895 | return -ENOMEM; |
896 | } | 896 | } |
897 | 897 | ||
898 | return 0; | 898 | return 0; |
@@ -945,7 +945,7 @@ static int savage_bci_init(DRM_IOCTL_ARGS) | |||
945 | return savage_do_cleanup_bci(dev); | 945 | return savage_do_cleanup_bci(dev); |
946 | } | 946 | } |
947 | 947 | ||
948 | return DRM_ERR(EINVAL); | 948 | return -EINVAL; |
949 | } | 949 | } |
950 | 950 | ||
951 | static int savage_bci_event_emit(DRM_IOCTL_ARGS) | 951 | static int savage_bci_event_emit(DRM_IOCTL_ARGS) |
@@ -1015,16 +1015,16 @@ static int savage_bci_get_buffers(DRMFILE filp, struct drm_device *dev, struct d | |||
1015 | for (i = d->granted_count; i < d->request_count; i++) { | 1015 | for (i = d->granted_count; i < d->request_count; i++) { |
1016 | buf = savage_freelist_get(dev); | 1016 | buf = savage_freelist_get(dev); |
1017 | if (!buf) | 1017 | if (!buf) |
1018 | return DRM_ERR(EAGAIN); | 1018 | return -EAGAIN; |
1019 | 1019 | ||
1020 | buf->filp = filp; | 1020 | buf->filp = filp; |
1021 | 1021 | ||
1022 | if (DRM_COPY_TO_USER(&d->request_indices[i], | 1022 | if (DRM_COPY_TO_USER(&d->request_indices[i], |
1023 | &buf->idx, sizeof(buf->idx))) | 1023 | &buf->idx, sizeof(buf->idx))) |
1024 | return DRM_ERR(EFAULT); | 1024 | return -EFAULT; |
1025 | if (DRM_COPY_TO_USER(&d->request_sizes[i], | 1025 | if (DRM_COPY_TO_USER(&d->request_sizes[i], |
1026 | &buf->total, sizeof(buf->total))) | 1026 | &buf->total, sizeof(buf->total))) |
1027 | return DRM_ERR(EFAULT); | 1027 | return -EFAULT; |
1028 | 1028 | ||
1029 | d->granted_count++; | 1029 | d->granted_count++; |
1030 | } | 1030 | } |
@@ -1047,7 +1047,7 @@ int savage_bci_buffers(DRM_IOCTL_ARGS) | |||
1047 | if (d.send_count != 0) { | 1047 | if (d.send_count != 0) { |
1048 | DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", | 1048 | DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", |
1049 | DRM_CURRENTPID, d.send_count); | 1049 | DRM_CURRENTPID, d.send_count); |
1050 | return DRM_ERR(EINVAL); | 1050 | return -EINVAL; |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | /* We'll send you buffers. | 1053 | /* We'll send you buffers. |
@@ -1055,7 +1055,7 @@ int savage_bci_buffers(DRM_IOCTL_ARGS) | |||
1055 | if (d.request_count < 0 || d.request_count > dma->buf_count) { | 1055 | if (d.request_count < 0 || d.request_count > dma->buf_count) { |
1056 | DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", | 1056 | DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", |
1057 | DRM_CURRENTPID, d.request_count, dma->buf_count); | 1057 | DRM_CURRENTPID, d.request_count, dma->buf_count); |
1058 | return DRM_ERR(EINVAL); | 1058 | return -EINVAL; |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | d.granted_count = 0; | 1061 | d.granted_count = 0; |