summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/mach64_state.c
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-10-07 22:25:13 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-10-07 22:25:13 +0000
commit80c9e2d60d9935ec71deb4cdadcd95ed1eab7bd5 (patch)
tree427cd8c404be603a4becfdf03099d5d11bcbf8c1 /sys/dev/pci/drm/mach64_state.c
parentfe8d8e4b6ee985aaaffe6e1231eae6166fa58582 (diff)
Kill the linux-ready negative return codes in ``shared'' code. We handle
them wrong in several cases that i've noticed and Merging when needed is still fairly simple, anyway. This shaves another 500 bytes from an amd64 kernel due to not having to flip the sign on some things. It also stops my eyes bleeding. Tested by a few along with the last diff that went in.
Diffstat (limited to 'sys/dev/pci/drm/mach64_state.c')
-rw-r--r--sys/dev/pci/drm/mach64_state.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/sys/dev/pci/drm/mach64_state.c b/sys/dev/pci/drm/mach64_state.c
index a58c7694064..97d0e6508e1 100644
--- a/sys/dev/pci/drm/mach64_state.c
+++ b/sys/dev/pci/drm/mach64_state.c
@@ -220,7 +220,7 @@ static int mach64_dma_dispatch_clear(struct drm_device * dev,
fb_bpp = MACH64_DATATYPE_ARGB8888;
break;
default:
- return -EINVAL;
+ return EINVAL;
}
switch (dev_priv->depth_bpp) {
case 16:
@@ -231,7 +231,7 @@ static int mach64_dma_dispatch_clear(struct drm_device * dev,
depth_bpp = MACH64_DATATYPE_ARGB8888;
break;
default:
- return -EINVAL;
+ return EINVAL;
}
if (!nbox)
@@ -473,11 +473,11 @@ static __inline__ int copy_from_user_vertex(u32 *to,
from = drm_alloc(bytes, DRM_MEM_DRIVER);
if (from == NULL)
- return -ENOMEM;
+ return ENOMEM;
if (DRM_COPY_FROM_USER(from, ufrom, bytes)) {
drm_free(from, bytes, DRM_MEM_DRIVER);
- return -EFAULT;
+ return EFAULT;
}
orig_from = from; /* we'll be modifying the "from" ptr, so save it */
@@ -508,14 +508,14 @@ static __inline__ int copy_from_user_vertex(u32 *to,
} else {
DRM_ERROR("Got bad command: 0x%04x\n", reg);
drm_free(orig_from, bytes, DRM_MEM_DRIVER);
- return -EACCES;
+ return EACCES;
}
} else {
DRM_ERROR
("Got bad command count(=%u) dwords remaining=%lu\n",
count, n);
drm_free(orig_from, bytes, DRM_MEM_DRIVER);
- return -EINVAL;
+ return EINVAL;
}
}
@@ -524,7 +524,7 @@ static __inline__ int copy_from_user_vertex(u32 *to,
return 0;
else {
DRM_ERROR("Bad buf->used(=%lu)\n", bytes);
- return -EINVAL;
+ return EINVAL;
}
}
@@ -552,7 +552,7 @@ static int mach64_dma_dispatch_vertex(struct drm_device * dev,
copy_buf = mach64_freelist_get(dev_priv);
if (copy_buf == NULL) {
DRM_ERROR("couldn't get buffer\n");
- return -EAGAIN;
+ return EAGAIN;
}
/* Mach64's vertex data is actually register writes. To avoid security
@@ -622,7 +622,7 @@ static __inline__ int copy_from_user_blit(u32 *to,
to = (u32 *)((char *)to + MACH64_HOSTDATA_BLIT_OFFSET);
if (DRM_COPY_FROM_USER(to, ufrom, bytes)) {
- return -EFAULT;
+ return EFAULT;
}
return 0;
@@ -660,7 +660,7 @@ static int mach64_dma_dispatch_blit(struct drm_device * dev,
break;
default:
DRM_ERROR("invalid blit format %d\n", blit->format);
- return -EINVAL;
+ return EINVAL;
}
/* Set buf->used to the bytes of blit data based on the blit dimensions
@@ -673,13 +673,13 @@ static int mach64_dma_dispatch_blit(struct drm_device * dev,
if (used <= 0 ||
used > MACH64_BUFFER_SIZE - MACH64_HOSTDATA_BLIT_OFFSET) {
DRM_ERROR("Invalid blit size: %lu bytes\n", used);
- return -EINVAL;
+ return EINVAL;
}
copy_buf = mach64_freelist_get(dev_priv);
if (copy_buf == NULL) {
DRM_ERROR("couldn't get buffer\n");
- return -EAGAIN;
+ return EAGAIN;
}
/* Copy the blit data from userspace.
@@ -811,7 +811,7 @@ int mach64_dma_vertex(struct drm_device *dev, void *data,
if (!dev_priv) {
DRM_ERROR("called with no initialization\n");
- return -EINVAL;
+ return EINVAL;
}
DRM_DEBUG("pid=%d buf=%p used=%lu discard=%d\n",
@@ -820,13 +820,13 @@ int mach64_dma_vertex(struct drm_device *dev, void *data,
if (vertex->prim < 0 || vertex->prim > MACH64_PRIM_POLYGON) {
DRM_ERROR("buffer prim %d\n", vertex->prim);
- return -EINVAL;
+ return EINVAL;
}
if (vertex->used > MACH64_BUFFER_SIZE || (vertex->used & 3) != 0) {
DRM_ERROR("Invalid vertex buffer size: %lu bytes\n",
vertex->used);
- return -EINVAL;
+ return EINVAL;
}
if (sarea_priv->nbox > MACH64_NR_SAREA_CLIPRECTS)
@@ -866,7 +866,7 @@ int mach64_get_param(struct drm_device *dev, void *data,
if (!dev_priv) {
DRM_ERROR("called with no initialization\n");
- return -EINVAL;
+ return EINVAL;
}
switch (param->param) {
@@ -879,12 +879,12 @@ int mach64_get_param(struct drm_device *dev, void *data,
value = dev->irq;
break;
default:
- return -EINVAL;
+ return EINVAL;
}
if (DRM_COPY_TO_USER(param->value, &value, sizeof(int))) {
DRM_ERROR("copy_to_user\n");
- return -EFAULT;
+ return EFAULT;
}
return 0;