diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-10-07 22:25:13 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-10-07 22:25:13 +0000 |
commit | 80c9e2d60d9935ec71deb4cdadcd95ed1eab7bd5 (patch) | |
tree | 427cd8c404be603a4becfdf03099d5d11bcbf8c1 | |
parent | fe8d8e4b6ee985aaaffe6e1231eae6166fa58582 (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.
31 files changed, 564 insertions, 575 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 6bf354fa31b..73260123d0b 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -237,13 +237,12 @@ do { \ } \ } while (0) -/* Returns -errno to shared code */ #define DRM_WAIT_ON( ret, queue, timeout, condition ) \ DRM_SPINLOCK(&dev->irq_lock); \ while ( ret == 0 ) { \ if (condition) \ break; \ - ret = -msleep(&(queue), &dev->irq_lock, \ + ret = msleep(&(queue), &dev->irq_lock, \ PZERO | PCATCH, "drmwtq", (timeout)); \ } \ DRM_SPINUNLOCK(&dev->irq_lock) diff --git a/sys/dev/pci/drm/drm_dma.c b/sys/dev/pci/drm/drm_dma.c index 25309e56a93..06e2684ee3c 100644 --- a/sys/dev/pci/drm/drm_dma.c +++ b/sys/dev/pci/drm/drm_dma.c @@ -132,9 +132,8 @@ int drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv) { - if (dev->driver->dma_ioctl) { - /* shared code returns -errno */ - return -dev->driver->dma_ioctl(dev, data, file_priv); + if (dev->driver->dma_ioctl != NULL) { + return (dev->driver->dma_ioctl(dev, data, file_priv)); } else { DRM_DEBUG("DMA ioctl on driver with no dma handler\n"); return EINVAL; diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index 2c763c73b83..437a76033cb 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -230,9 +230,7 @@ drm_attach(struct device *parent, struct device *kdev, if (dev->driver->load != NULL) { int retcode; - /* Shared code returns -errno. */ - retcode = -dev->driver->load(dev, - dev->id_entry->driver_private); + retcode = dev->driver->load(dev, dev->id_entry->driver_private); if (retcode != 0) goto error; } @@ -481,8 +479,7 @@ drmopen(dev_t kdev, int flags, int fmt, struct proc *p) priv->authenticated = DRM_SUSER(p); if (dev->driver->open) { - /* shared code returns -errno */ - ret = -dev->driver->open(dev, priv); + ret = dev->driver->open(dev, priv); if (ret != 0) { goto free_priv; } @@ -676,13 +673,7 @@ drmioctl(dev_t kdev, u_long cmd, caddr_t data, int flags, ((ioctl->flags & DRM_MASTER) && !file_priv->master)) return EACCES; - if (is_driver_ioctl) { - /* shared code returns -errno */ - retcode = -func(dev, data, file_priv); - } else { - retcode = func(dev, data, file_priv); - } - + retcode = func(dev, data, file_priv); if (retcode != 0) DRM_DEBUG(" returning %d\n", retcode); diff --git a/sys/dev/pci/drm/i915_dma.c b/sys/dev/pci/drm/i915_dma.c index d55877a974b..036d95c65fe 100644 --- a/sys/dev/pci/drm/i915_dma.c +++ b/sys/dev/pci/drm/i915_dma.c @@ -69,7 +69,7 @@ int i915_wait_ring(struct drm_device * dev, int n, const char *caller) hz / 100); } - return -EBUSY; + return EBUSY; } /** @@ -85,7 +85,7 @@ int i915_init_phys_hws(struct drm_device *dev) if (!dev_priv->status_page_dmah) { DRM_ERROR("Can not allocate hardware status page\n"); - return -ENOMEM; + return ENOMEM; } dev_priv->hw_status_page = dev_priv->status_page_dmah->vaddr; dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr; @@ -164,7 +164,7 @@ static int i915_initialize(struct drm_device * dev, if (!dev_priv->sarea) { DRM_ERROR("can not find sarea!\n"); i915_dma_cleanup(dev); - return -EINVAL; + return EINVAL; } if (init->sarea_priv_offset) @@ -193,7 +193,7 @@ static int i915_initialize(struct drm_device * dev, i915_dma_cleanup(dev); DRM_ERROR("can not ioremap virtual address for" " ring buffer\n"); - return -ENOMEM; + return ENOMEM; } dev_priv->ring.virtual_start = dev_priv->ring.map.handle; @@ -222,19 +222,19 @@ static int i915_dma_resume(struct drm_device * dev) if (!dev_priv->sarea) { DRM_ERROR("can not find sarea!\n"); - return -EINVAL; + return EINVAL; } if (dev_priv->ring.map.handle == NULL) { DRM_ERROR("can not ioremap virtual address for" " ring buffer\n"); - return -ENOMEM; + return ENOMEM; } /* Program Hardware Status Page */ if (!dev_priv->hw_status_page) { DRM_ERROR("Can not find hardware status page\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page); @@ -265,7 +265,7 @@ int i915_dma_init(struct drm_device *dev, void *data, retcode = i915_dma_resume(dev); break; default: - retcode = -EINVAL; + retcode = EINVAL; break; } @@ -356,7 +356,7 @@ static int i915_emit_cmds(struct drm_device *dev, int __user *buffer, RING_LOCALS; if ((dwords+1) * sizeof(int) >= dev_priv->ring.Size - 8) - return -EINVAL; + return EINVAL; BEGIN_LP_RING((dwords+1)&~1); @@ -364,17 +364,17 @@ static int i915_emit_cmds(struct drm_device *dev, int __user *buffer, int cmd, sz; if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], sizeof(cmd))) - return -EINVAL; + return EINVAL; if ((sz = validate_cmd(cmd)) == 0 || i + sz > dwords) - return -EINVAL; + return EINVAL; OUT_RING(cmd); while (++i, --sz) { if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], sizeof(cmd))) { - return -EINVAL; + return EINVAL; } OUT_RING(cmd); } @@ -397,13 +397,13 @@ static int i915_emit_box(struct drm_device * dev, RING_LOCALS; if (DRM_COPY_FROM_USER_UNCHECKED(&box, &boxes[i], sizeof(box))) { - return -EFAULT; + return EFAULT; } if (box.y2 <= box.y1 || box.x2 <= box.x1 || box.y2 <= 0 || box.x2 <= 0) { DRM_ERROR("Bad box %d,%d..%d,%d\n", box.x1, box.y1, box.x2, box.y2); - return -EINVAL; + return EINVAL; } if (IS_I965G(dev)) { @@ -482,7 +482,7 @@ static int i915_dispatch_cmdbuffer(struct drm_device * dev, if (cmd->sz <= 0 || (cmd->sz & 0x3) != 0) { DRM_ERROR("negative value or incorrect alignment\n"); - return -EINVAL; + return EINVAL; } i915_kernel_lost_context(dev); @@ -517,7 +517,7 @@ int i915_dispatch_batchbuffer(struct drm_device * dev, if ((batch->start | batch->used) & 0x7) { DRM_ERROR("alignment\n"); - return -EINVAL; + return EINVAL; } i915_kernel_lost_context(dev); @@ -654,21 +654,21 @@ int i915_batchbuffer(struct drm_device *dev, void *data, if (!dev_priv->allow_batchbuffer) { DRM_ERROR("Batchbuffer ioctl disabled\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("i915 batchbuffer, start %x used %d cliprects %d\n", batch->start, batch->used, batch->num_cliprects); if (batch->num_cliprects < 0) - return -EINVAL; + return EINVAL; LOCK_TEST_WITH_RETURN(dev, file_priv); if (batch->num_cliprects && DRM_VERIFYAREA_READ(batch->cliprects, batch->num_cliprects * sizeof(struct drm_clip_rect))) - return -EFAULT; + return EFAULT; ret = i915_dispatch_batchbuffer(dev, batch); @@ -689,7 +689,7 @@ int i915_cmdbuffer(struct drm_device *dev, void *data, cmdbuf->buf, cmdbuf->sz, cmdbuf->num_cliprects); if (cmdbuf->num_cliprects < 0) - return -EINVAL; + return EINVAL; LOCK_TEST_WITH_RETURN(dev, file_priv); @@ -698,7 +698,7 @@ int i915_cmdbuffer(struct drm_device *dev, void *data, cmdbuf->num_cliprects * sizeof(struct drm_clip_rect))) { DRM_ERROR("Fault accessing cliprects\n"); - return -EFAULT; + return EFAULT; } ret = i915_dispatch_cmdbuffer(dev, cmdbuf); @@ -751,7 +751,7 @@ int i915_flip_bufs(struct drm_device *dev, void *data, struct drm_file *file_pri if (param->pipes & ~0x3) { DRM_ERROR("Invalid planes 0x%x, only <= 0x3 is valid\n", param->pipes); - return -EINVAL; + return EINVAL; } i915_dispatch_flip(dev, param->pipes, 0); @@ -769,7 +769,7 @@ int i915_getparam(struct drm_device *dev, void *data, if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } switch (param->param) { @@ -787,12 +787,12 @@ int i915_getparam(struct drm_device *dev, void *data, break; default: DRM_ERROR("Unknown parameter %d\n", param->param); - return -EINVAL; + return EINVAL; } if (DRM_COPY_TO_USER(param->value, &value, sizeof(int))) { DRM_ERROR("DRM_COPY_TO_USER failed\n"); - return -EFAULT; + return EFAULT; } return 0; @@ -806,7 +806,7 @@ int i915_setparam(struct drm_device *dev, void *data, if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } switch (param->param) { @@ -820,7 +820,7 @@ int i915_setparam(struct drm_device *dev, void *data, break; default: DRM_ERROR("unknown parameter %d\n", param->param); - return -EINVAL; + return EINVAL; } return 0; @@ -848,11 +848,11 @@ int i915_mmio(struct drm_device *dev, void *data, if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } if (mmio->reg >= mmio_table_size) - return -EINVAL; + return EINVAL; e = &mmio_table[mmio->reg]; base = (u8 *) dev_priv->mmio_map->handle + e->offset; @@ -860,21 +860,21 @@ int i915_mmio(struct drm_device *dev, void *data, switch (mmio->read_write) { case I915_MMIO_READ: if (!(e->flag & I915_MMIO_MAY_READ)) - return -EINVAL; + return EINVAL; for (i = 0; i < e->size / 4; i++) buf[i] = I915_READ(e->offset + i * 4); if (DRM_COPY_TO_USER(mmio->data, buf, e->size)) { DRM_ERROR("DRM_COPY_TO_USER failed\n"); - return -EFAULT; + return EFAULT; } break; case I915_MMIO_WRITE: if (!(e->flag & I915_MMIO_MAY_WRITE)) - return -EINVAL; + return EINVAL; if (DRM_COPY_FROM_USER(buf, mmio->data, e->size)) { DRM_ERROR("DRM_COPY_TO_USER failed\n"); - return -EFAULT; + return EFAULT; } for (i = 0; i < e->size / 4; i++) I915_WRITE(e->offset + i * 4, buf[i]); @@ -890,11 +890,11 @@ int i915_set_status_page(struct drm_device *dev, void *data, drm_i915_hws_addr_t *hws = data; if (!I915_NEED_GFX_HWS(dev)) - return -EINVAL; + return EINVAL; if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("set status page addr 0x%08x\n", (u32)hws->addr); @@ -912,7 +912,7 @@ int i915_set_status_page(struct drm_device *dev, void *data, dev_priv->status_gfx_addr = 0; DRM_ERROR("can not ioremap virtual address for" " G33 hw status page\n"); - return -ENOMEM; + return ENOMEM; } dev_priv->hw_status_page = dev_priv->hws_map.handle; @@ -932,7 +932,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) dev_priv = drm_calloc(1, sizeof(drm_i915_private_t), DRM_MEM_DRIVER); if (dev_priv == NULL) - return -ENOMEM; + return ENOMEM; dev->dev_private = (void *)dev_priv; diff --git a/sys/dev/pci/drm/i915_irq.c b/sys/dev/pci/drm/i915_irq.c index ac67dc22d84..604178ebe0e 100644 --- a/sys/dev/pci/drm/i915_irq.c +++ b/sys/dev/pci/drm/i915_irq.c @@ -545,7 +545,7 @@ int i915_wait_irq(struct drm_device * dev, int irq_nr) if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("irq_nr=%d breadcrumb=%d\n", irq_nr, @@ -563,7 +563,7 @@ int i915_wait_irq(struct drm_device * dev, int irq_nr) READ_BREADCRUMB(dev_priv) >= irq_nr); i915_user_irq_off(dev_priv); - if (ret == -EBUSY) { + if (ret == EBUSY) { DRM_ERROR("EBUSY -- rec: %d emitted: %d\n", READ_BREADCRUMB(dev_priv), (int)dev_priv->counter); } @@ -587,14 +587,14 @@ int i915_irq_emit(struct drm_device *dev, void *data, if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } result = i915_emit_irq(dev); if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) { DRM_ERROR("copy_to_user\n"); - return -EFAULT; + return EFAULT; } return 0; @@ -610,7 +610,7 @@ int i915_irq_wait(struct drm_device *dev, void *data, if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } return i915_wait_irq(dev, irqwait->irq_seq); @@ -731,7 +731,7 @@ int i915_vblank_pipe_set(struct drm_device *dev, void *data, if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } return 0; @@ -745,7 +745,7 @@ int i915_vblank_pipe_get(struct drm_device *dev, void *data, if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } pipe->pipe = DRM_I915_VBLANK_PIPE_A | DRM_I915_VBLANK_PIPE_B; @@ -769,19 +769,19 @@ int i915_vblank_swap(struct drm_device *dev, void *data, if (!dev_priv) { DRM_ERROR("%s called with no initialization\n", __func__); - return -EINVAL; + return EINVAL; } if (!dev_priv->sarea_priv || dev_priv->sarea_priv->rotation) { DRM_DEBUG("Rotation not supported\n"); - return -EINVAL; + return EINVAL; } if (swap->seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS | _DRM_VBLANK_FLIP)) { DRM_ERROR("Invalid sequence type 0x%x\n", swap->seqtype); - return -EINVAL; + return EINVAL; } plane = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0; @@ -791,7 +791,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data, if (!(dev_priv->vblank_pipe & (1 << pipe))) { DRM_ERROR("Invalid pipe %d\n", pipe); - return -EINVAL; + return EINVAL; } DRM_SPINLOCK_IRQSAVE(&dev->drw_lock, irqflags); @@ -804,7 +804,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data, if (!drm_get_drawable_info(dev, swap->drawable)) { DRM_SPINUNLOCK_IRQRESTORE(&dev->drw_lock, irqflags); DRM_DEBUG("Invalid drawable ID %d\n", swap->drawable); - return -EINVAL; + return EINVAL; } DRM_SPINUNLOCK_IRQRESTORE(&dev->drw_lock, irqflags); @@ -827,7 +827,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data, } else { DRM_DEBUG("Missed target sequence\n"); drm_vblank_put(dev, pipe); - return -EINVAL; + return EINVAL; } } @@ -849,7 +849,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data, DRM_DEBUG("Invalid drawable ID %d\n", swap->drawable); drm_vblank_put(dev, pipe); - return -EINVAL; + return EINVAL; } i915_dispatch_vsync_flip(dev, drw, plane); @@ -881,7 +881,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data, if (dev_priv->swaps_pending >= 100) { DRM_DEBUG("Too many swaps queued\n"); drm_vblank_put(dev, pipe); - return -EBUSY; + return EBUSY; } vbl_swap = drm_calloc(1, sizeof(*vbl_swap), DRM_MEM_DRIVER); @@ -889,7 +889,7 @@ int i915_vblank_swap(struct drm_device *dev, void *data, if (!vbl_swap) { DRM_ERROR("Failed to allocate memory to queue swap\n"); drm_vblank_put(dev, pipe); - return -ENOMEM; + return ENOMEM; } DRM_DEBUG("\n"); diff --git a/sys/dev/pci/drm/i915_mem.c b/sys/dev/pci/drm/i915_mem.c index 6126a60dc9c..bd188485e1d 100644 --- a/sys/dev/pci/drm/i915_mem.c +++ b/sys/dev/pci/drm/i915_mem.c @@ -187,12 +187,12 @@ static int init_heap(struct mem_block **heap, int start, int size) struct mem_block *blocks = drm_alloc(sizeof(*blocks), DRM_MEM_BUFLISTS); if (!blocks) - return -ENOMEM; + return ENOMEM; *heap = drm_alloc(sizeof(**heap), DRM_MEM_BUFLISTS); if (!*heap) { drm_free(blocks, sizeof(*blocks), DRM_MEM_BUFLISTS); - return -ENOMEM; + return ENOMEM; } blocks->start = start; @@ -277,12 +277,12 @@ int i915_mem_alloc(struct drm_device *dev, void *data, if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } heap = get_heap(dev_priv, alloc->region); if (!heap || !*heap) - return -EFAULT; + return EFAULT; /* Make things easier on ourselves: all allocations at least * 4k aligned. @@ -293,14 +293,14 @@ int i915_mem_alloc(struct drm_device *dev, void *data, block = alloc_block(*heap, alloc->size, alloc->alignment, file_priv); if (!block) - return -ENOMEM; + return ENOMEM; mark_block(dev, block, 1); if (DRM_COPY_TO_USER(alloc->region_offset, &block->start, sizeof(int))) { DRM_ERROR("copy_to_user\n"); - return -EFAULT; + return EFAULT; } return 0; @@ -315,19 +315,19 @@ int i915_mem_free(struct drm_device *dev, void *data, if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } heap = get_heap(dev_priv, memfree->region); if (!heap || !*heap) - return -EFAULT; + return EFAULT; block = find_block(*heap, memfree->region_offset); if (!block) - return -EFAULT; + return EFAULT; if (block->file_priv != file_priv) - return -EPERM; + return EPERM; mark_block(dev, block, 0); free_block(block); @@ -343,16 +343,16 @@ int i915_mem_init_heap(struct drm_device *dev, void *data, if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } heap = get_heap(dev_priv, initheap->region); if (!heap) - return -EFAULT; + return EFAULT; if (*heap) { DRM_ERROR("heap already initialized?"); - return -EFAULT; + return EFAULT; } return init_heap(heap, initheap->start, initheap->size); @@ -367,18 +367,18 @@ int i915_mem_destroy_heap( struct drm_device *dev, void *data, if ( !dev_priv ) { DRM_ERROR( "called with no initialization\n" ); - return -EINVAL; + return EINVAL; } heap = get_heap( dev_priv, destroyheap->region ); if (!heap) { DRM_ERROR("get_heap failed"); - return -EFAULT; + return EFAULT; } if (!*heap) { DRM_ERROR("heap not initialized?"); - return -EFAULT; + return EFAULT; } i915_mem_takedown( heap ); diff --git a/sys/dev/pci/drm/mach64_dma.c b/sys/dev/pci/drm/mach64_dma.c index 1fd9e716920..561f06337ca 100644 --- a/sys/dev/pci/drm/mach64_dma.c +++ b/sys/dev/pci/drm/mach64_dma.c @@ -54,7 +54,7 @@ * \param dev_priv pointer to device private data structure. * \param entries number of free entries in the FIFO to wait for. * - * \returns zero on success, or -EBUSY if the timeout (specificed by + * \returns zero on success, or EBUSY if the timeout (specificed by * drm_mach64_private::usec_timeout) occurs. */ int mach64_do_wait_for_fifo(drm_mach64_private_t *dev_priv, int entries) @@ -69,7 +69,7 @@ int mach64_do_wait_for_fifo(drm_mach64_private_t *dev_priv, int entries) } DRM_INFO("failed! slots=%d entries=%d\n", slots, entries); - return -EBUSY; + return EBUSY; } /** @@ -91,7 +91,7 @@ int mach64_do_wait_for_idle(drm_mach64_private_t *dev_priv) DRM_INFO("failed! GUI_STAT=0x%08x\n", MACH64_READ(MACH64_GUI_STAT)); mach64_dump_ring_info(dev_priv); - return -EBUSY; + return EBUSY; } /** @@ -108,7 +108,7 @@ int mach64_do_wait_for_idle(drm_mach64_private_t *dev_priv) * \param dev_priv pointer to device private data structure. * \param n number of free entries in the ring buffer to wait for. * - * \returns zero on success, or -EBUSY if the timeout (specificed by + * \returns zero on success, or EBUSY if the timeout (specificed by * drm_mach64_private_t::usec_timeout) occurs. * * \sa mach64_dump_ring_info() @@ -131,7 +131,7 @@ int mach64_wait_ring(drm_mach64_private_t *dev_priv, int n) /* FIXME: This is being ignored... */ DRM_ERROR("failed!\n"); mach64_dump_ring_info(dev_priv); - return -EBUSY; + return EBUSY; } /** @@ -166,7 +166,7 @@ static int mach64_ring_idle(drm_mach64_private_t *dev_priv) DRM_INFO("failed! GUI_STAT=0x%08x\n", MACH64_READ(MACH64_GUI_STAT)); mach64_dump_ring_info(dev_priv); - return -EBUSY; + return EBUSY; } /** @@ -838,7 +838,7 @@ static int mach64_bm_dma_test(struct drm_device * dev) drm_pci_alloc(dev, 0x1000, 0x1000, 0xfffffffful); if (!cpu_addr_dmah) { DRM_INFO("data-memory allocation failed!\n"); - return -ENOMEM; + return ENOMEM; } else { data = (u32 *) cpu_addr_dmah->vaddr; data_addr = (u32) cpu_addr_dmah->busaddr; @@ -870,7 +870,7 @@ static int mach64_bm_dma_test(struct drm_device * dev) mach64_do_engine_reset(dev_priv); DRM_INFO("freeing data buffer memory.\n"); drm_pci_free(dev, cpu_addr_dmah); - return -EIO; + return EIO; } } @@ -1008,7 +1008,7 @@ static int mach64_do_dma_init(struct drm_device * dev, drm_mach64_init_t * init) dev_priv = drm_calloc(1, sizeof(drm_mach64_private_t), DRM_MEM_DRIVER); if (dev_priv == NULL) - return -ENOMEM; + return ENOMEM; dev_priv->is_pci = init->is_pci; @@ -1041,21 +1041,21 @@ static int mach64_do_dma_init(struct drm_device * dev, drm_mach64_init_t * init) DRM_ERROR("can not find sarea!\n"); dev->dev_private = (void *)dev_priv; mach64_do_cleanup_dma(dev); - return -EINVAL; + return EINVAL; } dev_priv->fb = drm_core_findmap(dev, init->fb_offset); if (!dev_priv->fb) { DRM_ERROR("can not find frame buffer map!\n"); dev->dev_private = (void *)dev_priv; mach64_do_cleanup_dma(dev); - return -EINVAL; + return EINVAL; } dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); if (!dev_priv->mmio) { DRM_ERROR("can not find mmio map!\n"); dev->dev_private = (void *)dev_priv; mach64_do_cleanup_dma(dev); - return -EINVAL; + return EINVAL; } dev_priv->ring_map = drm_core_findmap(dev, init->ring_offset); @@ -1063,7 +1063,7 @@ static int mach64_do_dma_init(struct drm_device * dev, drm_mach64_init_t * init) DRM_ERROR("can not find ring map!\n"); dev->dev_private = (void *)dev_priv; mach64_do_cleanup_dma(dev); - return -EINVAL; + return EINVAL; } dev_priv->sarea_priv = (drm_mach64_sarea_t *) @@ -1076,7 +1076,7 @@ static int mach64_do_dma_init(struct drm_device * dev, drm_mach64_init_t * init) " descriptor ring\n"); dev->dev_private = (void *)dev_priv; mach64_do_cleanup_dma(dev); - return -ENOMEM; + return ENOMEM; } dev->agp_buffer_token = init->buffers_offset; dev->agp_buffer_map = @@ -1085,7 +1085,7 @@ static int mach64_do_dma_init(struct drm_device * dev, drm_mach64_init_t * init) DRM_ERROR("can not find dma buffer map!\n"); dev->dev_private = (void *)dev_priv; mach64_do_cleanup_dma(dev); - return -EINVAL; + return EINVAL; } /* there might be a nicer way to do this - dev isn't passed all the way though the mach64 - DA */ @@ -1097,7 +1097,7 @@ static int mach64_do_dma_init(struct drm_device * dev, drm_mach64_init_t * init) " dma buffer\n"); dev->dev_private = (void *)dev_priv; mach64_do_cleanup_dma(dev); - return -ENOMEM; + return ENOMEM; } dev_priv->agp_textures = drm_core_findmap(dev, init->agp_textures_offset); @@ -1105,7 +1105,7 @@ static int mach64_do_dma_init(struct drm_device * dev, drm_mach64_init_t * init) DRM_ERROR("can not find agp texture region!\n"); dev->dev_private = (void *)dev_priv; mach64_do_cleanup_dma(dev); - return -EINVAL; + return EINVAL; } } @@ -1277,7 +1277,7 @@ int mach64_do_dispatch_pseudo_dma(drm_mach64_private_t *dev_priv) head, ring->tail, buf_addr, (eol ? "eol" : "")); mach64_dump_ring_info(dev_priv); mach64_do_engine_reset(dev_priv); - return -EINVAL; + return EINVAL; } /* Hand feed the buffer to the card via MMIO, waiting for the fifo @@ -1416,7 +1416,7 @@ int mach64_dma_init(struct drm_device *dev, void *data, return mach64_do_cleanup_dma(dev); } - return -EINVAL; + return EINVAL; } int mach64_dma_idle(struct drm_device *dev, void *data, @@ -1477,7 +1477,7 @@ int mach64_init_freelist(struct drm_device * dev) (drm_mach64_freelist_t *) drm_calloc(1, sizeof(drm_mach64_freelist_t), DRM_MEM_BUFLISTS)) == NULL) - return -ENOMEM; + return ENOMEM; entry->buf = dma->buflist[i]; ptr = &entry->list; list_add_tail(ptr, &dev_priv->free_list); @@ -1672,7 +1672,7 @@ int mach64_freelist_put(drm_mach64_private_t *dev_priv, struct drm_buf *copy_buf entry = list_entry(ptr, drm_mach64_freelist_t, list); if (copy_buf == entry->buf) { DRM_ERROR("Trying to release a pending buf\n"); - return -EFAULT; + return EFAULT; } } #endif @@ -1707,20 +1707,20 @@ static int mach64_dma_get_buffers(struct drm_device *dev, buf = mach64_freelist_get(dev_priv); #if MACH64_EXTRA_CHECKING if (!buf) - return -EFAULT; + return EFAULT; #else if (!buf) - return -EAGAIN; + return EAGAIN; #endif buf->file_priv = file_priv; if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx, sizeof(buf->idx))) - return -EFAULT; + return EFAULT; if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total, sizeof(buf->total))) - return -EFAULT; + return EFAULT; d->granted_count++; } @@ -1741,7 +1741,7 @@ int mach64_dma_buffers(struct drm_device *dev, void *data, if (d->send_count != 0) { DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", DRM_CURRENTPID, d->send_count); - return -EINVAL; + return EINVAL; } /* We'll send you buffers. @@ -1749,7 +1749,7 @@ int mach64_dma_buffers(struct drm_device *dev, void *data, if (d->request_count < 0 || d->request_count > dma->buf_count) { DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", DRM_CURRENTPID, d->request_count, dma->buf_count); - ret = -EINVAL; + ret = EINVAL; } d->granted_count = 0; diff --git a/sys/dev/pci/drm/mach64_drv.h b/sys/dev/pci/drm/mach64_drv.h index 9eac32a32db..53f3a607f2f 100644 --- a/sys/dev/pci/drm/mach64_drv.h +++ b/sys/dev/pci/drm/mach64_drv.h @@ -716,14 +716,14 @@ static __inline__ int mach64_find_pending_buf_entry(drm_mach64_private_t * #if MACH64_EXTRA_CHECKING if (list_empty(&dev_priv->pending)) { DRM_ERROR("Empty pending list in \n"); - return -EINVAL; + return EINVAL; } #endif ptr = dev_priv->pending.prev; *entry = list_entry(ptr, drm_mach64_freelist_t, list); while ((*entry)->buf != buf) { if (ptr == &dev_priv->pending) { - return -EFAULT; + return EFAULT; } ptr = ptr->prev; *entry = list_entry(ptr, drm_mach64_freelist_t, list); @@ -747,11 +747,11 @@ do { \ _buf = mach64_freelist_get( dev_priv ); \ if (_buf == NULL) { \ DRM_ERROR("couldn't get buffer in DMAGETPTR\n"); \ - return -EAGAIN; \ + return EAGAIN; \ } \ if (_buf->pending) { \ DRM_ERROR("pending buf in DMAGETPTR\n"); \ - return -EFAULT; \ + return EFAULT; \ } \ _buf->file_priv = file_priv; \ _outcount = 0; \ @@ -782,7 +782,7 @@ do { \ if (_buf->used <= 0) { \ DRM_ERROR( "DMAADVANCE(): sending empty buf %d\n", \ _buf->idx ); \ - return -EFAULT; \ + return EFAULT; \ } \ if (_buf->pending) { \ /* This is a resued buffer, so we need to find it in the pending list */ \ @@ -792,12 +792,12 @@ do { \ } \ if (_entry->discard) { \ DRM_ERROR( "DMAADVANCE(): sending discarded pending buf %d\n", _buf->idx ); \ - return -EFAULT; \ + return EFAULT; \ } \ } else { \ if (list_empty(&dev_priv->placeholders)) { \ DRM_ERROR( "DMAADVANCE(): empty placeholder list\n"); \ - return -EFAULT; \ + return EFAULT; \ } \ ptr = dev_priv->placeholders.next; \ list_del(ptr); \ @@ -835,11 +835,11 @@ do { \ \ if (_buf->used <= 0) { \ DRM_ERROR( "DMAADVANCEHOSTDATA(): sending empty buf %d\n", _buf->idx ); \ - return -EFAULT; \ + return EFAULT; \ } \ if (list_empty(&dev_priv->placeholders)) { \ DRM_ERROR( "empty placeholder list in DMAADVANCEHOSTDATA()\n" ); \ - return -EFAULT; \ + return EFAULT; \ } \ \ ptr = dev_priv->placeholders.next; \ diff --git a/sys/dev/pci/drm/mach64_irq.c b/sys/dev/pci/drm/mach64_irq.c index 57879e8d74c..0b350b2ffe2 100644 --- a/sys/dev/pci/drm/mach64_irq.c +++ b/sys/dev/pci/drm/mach64_irq.c @@ -86,7 +86,7 @@ int mach64_enable_vblank(struct drm_device * dev, int crtc) if (crtc != 0) { DRM_ERROR("tried to enable vblank on non-existent crtc %d\n", crtc); - return -EINVAL; + return EINVAL; } DRM_DEBUG("before enable vblank CRTC_INT_CTNL: 0x%08x\n", status); 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; diff --git a/sys/dev/pci/drm/mga_dma.c b/sys/dev/pci/drm/mga_dma.c index 52145252687..fd3db6d6ef0 100644 --- a/sys/dev/pci/drm/mga_dma.c +++ b/sys/dev/pci/drm/mga_dma.c @@ -71,7 +71,7 @@ int mga_do_wait_for_idle(drm_mga_private_t * dev_priv) DRM_ERROR("failed!\n"); DRM_INFO(" status=0x%08x\n", status); #endif - return -EBUSY; + return EBUSY; } 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 dev_priv->head = drm_calloc(1, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); if (dev_priv->head == NULL) - return -ENOMEM; + return ENOMEM; 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 entry = drm_calloc(1, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); if (entry == NULL) - return -ENOMEM; + return ENOMEM; entry->next = dev_priv->head->next; entry->prev = dev_priv->head; @@ -397,7 +397,7 @@ int mga_driver_load(struct drm_device *dev, unsigned long flags) dev_priv = drm_calloc(1, sizeof(drm_mga_private_t), DRM_MEM_DRIVER); if (!dev_priv) - return -ENOMEM; + return ENOMEM; dev->dev_private = (void *)dev_priv; @@ -548,7 +548,7 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev, agp_token = _entry->user_token; } if (!agp_token) - return -EFAULT; + return EFAULT; dev->agp_buffer_token = agp_token; } @@ -571,7 +571,7 @@ static int mga_do_agp_dma_bootstrap(struct drm_device *dev, DRM_ERROR("failed to ioremap agp regions! (%p, %p, %p)\n", dev_priv->warp->handle, dev_priv->primary->handle, dev->agp_buffer_map->handle); - return -ENOMEM; + return ENOMEM; } dev_priv->dma_access = MGA_PAGPXFER; @@ -609,7 +609,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device * dev, if (dev->dma == NULL) { DRM_ERROR("dev->dma is NULL\n"); - return -EFAULT; + return EFAULT; } /* Make drm_addbufs happy by not trying to create a mapping for less @@ -643,7 +643,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device * dev, if (err != 0) { DRM_ERROR("Unable to allocate primary DMA region: %d\n", err); - return -ENOMEM; + return ENOMEM; } if (dev_priv->primary->size != dma_bs->primary_size) { @@ -817,7 +817,7 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init) dev_priv->sarea = drm_getsarea(dev); if (!dev_priv->sarea) { DRM_ERROR("failed to find sarea!\n"); - return -EINVAL; + return EINVAL; } if (!dev_priv->used_new_dma_init) { @@ -828,29 +828,29 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init) dev_priv->status = drm_core_findmap(dev, init->status_offset); if (!dev_priv->status) { DRM_ERROR("failed to find status page!\n"); - return -EINVAL; + return EINVAL; } dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); if (!dev_priv->mmio) { DRM_ERROR("failed to find mmio region!\n"); - return -EINVAL; + return EINVAL; } dev_priv->warp = drm_core_findmap(dev, init->warp_offset); if (!dev_priv->warp) { DRM_ERROR("failed to find warp microcode region!\n"); - return -EINVAL; + return EINVAL; } dev_priv->primary = drm_core_findmap(dev, init->primary_offset); if (!dev_priv->primary) { DRM_ERROR("failed to find primary dma region!\n"); - return -EINVAL; + return EINVAL; } dev->agp_buffer_token = init->buffers_offset; dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); if (!dev->agp_buffer_map) { DRM_ERROR("failed to find dma buffer region!\n"); - return -EINVAL; + return EINVAL; } drm_core_ioremap(dev_priv->warp, dev); @@ -868,7 +868,7 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init) ((dev->agp_buffer_map == NULL) || (dev->agp_buffer_map->handle == NULL)))) { DRM_ERROR("failed to ioremap agp regions!\n"); - return -ENOMEM; + return ENOMEM; } ret = mga_warp_install_microcode(dev_priv); @@ -914,7 +914,7 @@ static int mga_do_init_dma(struct drm_device * dev, drm_mga_init_t * init) if (mga_freelist_init(dev, dev_priv) < 0) { DRM_ERROR("could not initialize freelist\n"); - return -ENOMEM; + return ENOMEM; } return 0; @@ -1011,7 +1011,7 @@ int mga_dma_init(struct drm_device *dev, void *data, return mga_do_cleanup_dma(dev, FULL_CLEANUP); } - return -EINVAL; + return EINVAL; } /* ================================================================ @@ -1041,7 +1041,7 @@ int mga_dma_flush(struct drm_device *dev, void *data, #if MGA_DMA_DEBUG int ret = mga_do_wait_for_idle(dev_priv); if (ret < 0) - DRM_INFO("-EBUSY\n"); + DRM_INFO("EBUSY\n"); return ret; #else return mga_do_wait_for_idle(dev_priv); @@ -1074,16 +1074,16 @@ static int mga_dma_get_buffers(struct drm_device * dev, for (i = d->granted_count; i < d->request_count; i++) { buf = mga_freelist_get(dev); if (!buf) - return -EAGAIN; + return EAGAIN; buf->file_priv = file_priv; if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx, sizeof(buf->idx))) - return -EFAULT; + return EFAULT; if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total, sizeof(buf->total))) - return -EFAULT; + return EFAULT; d->granted_count++; } @@ -1105,7 +1105,7 @@ int mga_dma_buffers(struct drm_device *dev, void *data, if (d->send_count != 0) { DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", DRM_CURRENTPID, d->send_count); - return -EINVAL; + return EINVAL; } /* We'll send you buffers. @@ -1113,7 +1113,7 @@ int mga_dma_buffers(struct drm_device *dev, void *data, if (d->request_count < 0 || d->request_count > dma->buf_count) { DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", DRM_CURRENTPID, d->request_count, dma->buf_count); - return -EINVAL; + return EINVAL; } WRAP_TEST_WITH_RETURN(dev_priv); diff --git a/sys/dev/pci/drm/mga_drv.h b/sys/dev/pci/drm/mga_drv.h index 23f9544162d..74d23a554bd 100644 --- a/sys/dev/pci/drm/mga_drv.h +++ b/sys/dev/pci/drm/mga_drv.h @@ -260,7 +260,7 @@ do { \ dev_priv->prim.high_mark ) { \ if ( MGA_DMA_DEBUG ) \ DRM_INFO( "wrap...\n"); \ - return -EBUSY; \ + return EBUSY; \ } \ } \ } while (0) @@ -271,7 +271,7 @@ do { \ if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { \ if ( MGA_DMA_DEBUG ) \ DRM_INFO( "wrap...\n"); \ - return -EBUSY; \ + return EBUSY; \ } \ mga_do_dma_wrap_end( dev_priv ); \ } \ diff --git a/sys/dev/pci/drm/mga_state.c b/sys/dev/pci/drm/mga_state.c index e467856e8e9..f13c60fcdaa 100644 --- a/sys/dev/pci/drm/mga_state.c +++ b/sys/dev/pci/drm/mga_state.c @@ -412,7 +412,7 @@ static int mga_verify_context(drm_mga_private_t * dev_priv) ctx->dstorg, dev_priv->front_offset, dev_priv->back_offset); ctx->dstorg = 0; - return -EINVAL; + return EINVAL; } return 0; @@ -431,7 +431,7 @@ static int mga_verify_tex(drm_mga_private_t * dev_priv, int unit) if (org == (MGA_TEXORGMAP_SYSMEM | MGA_TEXORGACC_PCI)) { DRM_ERROR("*** bad TEXORG: 0x%x, unit %d\n", tex->texorg, unit); tex->texorg = 0; - return -EINVAL; + return EINVAL; } return 0; @@ -473,13 +473,13 @@ static int mga_verify_iload(drm_mga_private_t * dev_priv, dstorg + length > (dev_priv->texture_offset + dev_priv->texture_size)) { DRM_ERROR("*** bad iload DSTORG: 0x%x\n", dstorg); - return -EINVAL; + return EINVAL; } if (length & MGA_ILOAD_MASK) { DRM_ERROR("*** bad iload length: 0x%x\n", length & MGA_ILOAD_MASK); - return -EINVAL; + return EINVAL; } return 0; @@ -491,7 +491,7 @@ static int mga_verify_blit(drm_mga_private_t * dev_priv, if ((srcorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) || (dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM)) { DRM_ERROR("*** bad blit: src=0x%x dst=0x%x\n", srcorg, dstorg); - return -EINVAL; + return EINVAL; } return 0; } @@ -915,7 +915,7 @@ int mga_dma_vertex(struct drm_device *dev, void *data, struct drm_file *file_pri LOCK_TEST_WITH_RETURN(dev, file_priv); if (vertex->idx < 0 || vertex->idx > dma->buf_count) - return -EINVAL; + return EINVAL; buf = dma->buflist[vertex->idx]; buf_priv = buf->dev_private; @@ -929,7 +929,7 @@ int mga_dma_vertex(struct drm_device *dev, void *data, struct drm_file *file_pri buf_priv->dispatched = 0; mga_freelist_put(dev, buf); } - return -EINVAL; + return EINVAL; } WRAP_TEST_WITH_RETURN(dev_priv); @@ -950,7 +950,7 @@ int mga_dma_indices(struct drm_device *dev, void *data, struct drm_file *file_pr LOCK_TEST_WITH_RETURN(dev, file_priv); if (indices->idx < 0 || indices->idx > dma->buf_count) - return -EINVAL; + return EINVAL; buf = dma->buflist[indices->idx]; buf_priv = buf->dev_private; @@ -964,7 +964,7 @@ int mga_dma_indices(struct drm_device *dev, void *data, struct drm_file *file_pr buf_priv->dispatched = 0; mga_freelist_put(dev, buf); } - return -EINVAL; + return EINVAL; } WRAP_TEST_WITH_RETURN(dev_priv); @@ -988,19 +988,19 @@ int mga_dma_iload(struct drm_device *dev, void *data, struct drm_file *file_priv #if 0 if (mga_do_wait_for_idle(dev_priv) < 0) { if (MGA_DMA_DEBUG) - DRM_INFO("-EBUSY\n"); - return -EBUSY; + DRM_INFO("EBUSY\n"); + return EBUSY; } #endif if (iload->idx < 0 || iload->idx > dma->buf_count) - return -EINVAL; + return EINVAL; buf = dma->buflist[iload->idx]; buf_priv = buf->dev_private; if (mga_verify_iload(dev_priv, iload->dstorg, iload->length)) { mga_freelist_put(dev, buf); - return -EINVAL; + return EINVAL; } WRAP_TEST_WITH_RETURN(dev_priv); @@ -1027,7 +1027,7 @@ int mga_dma_blit(struct drm_device *dev, void *data, struct drm_file *file_priv) sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; if (mga_verify_blit(dev_priv, blit->srcorg, blit->dstorg)) - return -EINVAL; + return EINVAL; WRAP_TEST_WITH_RETURN(dev_priv); @@ -1048,7 +1048,7 @@ int mga_getparam(struct drm_device *dev, void *data, struct drm_file *file_priv) if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("pid=%d\n", DRM_CURRENTPID); @@ -1061,12 +1061,12 @@ int mga_getparam(struct drm_device *dev, void *data, struct drm_file *file_priv) value = dev_priv->chipset; 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; @@ -1080,7 +1080,7 @@ int mga_set_fence(struct drm_device *dev, void *data, struct drm_file *file_priv if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("pid=%d\n", DRM_CURRENTPID); @@ -1109,7 +1109,7 @@ int mga_wait_fence(struct drm_device *dev, void *data, struct drm_file *file_pri if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("pid=%d\n", DRM_CURRENTPID); diff --git a/sys/dev/pci/drm/mga_warp.c b/sys/dev/pci/drm/mga_warp.c index 9a44bddbdd2..a0839ebde4c 100644 --- a/sys/dev/pci/drm/mga_warp.c +++ b/sys/dev/pci/drm/mga_warp.c @@ -146,7 +146,7 @@ int mga_warp_install_microcode(drm_mga_private_t * dev_priv) if (size > dev_priv->warp->size) { DRM_ERROR("microcode too large! (%u > %lu)\n", size, dev_priv->warp->size); - return -ENOMEM; + return ENOMEM; } switch (dev_priv->chipset) { @@ -156,7 +156,7 @@ int mga_warp_install_microcode(drm_mga_private_t * dev_priv) case MGA_CARD_TYPE_G200: return mga_warp_install_g200_microcode(dev_priv); default: - return -EINVAL; + return EINVAL; } } @@ -182,7 +182,7 @@ int mga_warp_init(drm_mga_private_t * dev_priv) MGA_WRITE(MGA_WVRTXSZ, 7); break; default: - return -EINVAL; + return EINVAL; } MGA_WRITE(MGA_WMISC, (MGA_WUCODECACHE_ENABLE | @@ -191,7 +191,7 @@ int mga_warp_init(drm_mga_private_t * dev_priv) if (wmisc != WMISC_EXPECTED) { DRM_ERROR("WARP engine config failed! 0x%x != 0x%x\n", wmisc, WMISC_EXPECTED); - return -EINVAL; + return EINVAL; } return 0; diff --git a/sys/dev/pci/drm/r128_cce.c b/sys/dev/pci/drm/r128_cce.c index cfe02b701d6..2bc5efe32ce 100644 --- a/sys/dev/pci/drm/r128_cce.c +++ b/sys/dev/pci/drm/r128_cce.c @@ -129,7 +129,7 @@ static int r128_do_pixcache_flush(drm_r128_private_t * dev_priv) #if R128_FIFO_DEBUG DRM_ERROR("failed!\n"); #endif - return -EBUSY; + return EBUSY; } static int r128_do_wait_for_fifo(drm_r128_private_t * dev_priv, int entries) @@ -146,7 +146,7 @@ static int r128_do_wait_for_fifo(drm_r128_private_t * dev_priv, int entries) #if R128_FIFO_DEBUG DRM_ERROR("failed!\n"); #endif - return -EBUSY; + return EBUSY; } static int r128_do_wait_for_idle(drm_r128_private_t * dev_priv) @@ -168,7 +168,7 @@ static int r128_do_wait_for_idle(drm_r128_private_t * dev_priv) #if R128_FIFO_DEBUG DRM_ERROR("failed!\n"); #endif - return -EBUSY; + return EBUSY; } /* ================================================================ @@ -227,7 +227,7 @@ int r128_do_cce_idle(drm_r128_private_t * dev_priv) DRM_ERROR("failed!\n"); r128_status(dev_priv); #endif - return -EBUSY; + return EBUSY; } /* Start the Concurrent Command Engine. @@ -355,7 +355,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) dev_priv = drm_calloc(1, sizeof(drm_r128_private_t), DRM_MEM_DRIVER); if (dev_priv == NULL) - return -ENOMEM; + return ENOMEM; dev_priv->is_pci = init->is_pci; @@ -363,7 +363,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) DRM_ERROR("PCI GART memory not allocated!\n"); dev->dev_private = (void *)dev_priv; r128_do_cleanup_cce(dev); - return -EINVAL; + return EINVAL; } dev_priv->usec_timeout = init->usec_timeout; @@ -372,7 +372,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) DRM_DEBUG("TIMEOUT problem!\n"); dev->dev_private = (void *)dev_priv; r128_do_cleanup_cce(dev); - return -EINVAL; + return EINVAL; } dev_priv->cce_mode = init->cce_mode; @@ -392,7 +392,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) DRM_DEBUG("Bad cce_mode!\n"); dev->dev_private = (void *)dev_priv; r128_do_cleanup_cce(dev); - return -EINVAL; + return EINVAL; } switch (init->cce_mode) { @@ -459,7 +459,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) DRM_ERROR("could not find sarea!\n"); dev->dev_private = (void *)dev_priv; r128_do_cleanup_cce(dev); - return -EINVAL; + return EINVAL; } dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); @@ -467,21 +467,21 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) DRM_ERROR("could not find mmio region!\n"); dev->dev_private = (void *)dev_priv; r128_do_cleanup_cce(dev); - return -EINVAL; + return EINVAL; } dev_priv->cce_ring = drm_core_findmap(dev, init->ring_offset); if (!dev_priv->cce_ring) { DRM_ERROR("could not find cce ring region!\n"); dev->dev_private = (void *)dev_priv; r128_do_cleanup_cce(dev); - return -EINVAL; + return EINVAL; } dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset); if (!dev_priv->ring_rptr) { DRM_ERROR("could not find ring read pointer!\n"); dev->dev_private = (void *)dev_priv; r128_do_cleanup_cce(dev); - return -EINVAL; + return EINVAL; } dev->agp_buffer_token = init->buffers_offset; dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); @@ -489,7 +489,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) DRM_ERROR("could not find dma buffer region!\n"); dev->dev_private = (void *)dev_priv; r128_do_cleanup_cce(dev); - return -EINVAL; + return EINVAL; } if (!dev_priv->is_pci) { @@ -499,7 +499,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) DRM_ERROR("could not find agp texture region!\n"); dev->dev_private = (void *)dev_priv; r128_do_cleanup_cce(dev); - return -EINVAL; + return EINVAL; } } @@ -518,7 +518,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) DRM_ERROR("Could not ioremap agp regions!\n"); dev->dev_private = (void *)dev_priv; r128_do_cleanup_cce(dev); - return -ENOMEM; + return ENOMEM; } } else #endif @@ -566,7 +566,7 @@ static int r128_do_init_cce(struct drm_device * dev, drm_r128_init_t * init) DRM_ERROR("failed to init PCI GART!\n"); dev->dev_private = (void *)dev_priv; r128_do_cleanup_cce(dev); - return -ENOMEM; + return ENOMEM; } R128_WRITE(R128_PCI_GART_PAGE, dev_priv->gart_info.bus_addr); #if __OS_HAS_AGP @@ -637,7 +637,7 @@ int r128_cce_init(struct drm_device *dev, void *data, struct drm_file *file_priv return r128_do_cleanup_cce(dev); } - return -EINVAL; + return EINVAL; } int r128_cce_start(struct drm_device *dev, void *data, struct drm_file *file_priv) @@ -708,7 +708,7 @@ int r128_cce_reset(struct drm_device *dev, void *data, struct drm_file *file_pri if (!dev_priv) { DRM_DEBUG("called before init done\n"); - return -EINVAL; + return EINVAL; } r128_do_cce_reset(dev_priv); @@ -744,7 +744,7 @@ int r128_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_ int r128_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_priv) { - return -EINVAL; + return EINVAL; } /* ================================================================ @@ -766,7 +766,7 @@ static int r128_freelist_init(struct drm_device * dev) dev_priv->head = drm_calloc(1, sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER); if (dev_priv->head == NULL) - return -ENOMEM; + return ENOMEM; dev_priv->head->age = R128_BUFFER_USED; @@ -776,7 +776,7 @@ static int r128_freelist_init(struct drm_device * dev) entry = drm_alloc(sizeof(drm_r128_freelist_t), DRM_MEM_DRIVER); if (!entry) - return -ENOMEM; + return ENOMEM; entry->age = R128_BUFFER_FREE; entry->buf = buf; @@ -868,7 +868,7 @@ int r128_wait_ring(drm_r128_private_t * dev_priv, int n) /* FIXME: This is being ignored... */ DRM_ERROR("failed!\n"); - return -EBUSY; + return EBUSY; } static int r128_cce_get_buffers(struct drm_device * dev, @@ -881,16 +881,16 @@ static int r128_cce_get_buffers(struct drm_device * dev, for (i = d->granted_count; i < d->request_count; i++) { buf = r128_freelist_get(dev); if (!buf) - return -EAGAIN; + return EAGAIN; buf->file_priv = file_priv; if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx, sizeof(buf->idx))) - return -EFAULT; + return EFAULT; if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total, sizeof(buf->total))) - return -EFAULT; + return EFAULT; d->granted_count++; } @@ -910,7 +910,7 @@ int r128_cce_buffers(struct drm_device *dev, void *data, struct drm_file *file_p if (d->send_count != 0) { DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", DRM_CURRENTPID, d->send_count); - return -EINVAL; + return EINVAL; } /* We'll send you buffers. @@ -918,7 +918,7 @@ int r128_cce_buffers(struct drm_device *dev, void *data, struct drm_file *file_p if (d->request_count < 0 || d->request_count > dma->buf_count) { DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", DRM_CURRENTPID, d->request_count, dma->buf_count); - return -EINVAL; + return EINVAL; } d->granted_count = 0; diff --git a/sys/dev/pci/drm/r128_drv.h b/sys/dev/pci/drm/r128_drv.h index bb4ebe019d0..96f71d4aec4 100644 --- a/sys/dev/pci/drm/r128_drv.h +++ b/sys/dev/pci/drm/r128_drv.h @@ -439,7 +439,7 @@ do { \ DRM_UDELAY(1); \ } \ DRM_ERROR( "ring space check failed!\n" ); \ - return -EBUSY; \ + return EBUSY; \ } \ __ring_space_done: \ ; \ diff --git a/sys/dev/pci/drm/r128_state.c b/sys/dev/pci/drm/r128_state.c index 6cb64880491..11f8e152c37 100644 --- a/sys/dev/pci/drm/r128_state.c +++ b/sys/dev/pci/drm/r128_state.c @@ -809,7 +809,7 @@ static int r128_cce_dispatch_blit(struct drm_device * dev, break; default: DRM_ERROR("invalid blit format %d\n", blit->format); - return -EINVAL; + return EINVAL; } /* Flush the pixel cache, and mark the contents as Read Invalid. @@ -832,11 +832,11 @@ static int r128_cce_dispatch_blit(struct drm_device * dev, if (buf->file_priv != file_priv) { DRM_ERROR("process %d using buffer owned by %p\n", DRM_CURRENTPID, buf->file_priv); - return -EINVAL; + return EINVAL; } if (buf->pending) { DRM_ERROR("sending pending buffer %d\n", blit->idx); - return -EINVAL; + return EINVAL; } buf_priv->discard = 1; @@ -900,22 +900,22 @@ static int r128_cce_dispatch_write_span(struct drm_device * dev, count = depth->n; if (count > 4096 || count <= 0) - return -EMSGSIZE; + return EMSGSIZE; if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) { - return -EFAULT; + return EFAULT; } if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) { - return -EFAULT; + return EFAULT; } buffer_size = depth->n * sizeof(u32); buffer = drm_alloc(buffer_size, DRM_MEM_BUFS); if (buffer == NULL) - return -ENOMEM; + return ENOMEM; if (DRM_COPY_FROM_USER(buffer, depth->buffer, buffer_size)) { drm_free(buffer, buffer_size, DRM_MEM_BUFS); - return -EFAULT; + return EFAULT; } mask_size = depth->n * sizeof(u8); @@ -923,12 +923,12 @@ static int r128_cce_dispatch_write_span(struct drm_device * dev, mask = drm_alloc(mask_size, DRM_MEM_BUFS); if (mask == NULL) { drm_free(buffer, buffer_size, DRM_MEM_BUFS); - return -ENOMEM; + return ENOMEM; } if (DRM_COPY_FROM_USER(mask, depth->mask, mask_size)) { drm_free(buffer, buffer_size, DRM_MEM_BUFS); drm_free(mask, mask_size, DRM_MEM_BUFS); - return -EFAULT; + return EFAULT; } for (i = 0; i < count; i++, x++) { @@ -996,28 +996,28 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev, count = depth->n; if (count > 4096 || count <= 0) - return -EMSGSIZE; + return EMSGSIZE; xbuf_size = count * sizeof(*x); ybuf_size = count * sizeof(*y); x = drm_alloc(xbuf_size, DRM_MEM_BUFS); if (x == NULL) { - return -ENOMEM; + return ENOMEM; } y = drm_alloc(ybuf_size, DRM_MEM_BUFS); if (y == NULL) { drm_free(x, xbuf_size, DRM_MEM_BUFS); - return -ENOMEM; + return ENOMEM; } if (DRM_COPY_FROM_USER(x, depth->x, xbuf_size)) { drm_free(x, xbuf_size, DRM_MEM_BUFS); drm_free(y, ybuf_size, DRM_MEM_BUFS); - return -EFAULT; + return EFAULT; } if (DRM_COPY_FROM_USER(y, depth->y, xbuf_size)) { drm_free(x, xbuf_size, DRM_MEM_BUFS); drm_free(y, ybuf_size, DRM_MEM_BUFS); - return -EFAULT; + return EFAULT; } buffer_size = depth->n * sizeof(u32); @@ -1025,13 +1025,13 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev, if (buffer == NULL) { drm_free(x, xbuf_size, DRM_MEM_BUFS); drm_free(y, ybuf_size, DRM_MEM_BUFS); - return -ENOMEM; + return ENOMEM; } if (DRM_COPY_FROM_USER(buffer, depth->buffer, buffer_size)) { drm_free(x, xbuf_size, DRM_MEM_BUFS); drm_free(y, ybuf_size, DRM_MEM_BUFS); drm_free(buffer, buffer_size, DRM_MEM_BUFS); - return -EFAULT; + return EFAULT; } if (depth->mask) { @@ -1041,14 +1041,14 @@ static int r128_cce_dispatch_write_pixels(struct drm_device * dev, drm_free(x, xbuf_size, DRM_MEM_BUFS); drm_free(y, ybuf_size, DRM_MEM_BUFS); drm_free(buffer, buffer_size, DRM_MEM_BUFS); - return -ENOMEM; + return ENOMEM; } if (DRM_COPY_FROM_USER(mask, depth->mask, mask_size)) { drm_free(x, xbuf_size, DRM_MEM_BUFS); drm_free(y, ybuf_size, DRM_MEM_BUFS); drm_free(buffer, buffer_size, DRM_MEM_BUFS); drm_free(mask, mask_size, DRM_MEM_BUFS); - return -EFAULT; + return EFAULT; } for (i = 0; i < count; i++) { @@ -1115,13 +1115,13 @@ static int r128_cce_dispatch_read_span(struct drm_device * dev, count = depth->n; if (count > 4096 || count <= 0) - return -EMSGSIZE; + return EMSGSIZE; if (DRM_COPY_FROM_USER(&x, depth->x, sizeof(x))) { - return -EFAULT; + return EFAULT; } if (DRM_COPY_FROM_USER(&y, depth->y, sizeof(y))) { - return -EFAULT; + return EFAULT; } BEGIN_RING(7); @@ -1159,7 +1159,7 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev, count = depth->n; if (count > 4096 || count <= 0) - return -EMSGSIZE; + return EMSGSIZE; if (count > dev_priv->depth_pitch) { count = dev_priv->depth_pitch; @@ -1169,22 +1169,22 @@ static int r128_cce_dispatch_read_pixels(struct drm_device * dev, ybuf_size = count * sizeof(*y); x = drm_alloc(xbuf_size, DRM_MEM_BUFS); if (x == NULL) { - return -ENOMEM; + return ENOMEM; } y = drm_alloc(ybuf_size, DRM_MEM_BUFS); if (y == NULL) { drm_free(x, xbuf_size, DRM_MEM_BUFS); - return -ENOMEM; + return ENOMEM; } if (DRM_COPY_FROM_USER(x, depth->x, xbuf_size)) { drm_free(x, xbuf_size, DRM_MEM_BUFS); drm_free(y, ybuf_size, DRM_MEM_BUFS); - return -EFAULT; + return EFAULT; } if (DRM_COPY_FROM_USER(y, depth->y, ybuf_size)) { drm_free(x, xbuf_size, DRM_MEM_BUFS); drm_free(y, ybuf_size, DRM_MEM_BUFS); - return -EFAULT; + return EFAULT; } for (i = 0; i < count; i++) { @@ -1356,7 +1356,7 @@ int r128_cce_vertex(struct drm_device *dev, void *data, struct drm_file *file_pr if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("pid=%d index=%d count=%d discard=%d\n", @@ -1365,12 +1365,12 @@ int r128_cce_vertex(struct drm_device *dev, void *data, struct drm_file *file_pr if (vertex->idx < 0 || vertex->idx >= dma->buf_count) { DRM_ERROR("buffer index %d (of %d max)\n", vertex->idx, dma->buf_count - 1); - return -EINVAL; + return EINVAL; } if (vertex->prim < 0 || vertex->prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) { DRM_ERROR("buffer prim %d\n", vertex->prim); - return -EINVAL; + return EINVAL; } RING_SPACE_TEST_WITH_RETURN(dev_priv); @@ -1382,11 +1382,11 @@ int r128_cce_vertex(struct drm_device *dev, void *data, struct drm_file *file_pr if (buf->file_priv != file_priv) { DRM_ERROR("process %d using buffer owned by %p\n", DRM_CURRENTPID, buf->file_priv); - return -EINVAL; + return EINVAL; } if (buf->pending) { DRM_ERROR("sending pending buffer %d\n", vertex->idx); - return -EINVAL; + return EINVAL; } buf->used = vertex->count; @@ -1412,7 +1412,7 @@ int r128_cce_indices(struct drm_device *dev, void *data, struct drm_file *file_p if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("pid=%d buf=%d s=%d e=%d d=%d\n", DRM_CURRENTPID, @@ -1421,12 +1421,12 @@ int r128_cce_indices(struct drm_device *dev, void *data, struct drm_file *file_p if (elts->idx < 0 || elts->idx >= dma->buf_count) { DRM_ERROR("buffer index %d (of %d max)\n", elts->idx, dma->buf_count - 1); - return -EINVAL; + return EINVAL; } if (elts->prim < 0 || elts->prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2) { DRM_ERROR("buffer prim %d\n", elts->prim); - return -EINVAL; + return EINVAL; } RING_SPACE_TEST_WITH_RETURN(dev_priv); @@ -1438,11 +1438,11 @@ int r128_cce_indices(struct drm_device *dev, void *data, struct drm_file *file_p if (buf->file_priv != file_priv) { DRM_ERROR("process %d using buffer owned by %p\n", DRM_CURRENTPID, buf->file_priv); - return -EINVAL; + return EINVAL; } if (buf->pending) { DRM_ERROR("sending pending buffer %d\n", elts->idx); - return -EINVAL; + return EINVAL; } count = (elts->end - elts->start) / sizeof(u16); @@ -1450,11 +1450,11 @@ int r128_cce_indices(struct drm_device *dev, void *data, struct drm_file *file_p if (elts->start & 0x7) { DRM_ERROR("misaligned buffer 0x%x\n", elts->start); - return -EINVAL; + return EINVAL; } if (elts->start < buf->used) { DRM_ERROR("no header 0x%x - 0x%x\n", elts->start, buf->used); - return -EINVAL; + return EINVAL; } buf->used = elts->end; @@ -1481,7 +1481,7 @@ int r128_cce_blit(struct drm_device *dev, void *data, struct drm_file *file_priv if (blit->idx < 0 || blit->idx >= dma->buf_count) { DRM_ERROR("buffer index %d (of %d max)\n", blit->idx, dma->buf_count - 1); - return -EINVAL; + return EINVAL; } RING_SPACE_TEST_WITH_RETURN(dev_priv); @@ -1503,7 +1503,7 @@ int r128_cce_depth(struct drm_device *dev, void *data, struct drm_file *file_pri RING_SPACE_TEST_WITH_RETURN(dev_priv); - ret = -EINVAL; + ret = EINVAL; switch (depth->func) { case R128_WRITE_SPAN: ret = r128_cce_dispatch_write_span(dev, depth); @@ -1532,7 +1532,7 @@ int r128_cce_stipple(struct drm_device *dev, void *data, struct drm_file *file_p LOCK_TEST_WITH_RETURN(dev, file_priv); if (DRM_COPY_FROM_USER(&mask, stipple->mask, 32 * sizeof(u32))) - return -EFAULT; + return EFAULT; RING_SPACE_TEST_WITH_RETURN(dev_priv); @@ -1557,7 +1557,7 @@ int r128_cce_indirect(struct drm_device *dev, void *data, struct drm_file *file_ if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("idx=%d s=%d e=%d d=%d\n", @@ -1567,7 +1567,7 @@ int r128_cce_indirect(struct drm_device *dev, void *data, struct drm_file *file_ if (indirect->idx < 0 || indirect->idx >= dma->buf_count) { DRM_ERROR("buffer index %d (of %d max)\n", indirect->idx, dma->buf_count - 1); - return -EINVAL; + return EINVAL; } buf = dma->buflist[indirect->idx]; @@ -1576,17 +1576,17 @@ int r128_cce_indirect(struct drm_device *dev, void *data, struct drm_file *file_ if (buf->file_priv != file_priv) { DRM_ERROR("process %d using buffer owned by %p\n", DRM_CURRENTPID, buf->file_priv); - return -EINVAL; + return EINVAL; } if (buf->pending) { DRM_ERROR("sending pending buffer %d\n", indirect->idx); - return -EINVAL; + return EINVAL; } if (indirect->start < buf->used) { DRM_ERROR("reusing indirect: start=0x%x actual=0x%x\n", indirect->start, buf->used); - return -EINVAL; + return EINVAL; } RING_SPACE_TEST_WITH_RETURN(dev_priv); @@ -1622,7 +1622,7 @@ int r128_getparam(struct drm_device *dev, void *data, struct drm_file *file_priv if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("pid=%d\n", DRM_CURRENTPID); @@ -1632,12 +1632,12 @@ int r128_getparam(struct drm_device *dev, void *data, struct drm_file *file_priv 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; diff --git a/sys/dev/pci/drm/r300_cmdbuf.c b/sys/dev/pci/drm/r300_cmdbuf.c index b1d74032843..f1f49fcf6fa 100644 --- a/sys/dev/pci/drm/r300_cmdbuf.c +++ b/sys/dev/pci/drm/r300_cmdbuf.c @@ -74,7 +74,7 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv, if (DRM_COPY_FROM_USER_UNCHECKED (&box, &cmdbuf->boxes[n + i], sizeof(box))) { DRM_ERROR("copy cliprect faulted\n"); - return -EFAULT; + return EFAULT; } box.x2--; /* Hardware expects inclusive bottom-right corner */ @@ -302,7 +302,7 @@ static __inline__ int r300_emit_carefully_checked_packet0(drm_radeon_private_t * DRM_ERROR ("Cannot emit more than 64 values at a time (reg=%04x sz=%d)\n", reg, sz); - return -EINVAL; + return EINVAL; } for (i = 0; i < sz; i++) { values[i] = ((int *)cmdbuf->buf)[i]; @@ -314,13 +314,13 @@ static __inline__ int r300_emit_carefully_checked_packet0(drm_radeon_private_t * DRM_ERROR ("Offset failed range check (reg=%04x sz=%d)\n", reg, sz); - return -EINVAL; + return EINVAL; } break; default: DRM_ERROR("Register %04x failed check as flag=%02x\n", reg + i * 4, r300_reg_flags[(reg >> 2) + i]); - return -EINVAL; + return EINVAL; } } @@ -357,12 +357,12 @@ static __inline__ int r300_emit_packet0(drm_radeon_private_t *dev_priv, return 0; if (sz * 4 > cmdbuf->bufsz) - return -EINVAL; + return EINVAL; if (reg + sz * 4 >= 0x10000) { DRM_ERROR("No such registers in hardware reg=%04x sz=%d\n", reg, sz); - return -EINVAL; + return EINVAL; } if (r300_check_range(reg, sz)) { @@ -402,7 +402,7 @@ static __inline__ int r300_emit_vpu(drm_radeon_private_t *dev_priv, if (!sz) return 0; if (sz * 16 > cmdbuf->bufsz) - return -EINVAL; + return EINVAL; /* VAP is very sensitive so we purge cache before we program it * and we also flush its state before & after */ @@ -444,7 +444,7 @@ static __inline__ int r300_emit_clear(drm_radeon_private_t *dev_priv, RING_LOCALS; if (8 * 4 > cmdbuf->bufsz) - return -EINVAL; + return EINVAL; BEGIN_RING(10); OUT_RING(CP_PACKET3(R200_3D_DRAW_IMMD_2, 8)); @@ -483,7 +483,7 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv, if ((count + 1) > MAX_ARRAY_PACKET) { DRM_ERROR("Too large payload in 3D_LOAD_VBPNTR (count=%d)\n", count); - return -EINVAL; + return EINVAL; } memset(payload, 0, MAX_ARRAY_PACKET * 4); memcpy(payload, cmdbuf->buf + 4, (count + 1) * 4); @@ -499,7 +499,7 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv, DRM_ERROR ("Offset failed range check (k=%d i=%d) while processing 3D_LOAD_VBPNTR packet.\n", k, i); - return -EINVAL; + return EINVAL; } k++; i++; @@ -510,7 +510,7 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv, DRM_ERROR ("Offset failed range check (k=%d i=%d) while processing 3D_LOAD_VBPNTR packet.\n", k, i); - return -EINVAL; + return EINVAL; } k++; i++; @@ -520,7 +520,7 @@ static __inline__ int r300_emit_3d_load_vbpntr(drm_radeon_private_t *dev_priv, DRM_ERROR ("Malformed 3D_LOAD_VBPNTR packet (k=%d i=%d narrays=%d count+1=%d).\n", k, i, narrays, count + 1); - return -EINVAL; + return EINVAL; } /* all clear, output packet */ @@ -554,7 +554,7 @@ static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv, ret = !radeon_check_offset(dev_priv, offset); if (ret) { DRM_ERROR("Invalid bitblt first offset is %08X\n", offset); - return -EINVAL; + return EINVAL; } } @@ -564,7 +564,7 @@ static __inline__ int r300_emit_bitblt_multi(drm_radeon_private_t *dev_priv, ret = !radeon_check_offset(dev_priv, offset); if (ret) { DRM_ERROR("Invalid bitblt second offset is %08X\n", offset); - return -EINVAL; + return EINVAL; } } @@ -598,7 +598,7 @@ static __inline__ int r300_emit_draw_indx_2(drm_radeon_private_t *dev_priv, if (count && count != expected_count) { DRM_ERROR("3D_DRAW_INDX_2: packet size %i, expected %i\n", count, expected_count); - return -EINVAL; + return EINVAL; } BEGIN_RING(count+2); @@ -614,7 +614,7 @@ static __inline__ int r300_emit_draw_indx_2(drm_radeon_private_t *dev_priv, if (cmdbuf->bufsz < 4*4 + sizeof(header)) { DRM_ERROR("3D_DRAW_INDX_2: expect subsequent INDX_BUFFER, but stream is too short.\n"); - return -EINVAL; + return EINVAL; } header.u = *(unsigned int *)cmdbuf->buf; @@ -627,21 +627,21 @@ static __inline__ int r300_emit_draw_indx_2(drm_radeon_private_t *dev_priv, header.packet3.packet != R300_CMD_PACKET3_RAW || cmd[0] != CP_PACKET3(RADEON_CP_INDX_BUFFER, 2)) { DRM_ERROR("3D_DRAW_INDX_2: expect subsequent INDX_BUFFER.\n"); - return -EINVAL; + return EINVAL; } if ((cmd[1] & 0x8000ffff) != 0x80000810) { DRM_ERROR("Invalid indx_buffer reg address %08X\n", cmd[1]); - return -EINVAL; + return EINVAL; } if (!radeon_check_offset(dev_priv, cmd[2])) { DRM_ERROR("Invalid indx_buffer offset is %08X\n", cmd[2]); - return -EINVAL; + return EINVAL; } if (cmd[3] != expected_count) { DRM_ERROR("INDX_BUFFER: buffer size %i, expected %i\n", cmd[3], expected_count); - return -EINVAL; + return EINVAL; } BEGIN_RING(4); @@ -664,7 +664,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, RING_LOCALS; if (4 > cmdbuf->bufsz) - return -EINVAL; + return EINVAL; /* Fixme !! This simply emits a packet without much checking. We need to be smarter. */ @@ -675,7 +675,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, /* Is it packet 3 ? */ if ((header >> 30) != 0x3) { DRM_ERROR("Not a packet3 header (0x%08x)\n", header); - return -EINVAL; + return EINVAL; } count = (header >> 16) & 0x3fff; @@ -685,7 +685,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, DRM_ERROR ("Expected packet3 of length %d but have only %d bytes left\n", (count + 2) * 4, cmdbuf->bufsz); - return -EINVAL; + return EINVAL; } /* Is it a packet type we know about ? */ @@ -698,7 +698,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, case RADEON_CP_INDX_BUFFER: DRM_ERROR("packet3 INDX_BUFFER without preceding 3D_DRAW_INDX_2 is illegal.\n"); - return -EINVAL; + return EINVAL; case RADEON_CP_3D_DRAW_IMMD_2: /* triggers drawing using in-packet vertex data */ case RADEON_CP_3D_DRAW_VBUF_2: @@ -718,7 +718,7 @@ static __inline__ int r300_emit_raw_packet3(drm_radeon_private_t *dev_priv, break; default: DRM_ERROR("Unknown packet3 header (0x%08x)\n", header); - return -EINVAL; + return EINVAL; } BEGIN_RING(count + 2); @@ -782,7 +782,7 @@ static __inline__ int r300_emit_packet3(drm_radeon_private_t *dev_priv, DRM_ERROR("bad packet3 type %i at %p\n", header.packet3.packet, cmdbuf->buf - sizeof(header)); - return -EINVAL; + return EINVAL; } n += R300_SIMULTANEOUS_CLIPRECTS; @@ -921,11 +921,11 @@ static int r300_scratch(drm_radeon_private_t *dev_priv, RING_LOCALS; if (cmdbuf->bufsz < sizeof(uint64_t) + header.scratch.n_bufs * sizeof(buf_idx) ) { - return -EINVAL; + return EINVAL; } if (header.scratch.reg >= 5) { - return -EINVAL; + return EINVAL; } dev_priv->scratch_ages[header.scratch.reg] ++; @@ -940,21 +940,21 @@ static int r300_scratch(drm_radeon_private_t *dev_priv, buf_idx *= 2; /* 8 bytes per buf */ if (DRM_COPY_TO_USER(ref_age_base + buf_idx, &dev_priv->scratch_ages[header.scratch.reg], sizeof(u32))) { - return -EINVAL; + return EINVAL; } if (DRM_COPY_FROM_USER(&h_pending, ref_age_base + buf_idx + 1, sizeof(u32))) { - return -EINVAL; + return EINVAL; } if (h_pending == 0) { - return -EINVAL; + return EINVAL; } h_pending--; if (DRM_COPY_TO_USER(ref_age_base + buf_idx + 1, &h_pending, sizeof(u32))) { - return -EINVAL; + return EINVAL; } cmdbuf->buf += sizeof(buf_idx); @@ -1001,7 +1001,7 @@ static __inline__ int r300_emit_r500fp(drm_radeon_private_t *dev_priv, if (!sz) return 0; if (sz * stride * 4 > cmdbuf->bufsz) - return -EINVAL; + return EINVAL; BEGIN_RING(3 + sz * stride); OUT_RING_REG(R500_GA_US_VECTOR_INDEX, addr); @@ -1119,7 +1119,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, if (idx < 0 || idx >= dma->buf_count) { DRM_ERROR("buffer index %d (of %d max)\n", idx, dma->buf_count - 1); - ret = -EINVAL; + ret = EINVAL; goto cleanup; } @@ -1128,7 +1128,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, DRM_ERROR("bad buffer %p %p %d\n", buf->file_priv, file_priv, buf->pending); - ret = -EINVAL; + ret = EINVAL; goto cleanup; } @@ -1153,7 +1153,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, case R300_CMD_R500FP: if ((dev_priv->flags & RADEON_FAMILY_MASK) < CHIP_RV515) { DRM_ERROR("Calling r500 command on r300 card\n"); - ret = -EINVAL; + ret = EINVAL; goto cleanup; } DRM_DEBUG("R300_CMD_R500FP\n"); @@ -1167,7 +1167,7 @@ int r300_do_cp_cmdbuf(struct drm_device *dev, DRM_ERROR("bad cmd_type %i at %p\n", header.header.cmd_type, cmdbuf->buf - sizeof(header)); - ret = -EINVAL; + ret = EINVAL; goto cleanup; } } diff --git a/sys/dev/pci/drm/radeon_cp.c b/sys/dev/pci/drm/radeon_cp.c index 5c9da607c7c..a69d33747a5 100644 --- a/sys/dev/pci/drm/radeon_cp.c +++ b/sys/dev/pci/drm/radeon_cp.c @@ -207,7 +207,7 @@ static int radeon_do_pixcache_flush(drm_radeon_private_t * dev_priv) DRM_ERROR("failed!\n"); radeon_status(dev_priv); #endif - return -EBUSY; + return EBUSY; } static int radeon_do_wait_for_fifo(drm_radeon_private_t * dev_priv, int entries) @@ -231,7 +231,7 @@ static int radeon_do_wait_for_fifo(drm_radeon_private_t * dev_priv, int entries) DRM_ERROR("failed!\n"); radeon_status(dev_priv); #endif - return -EBUSY; + return EBUSY; } static int radeon_do_wait_for_idle(drm_radeon_private_t * dev_priv) @@ -260,7 +260,7 @@ static int radeon_do_wait_for_idle(drm_radeon_private_t * dev_priv) DRM_ERROR("failed!\n"); radeon_status(dev_priv); #endif - return -EBUSY; + return EBUSY; } static void radeon_init_pipes(drm_radeon_private_t * dev_priv) @@ -860,7 +860,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) if ((dev_priv->flags & RADEON_NEW_MEMMAP) && !dev_priv->new_memmap) { DRM_ERROR("Cannot initialise DRM on this card\nThis card requires a new X.org DDX for 3D\n"); radeon_do_cleanup_cp(dev); - return -EINVAL; + return EINVAL; } if (init->is_pci && (dev_priv->flags & RADEON_IS_AGP)) @@ -878,7 +878,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) if ((!(dev_priv->flags & RADEON_IS_AGP)) && !dev->sg) { DRM_ERROR("PCI GART memory not allocated!\n"); radeon_do_cleanup_cp(dev); - return -EINVAL; + return EINVAL; } dev_priv->usec_timeout = init->usec_timeout; @@ -886,7 +886,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) dev_priv->usec_timeout > RADEON_MAX_USEC_TIMEOUT) { DRM_DEBUG("TIMEOUT problem!\n"); radeon_do_cleanup_cp(dev); - return -EINVAL; + return EINVAL; } /* Enable vblank on CRTC1 for older X servers @@ -904,7 +904,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) (init->cp_mode != RADEON_CSQ_PRIBM_INDBM)) { DRM_DEBUG("BAD cp_mode (%x)!\n", init->cp_mode); radeon_do_cleanup_cp(dev); - return -EINVAL; + return EINVAL; } switch (init->fb_bpp) { @@ -972,27 +972,27 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) if (!dev_priv->sarea) { DRM_ERROR("could not find sarea!\n"); radeon_do_cleanup_cp(dev); - return -EINVAL; + return EINVAL; } dev_priv->cp_ring = drm_core_findmap(dev, init->ring_offset); if (!dev_priv->cp_ring) { DRM_ERROR("could not find cp ring region!\n"); radeon_do_cleanup_cp(dev); - return -EINVAL; + return EINVAL; } dev_priv->ring_rptr = drm_core_findmap(dev, init->ring_rptr_offset); if (!dev_priv->ring_rptr) { DRM_ERROR("could not find ring read pointer!\n"); radeon_do_cleanup_cp(dev); - return -EINVAL; + return EINVAL; } dev->agp_buffer_token = init->buffers_offset; dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset); if (!dev->agp_buffer_map) { DRM_ERROR("could not find dma buffer region!\n"); radeon_do_cleanup_cp(dev); - return -EINVAL; + return EINVAL; } if (init->gart_textures_offset) { @@ -1001,7 +1001,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) if (!dev_priv->gart_textures) { DRM_ERROR("could not find GART texture region!\n"); radeon_do_cleanup_cp(dev); - return -EINVAL; + return EINVAL; } } @@ -1019,7 +1019,7 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) !dev->agp_buffer_map->handle) { DRM_ERROR("could not find ioremap agp regions!\n"); radeon_do_cleanup_cp(dev); - return -EINVAL; + return EINVAL; } } else #endif @@ -1173,14 +1173,14 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init) DRM_ERROR ("Cannot use PCI Express without GART in FB memory\n"); radeon_do_cleanup_cp(dev); - return -EINVAL; + return EINVAL; } } if (!drm_ati_pcigart_init(dev, &dev_priv->gart_info)) { DRM_ERROR("failed to init PCI GART!\n"); radeon_do_cleanup_cp(dev); - return -ENOMEM; + return ENOMEM; } /* Turn on PCI GART */ @@ -1260,7 +1260,7 @@ static int radeon_do_resume_cp(struct drm_device * dev) if (!dev_priv) { DRM_ERROR("Called with no initialization\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("Starting radeon_do_resume_cp()\n"); @@ -1305,7 +1305,7 @@ int radeon_cp_init(struct drm_device *dev, void *data, struct drm_file *file_pri return radeon_do_cleanup_cp(dev); } - return -EINVAL; + return EINVAL; } int radeon_cp_start(struct drm_device *dev, void *data, struct drm_file *file_priv) @@ -1432,7 +1432,7 @@ int radeon_cp_reset(struct drm_device *dev, void *data, struct drm_file *file_pr if (!dev_priv) { DRM_DEBUG("called before init done\n"); - return -EINVAL; + return EINVAL; } radeon_do_cp_reset(dev_priv); @@ -1625,7 +1625,7 @@ int radeon_wait_ring(drm_radeon_private_t * dev_priv, int n) radeon_status(dev_priv); DRM_ERROR("failed!\n"); #endif - return -EBUSY; + return EBUSY; } static int radeon_cp_get_buffers(struct drm_device *dev, @@ -1638,16 +1638,16 @@ static int radeon_cp_get_buffers(struct drm_device *dev, for (i = d->granted_count; i < d->request_count; i++) { buf = radeon_freelist_get(dev); if (!buf) - return -EBUSY; /* NOTE: broken client */ + return EBUSY; /* NOTE: broken client */ buf->file_priv = file_priv; if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx, sizeof(buf->idx))) - return -EFAULT; + return EFAULT; if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total, sizeof(buf->total))) - return -EFAULT; + return EFAULT; d->granted_count++; } @@ -1667,7 +1667,7 @@ int radeon_cp_buffers(struct drm_device *dev, void *data, struct drm_file *file_ if (d->send_count != 0) { DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", DRM_CURRENTPID, d->send_count); - return -EINVAL; + return EINVAL; } /* We'll send you buffers. @@ -1675,7 +1675,7 @@ int radeon_cp_buffers(struct drm_device *dev, void *data, struct drm_file *file_ if (d->request_count < 0 || d->request_count > dma->buf_count) { DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", DRM_CURRENTPID, d->request_count, dma->buf_count); - return -EINVAL; + return EINVAL; } d->granted_count = 0; @@ -1694,7 +1694,7 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags) dev_priv = drm_calloc(1, sizeof(drm_radeon_private_t), DRM_MEM_DRIVER); if (dev_priv == NULL) - return -ENOMEM; + return ENOMEM; dev->dev_private = (void *)dev_priv; dev_priv->flags = flags; diff --git a/sys/dev/pci/drm/radeon_irq.c b/sys/dev/pci/drm/radeon_irq.c index 695699618c1..acca3d4df0d 100644 --- a/sys/dev/pci/drm/radeon_irq.c +++ b/sys/dev/pci/drm/radeon_irq.c @@ -257,12 +257,12 @@ u32 radeon_get_vblank_counter(struct drm_device *dev, int crtc) if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } if (crtc < 0 || crtc > 1) { DRM_ERROR("Invalid crtc %d\n", crtc); - return -EINVAL; + return EINVAL; } if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RS690) { @@ -290,14 +290,14 @@ int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_pr if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } result = radeon_emit_irq(dev); if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) { DRM_ERROR("copy_to_user\n"); - return -EFAULT; + return EFAULT; } return 0; @@ -312,7 +312,7 @@ int radeon_irq_wait(struct drm_device *dev, void *data, struct drm_file *file_pr if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } return radeon_wait_irq(dev, irqwait->irq_seq); @@ -383,7 +383,7 @@ int radeon_vblank_crtc_set(struct drm_device *dev, int64_t value) drm_radeon_private_t *dev_priv = (drm_radeon_private_t *) dev->dev_private; if (value & ~(DRM_RADEON_VBLANK_CRTC1 | DRM_RADEON_VBLANK_CRTC2)) { DRM_ERROR("called with invalid crtc 0x%x\n", (unsigned int)value); - return -EINVAL; + return EINVAL; } dev_priv->vblank_crtc = (unsigned int)value; return 0; diff --git a/sys/dev/pci/drm/radeon_mem.c b/sys/dev/pci/drm/radeon_mem.c index d5b4a339615..7d4e1e1fa75 100644 --- a/sys/dev/pci/drm/radeon_mem.c +++ b/sys/dev/pci/drm/radeon_mem.c @@ -137,12 +137,12 @@ static int init_heap(struct mem_block **heap, int start, int size) struct mem_block *blocks = drm_alloc(sizeof(*blocks), DRM_MEM_BUFS); if (!blocks) - return -ENOMEM; + return ENOMEM; *heap = drm_calloc(1, sizeof(**heap), DRM_MEM_BUFS); if (!*heap) { drm_free(blocks, sizeof(*blocks), DRM_MEM_BUFS); - return -ENOMEM; + return ENOMEM; } blocks->start = start; @@ -224,12 +224,12 @@ int radeon_mem_alloc(struct drm_device *dev, void *data, struct drm_file *file_p if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } heap = get_heap(dev_priv, alloc->region); if (!heap || !*heap) - return -EFAULT; + return EFAULT; /* Make things easier on ourselves: all allocations at least * 4k aligned. @@ -240,12 +240,12 @@ int radeon_mem_alloc(struct drm_device *dev, void *data, struct drm_file *file_p block = alloc_block(*heap, alloc->size, alloc->alignment, file_priv); if (!block) - return -ENOMEM; + return ENOMEM; if (DRM_COPY_TO_USER(alloc->region_offset, &block->start, sizeof(int))) { DRM_ERROR("copy_to_user\n"); - return -EFAULT; + return EFAULT; } return 0; @@ -259,19 +259,19 @@ int radeon_mem_free(struct drm_device *dev, void *data, struct drm_file *file_pr if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } heap = get_heap(dev_priv, memfree->region); if (!heap || !*heap) - return -EFAULT; + return EFAULT; block = find_block(*heap, memfree->region_offset); if (!block) - return -EFAULT; + return EFAULT; if (block->file_priv != file_priv) - return -EPERM; + return EPERM; free_block(block); return 0; @@ -285,16 +285,16 @@ int radeon_mem_init_heap(struct drm_device *dev, void *data, struct drm_file *fi if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } heap = get_heap(dev_priv, initheap->region); if (!heap) - return -EFAULT; + return EFAULT; if (*heap) { DRM_ERROR("heap already initialized?"); - return -EFAULT; + return EFAULT; } return init_heap(heap, initheap->start, initheap->size); diff --git a/sys/dev/pci/drm/radeon_state.c b/sys/dev/pci/drm/radeon_state.c index 81e8eb5458d..a6556c79081 100644 --- a/sys/dev/pci/drm/radeon_state.c +++ b/sys/dev/pci/drm/radeon_state.c @@ -85,7 +85,7 @@ static __inline__ int radeon_check_and_fixup_offset(drm_radeon_private_t * *offset = off; return 0; } - return -EINVAL; + return EINVAL; } static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * @@ -99,7 +99,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * if (radeon_check_and_fixup_offset(dev_priv, file_priv, &data[(RADEON_RB3D_DEPTHOFFSET - RADEON_PP_MISC) / 4])) { DRM_ERROR("Invalid depth buffer offset\n"); - return -EINVAL; + return EINVAL; } break; @@ -107,7 +107,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * if (radeon_check_and_fixup_offset(dev_priv, file_priv, &data[(RADEON_RB3D_COLOROFFSET - RADEON_PP_CNTL) / 4])) { DRM_ERROR("Invalid colour buffer offset\n"); - return -EINVAL; + return EINVAL; } break; @@ -120,7 +120,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * if (radeon_check_and_fixup_offset(dev_priv, file_priv, &data[0])) { DRM_ERROR("Invalid R200 texture offset\n"); - return -EINVAL; + return EINVAL; } break; @@ -130,7 +130,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * if (radeon_check_and_fixup_offset(dev_priv, file_priv, &data[(RADEON_PP_TXOFFSET_0 - RADEON_PP_TXFILTER_0) / 4])) { DRM_ERROR("Invalid R100 texture offset\n"); - return -EINVAL; + return EINVAL; } break; @@ -147,7 +147,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * &data[i])) { DRM_ERROR ("Invalid R200 cubic texture offset\n"); - return -EINVAL; + return EINVAL; } } break; @@ -163,7 +163,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * &data[i])) { DRM_ERROR ("Invalid R100 cubic texture offset\n"); - return -EINVAL; + return EINVAL; } } } @@ -256,7 +256,7 @@ static __inline__ int radeon_check_and_fixup_packets(drm_radeon_private_t * default: DRM_ERROR("Unknown state packet ID %d\n", id); - return -EINVAL; + return EINVAL; } return 0; @@ -277,12 +277,12 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * if ((cmd[0] & 0xc0000000) != RADEON_CP_PACKET3) { DRM_ERROR("Not a type 3 packet\n"); - return -EINVAL; + return EINVAL; } if (4 * *cmdsz > cmdbuf->bufsz) { DRM_ERROR("Packet size larger than size of data provided\n"); - return -EINVAL; + return EINVAL; } switch(cmd[0] & 0xff00) { @@ -308,7 +308,7 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * if ((dev_priv->chip_family < CHIP_R200) || (dev_priv->chip_family > CHIP_RV280)) { DRM_ERROR("Invalid 3d packet for non r200-class chip\n"); - return -EINVAL; + return EINVAL; } break; @@ -318,7 +318,7 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * if (count > 18) { /* 12 arrays max */ DRM_ERROR("Too large payload in 3D_LOAD_VBPNTR (count=%d)\n", count); - return -EINVAL; + return EINVAL; } /* carefully check packet contents */ @@ -332,7 +332,7 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * DRM_ERROR ("Invalid offset (k=%d i=%d) in 3D_LOAD_VBPNTR packet.\n", k, i); - return -EINVAL; + return EINVAL; } k++; i++; @@ -345,7 +345,7 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * DRM_ERROR ("Invalid offset (k=%d i=%d) in 3D_LOAD_VBPNTR packet.\n", k, i); - return -EINVAL; + return EINVAL; } k++; i++; @@ -355,18 +355,18 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * DRM_ERROR ("Malformed 3D_LOAD_VBPNTR packet (k=%d i=%d narrays=%d count+1=%d).\n", k, i, narrays, count + 1); - return -EINVAL; + return EINVAL; } break; case RADEON_3D_RNDR_GEN_INDX_PRIM: if (dev_priv->chip_family > CHIP_RS200) { DRM_ERROR("Invalid 3d packet for non-r100-class chip\n"); - return -EINVAL; + return EINVAL; } if (radeon_check_and_fixup_offset(dev_priv, file_priv, &cmd[1])) { DRM_ERROR("Invalid rndr_gen_indx offset\n"); - return -EINVAL; + return EINVAL; } break; @@ -375,15 +375,15 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * if ((dev_priv->chip_family < CHIP_R200) || (dev_priv->chip_family > CHIP_RV280)) { DRM_ERROR("Invalid 3d packet for non-r200-class chip\n"); - return -EINVAL; + return EINVAL; } if ((cmd[1] & 0x8000ffff) != 0x80000810) { DRM_ERROR("Invalid indx_buffer reg address %08X\n", cmd[1]); - return -EINVAL; + return EINVAL; } if (radeon_check_and_fixup_offset(dev_priv, file_priv, &cmd[2])) { DRM_ERROR("Invalid indx_buffer offset is %08X\n", cmd[2]); - return -EINVAL; + return EINVAL; } break; @@ -397,7 +397,7 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * if (radeon_check_and_fixup_offset (dev_priv, file_priv, &offset)) { DRM_ERROR("Invalid first packet offset\n"); - return -EINVAL; + return EINVAL; } cmd[2] = (cmd[2] & 0xffc00000) | offset >> 10; } @@ -408,7 +408,7 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * if (radeon_check_and_fixup_offset (dev_priv, file_priv, &offset)) { DRM_ERROR("Invalid second packet offset\n"); - return -EINVAL; + return EINVAL; } cmd[3] = (cmd[3] & 0xffc00000) | offset >> 10; } @@ -416,7 +416,7 @@ static __inline__ int radeon_check_and_fixup_packet3(drm_radeon_private_t * default: DRM_ERROR("Invalid packet type %x\n", cmd[0] & 0xff00); - return -EINVAL; + return EINVAL; } return 0; @@ -457,13 +457,13 @@ static int radeon_emit_state(drm_radeon_private_t * dev_priv, if (radeon_check_and_fixup_offset(dev_priv, file_priv, &ctx->rb3d_depthoffset)) { DRM_ERROR("Invalid depth buffer offset\n"); - return -EINVAL; + return EINVAL; } if (radeon_check_and_fixup_offset(dev_priv, file_priv, &ctx->rb3d_coloroffset)) { DRM_ERROR("Invalid depth buffer offset\n"); - return -EINVAL; + return EINVAL; } BEGIN_RING(14); @@ -552,7 +552,7 @@ static int radeon_emit_state(drm_radeon_private_t * dev_priv, if (radeon_check_and_fixup_offset(dev_priv, file_priv, &tex[0].pp_txoffset)) { DRM_ERROR("Invalid texture offset for unit 0\n"); - return -EINVAL; + return EINVAL; } BEGIN_RING(9); @@ -572,7 +572,7 @@ static int radeon_emit_state(drm_radeon_private_t * dev_priv, if (radeon_check_and_fixup_offset(dev_priv, file_priv, &tex[1].pp_txoffset)) { DRM_ERROR("Invalid texture offset for unit 1\n"); - return -EINVAL; + return EINVAL; } BEGIN_RING(9); @@ -592,7 +592,7 @@ static int radeon_emit_state(drm_radeon_private_t * dev_priv, if (radeon_check_and_fixup_offset(dev_priv, file_priv, &tex[2].pp_txoffset)) { DRM_ERROR("Invalid texture offset for unit 2\n"); - return -EINVAL; + return EINVAL; } BEGIN_RING(9); @@ -1673,7 +1673,7 @@ static int radeon_cp_dispatch_texture(struct drm_device * dev, if (radeon_check_and_fixup_offset(dev_priv, file_priv, &tex->offset)) { DRM_ERROR("Invalid destination offset\n"); - return -EINVAL; + return EINVAL; } dev_priv->stats.boxes |= RADEON_BOX_TEXTURE_LOAD; @@ -1716,11 +1716,11 @@ static int radeon_cp_dispatch_texture(struct drm_device * dev, break; default: DRM_ERROR("invalid texture format %d\n", tex->format); - return -EINVAL; + return EINVAL; } spitch = blit_width >> 6; if (spitch == 0 && image->height > 1) - return -EINVAL; + return EINVAL; texpitch = tex->pitch; if ((texpitch << 22) & RADEON_DST_TILE_MICRO) { @@ -1737,7 +1737,7 @@ static int radeon_cp_dispatch_texture(struct drm_device * dev, if (!radeon_check_offset(dev_priv, tex->offset + image->height * blit_width - 1)) { DRM_ERROR("Invalid final destination offset\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("tex=%dx%d blit=%d\n", tex_width, tex->height, blit_width); @@ -1772,8 +1772,8 @@ static int radeon_cp_dispatch_texture(struct drm_device * dev, if (!buf) { DRM_DEBUG("EAGAIN\n"); if (DRM_COPY_TO_USER(tex->image, image, sizeof(*image))) - return -EFAULT; - return -EAGAIN; + return EFAULT; + return EAGAIN; } /* Dispatch the indirect buffer. @@ -1786,7 +1786,7 @@ static int radeon_cp_dispatch_texture(struct drm_device * dev, do { \ if (DRM_COPY_FROM_USER(_buf, _data, (_width))) {\ DRM_ERROR("EFAULT on pad, %d bytes\n", (_width)); \ - return -EFAULT; \ + return EFAULT; \ } \ } while(0) @@ -2098,11 +2098,11 @@ int radeon_surface_alloc(struct drm_device *dev, void *data, struct drm_file *fi if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } if (alloc_surface(alloc, dev_priv, file_priv) == -1) - return -EINVAL; + return EINVAL; else return 0; } @@ -2114,11 +2114,11 @@ int radeon_surface_free(struct drm_device *dev, void *data, struct drm_file *fil if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } if (free_surface(file_priv, dev_priv, memfree->address)) - return -EINVAL; + return EINVAL; else return 0; } @@ -2140,7 +2140,7 @@ int radeon_cp_clear(struct drm_device *dev, void *data, struct drm_file *file_pr if (DRM_COPY_FROM_USER(&depth_boxes, clear->depth_boxes, sarea_priv->nbox * sizeof(depth_boxes[0]))) - return -EFAULT; + return EFAULT; radeon_cp_dispatch_clear(dev, clear, depth_boxes); @@ -2229,7 +2229,7 @@ int radeon_cp_vertex(struct drm_device *dev, void *data, struct drm_file *file_p if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } sarea_priv = dev_priv->sarea_priv; @@ -2240,11 +2240,11 @@ int radeon_cp_vertex(struct drm_device *dev, void *data, struct drm_file *file_p if (vertex->idx < 0 || vertex->idx >= dma->buf_count) { DRM_ERROR("buffer index %d (of %d max)\n", vertex->idx, dma->buf_count - 1); - return -EINVAL; + return EINVAL; } if (vertex->prim < 0 || vertex->prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST) { DRM_ERROR("buffer prim %d\n", vertex->prim); - return -EINVAL; + return EINVAL; } RING_SPACE_TEST_WITH_RETURN(dev_priv); @@ -2255,11 +2255,11 @@ int radeon_cp_vertex(struct drm_device *dev, void *data, struct drm_file *file_p if (buf->file_priv != file_priv) { DRM_ERROR("process %d using buffer owned by %p\n", DRM_CURRENTPID, buf->file_priv); - return -EINVAL; + return EINVAL; } if (buf->pending) { DRM_ERROR("sending pending buffer %d\n", vertex->idx); - return -EINVAL; + return EINVAL; } /* Build up a prim_t record: @@ -2273,7 +2273,7 @@ int radeon_cp_vertex(struct drm_device *dev, void *data, struct drm_file *file_p sarea_priv->tex_state, sarea_priv->dirty)) { DRM_ERROR("radeon_emit_state failed\n"); - return -EINVAL; + return EINVAL; } sarea_priv->dirty &= ~(RADEON_UPLOAD_TEX0IMAGES | @@ -2313,7 +2313,7 @@ int radeon_cp_indices(struct drm_device *dev, void *data, struct drm_file *file_ if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } sarea_priv = dev_priv->sarea_priv; @@ -2324,11 +2324,11 @@ int radeon_cp_indices(struct drm_device *dev, void *data, struct drm_file *file_ if (elts->idx < 0 || elts->idx >= dma->buf_count) { DRM_ERROR("buffer index %d (of %d max)\n", elts->idx, dma->buf_count - 1); - return -EINVAL; + return EINVAL; } if (elts->prim < 0 || elts->prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST) { DRM_ERROR("buffer prim %d\n", elts->prim); - return -EINVAL; + return EINVAL; } RING_SPACE_TEST_WITH_RETURN(dev_priv); @@ -2339,11 +2339,11 @@ int radeon_cp_indices(struct drm_device *dev, void *data, struct drm_file *file_ if (buf->file_priv != file_priv) { DRM_ERROR("process %d using buffer owned by %p\n", DRM_CURRENTPID, buf->file_priv); - return -EINVAL; + return EINVAL; } if (buf->pending) { DRM_ERROR("sending pending buffer %d\n", elts->idx); - return -EINVAL; + return EINVAL; } count = (elts->end - elts->start) / sizeof(u16); @@ -2351,11 +2351,11 @@ int radeon_cp_indices(struct drm_device *dev, void *data, struct drm_file *file_ if (elts->start & 0x7) { DRM_ERROR("misaligned buffer 0x%x\n", elts->start); - return -EINVAL; + return EINVAL; } if (elts->start < buf->used) { DRM_ERROR("no header 0x%x - 0x%x\n", elts->start, buf->used); - return -EINVAL; + return EINVAL; } buf->used = elts->end; @@ -2366,7 +2366,7 @@ int radeon_cp_indices(struct drm_device *dev, void *data, struct drm_file *file_ sarea_priv->tex_state, sarea_priv->dirty)) { DRM_ERROR("radeon_emit_state failed\n"); - return -EINVAL; + return EINVAL; } sarea_priv->dirty &= ~(RADEON_UPLOAD_TEX0IMAGES | @@ -2404,13 +2404,13 @@ int radeon_cp_texture(struct drm_device *dev, void *data, struct drm_file *file_ if (tex->image == NULL) { DRM_ERROR("null texture image!\n"); - return -EINVAL; + return EINVAL; } if (DRM_COPY_FROM_USER(&image, (drm_radeon_tex_image_t __user *) tex->image, sizeof(image))) - return -EFAULT; + return EFAULT; RING_SPACE_TEST_WITH_RETURN(dev_priv); VB_AGE_TEST_WITH_RETURN(dev_priv); @@ -2429,7 +2429,7 @@ int radeon_cp_stipple(struct drm_device *dev, void *data, struct drm_file *file_ LOCK_TEST_WITH_RETURN(dev, file_priv); if (DRM_COPY_FROM_USER(&mask, stipple->mask, 32 * sizeof(u32))) - return -EFAULT; + return EFAULT; RING_SPACE_TEST_WITH_RETURN(dev_priv); @@ -2451,7 +2451,7 @@ int radeon_cp_indirect(struct drm_device *dev, void *data, struct drm_file *file if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("idx=%d s=%d e=%d d=%d\n", @@ -2461,7 +2461,7 @@ int radeon_cp_indirect(struct drm_device *dev, void *data, struct drm_file *file if (indirect->idx < 0 || indirect->idx >= dma->buf_count) { DRM_ERROR("buffer index %d (of %d max)\n", indirect->idx, dma->buf_count - 1); - return -EINVAL; + return EINVAL; } buf = dma->buflist[indirect->idx]; @@ -2469,17 +2469,17 @@ int radeon_cp_indirect(struct drm_device *dev, void *data, struct drm_file *file if (buf->file_priv != file_priv) { DRM_ERROR("process %d using buffer owned by %p\n", DRM_CURRENTPID, buf->file_priv); - return -EINVAL; + return EINVAL; } if (buf->pending) { DRM_ERROR("sending pending buffer %d\n", indirect->idx); - return -EINVAL; + return EINVAL; } if (indirect->start < buf->used) { DRM_ERROR("reusing indirect: start=0x%x actual=0x%x\n", indirect->start, buf->used); - return -EINVAL; + return EINVAL; } RING_SPACE_TEST_WITH_RETURN(dev_priv); @@ -2523,7 +2523,7 @@ int radeon_cp_vertex2(struct drm_device *dev, void *data, struct drm_file *file_ if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } sarea_priv = dev_priv->sarea_priv; @@ -2534,7 +2534,7 @@ int radeon_cp_vertex2(struct drm_device *dev, void *data, struct drm_file *file_ if (vertex->idx < 0 || vertex->idx >= dma->buf_count) { DRM_ERROR("buffer index %d (of %d max)\n", vertex->idx, dma->buf_count - 1); - return -EINVAL; + return EINVAL; } RING_SPACE_TEST_WITH_RETURN(dev_priv); @@ -2545,23 +2545,23 @@ int radeon_cp_vertex2(struct drm_device *dev, void *data, struct drm_file *file_ if (buf->file_priv != file_priv) { DRM_ERROR("process %d using buffer owned by %p\n", DRM_CURRENTPID, buf->file_priv); - return -EINVAL; + return EINVAL; } if (buf->pending) { DRM_ERROR("sending pending buffer %d\n", vertex->idx); - return -EINVAL; + return EINVAL; } if (sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS) - return -EINVAL; + return EINVAL; for (laststate = 0xff, i = 0; i < vertex->nr_prims; i++) { drm_radeon_prim_t prim; drm_radeon_tcl_prim_t tclprim; if (DRM_COPY_FROM_USER(&prim, &vertex->prim[i], sizeof(prim))) - return -EFAULT; + return EFAULT; if (prim.stateidx != laststate) { drm_radeon_state_t state; @@ -2569,11 +2569,11 @@ int radeon_cp_vertex2(struct drm_device *dev, void *data, struct drm_file *file_ if (DRM_COPY_FROM_USER(&state, &vertex->state[prim.stateidx], sizeof(state))) - return -EFAULT; + return EFAULT; if (radeon_emit_state2(dev_priv, file_priv, &state)) { DRM_ERROR("radeon_emit_state2 failed\n"); - return -EINVAL; + return EINVAL; } laststate = prim.stateidx; @@ -2619,19 +2619,19 @@ static int radeon_emit_packets(drm_radeon_private_t * dev_priv, RING_LOCALS; if (id >= RADEON_MAX_STATE_PACKETS) - return -EINVAL; + return EINVAL; sz = packet[id].len; reg = packet[id].start; if (sz * sizeof(int) > cmdbuf->bufsz) { DRM_ERROR("Packet size provided larger than data provided\n"); - return -EINVAL; + return EINVAL; } if (radeon_check_and_fixup_packets(dev_priv, file_priv, id, data)) { DRM_ERROR("Packet verification failed\n"); - return -EINVAL; + return EINVAL; } BEGIN_RING(sz + 1); @@ -2719,7 +2719,7 @@ static __inline__ int radeon_emit_veclinear(drm_radeon_private_t *dev_priv, if (!sz) return 0; if (sz * 4 > cmdbuf->bufsz) - return -EINVAL; + return EINVAL; BEGIN_RING(5 + sz); OUT_RING_REG(RADEON_SE_TCL_STATE_FLUSH, 0); @@ -2787,7 +2787,7 @@ static int radeon_emit_packet3_cliprect(struct drm_device *dev, do { if (i < cmdbuf->nbox) { if (DRM_COPY_FROM_USER(&box, &boxes[i], sizeof(box))) - return -EFAULT; + return EFAULT; /* FIXME The second and subsequent times round * this loop, send a WAIT_UNTIL_3D_IDLE before * calling emit_clip_rect(). This fixes a @@ -2845,7 +2845,7 @@ static int radeon_emit_wait(struct drm_device * dev, int flags) ADVANCE_RING(); break; default: - return -EINVAL; + return EINVAL; } return 0; @@ -2866,14 +2866,14 @@ int radeon_cp_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_p if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } RING_SPACE_TEST_WITH_RETURN(dev_priv); VB_AGE_TEST_WITH_RETURN(dev_priv); if (cmdbuf->bufsz > 64 * 1024 || cmdbuf->bufsz < 0) { - return -EINVAL; + return EINVAL; } /* Allocate an in-kernel area and copy in the cmdbuf. Do this to avoid @@ -2884,11 +2884,11 @@ int radeon_cp_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_p if (orig_bufsz != 0) { kbuf = drm_alloc(cmdbuf->bufsz, DRM_MEM_DRIVER); if (kbuf == NULL) - return -ENOMEM; + return ENOMEM; if (DRM_COPY_FROM_USER(kbuf, (void __user *)cmdbuf->buf, cmdbuf->bufsz)) { drm_free(kbuf, orig_bufsz, DRM_MEM_DRIVER); - return -EFAULT; + return EFAULT; } cmdbuf->buf = kbuf; } @@ -3016,7 +3016,7 @@ int radeon_cp_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_p err: if (orig_bufsz != 0) drm_free(kbuf, orig_bufsz, DRM_MEM_DRIVER); - return -EINVAL; + return EINVAL; } int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_file *file_priv) @@ -3027,7 +3027,7 @@ int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_file *file if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } DRM_DEBUG("pid=%d\n", DRM_CURRENTPID); @@ -3079,7 +3079,7 @@ int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_file *file break; case RADEON_PARAM_SCRATCH_OFFSET: if (!dev_priv->writeback_works) - return -EINVAL; + return EINVAL; value = RADEON_SCRATCH_REG_OFFSET; break; @@ -3102,12 +3102,12 @@ int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_file *file break; default: DRM_DEBUG( "Invalid parameter %d\n", param->param ); - 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; @@ -3121,7 +3121,7 @@ int radeon_cp_setparam(struct drm_device *dev, void *data, struct drm_file *file if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } switch (sp->param) { @@ -3154,7 +3154,7 @@ int radeon_cp_setparam(struct drm_device *dev, void *data, struct drm_file *file break; case RADEON_SETPARAM_PCIGART_TABLE_SIZE: if (sp->value < 0) - return -EINVAL; + return EINVAL; dev_priv->gart_info.table_size = sp->value; if (dev_priv->gart_info.table_size < RADEON_PCIGART_TABLE_SIZE) dev_priv->gart_info.table_size = RADEON_PCIGART_TABLE_SIZE; @@ -3164,7 +3164,7 @@ int radeon_cp_setparam(struct drm_device *dev, void *data, struct drm_file *file break; default: DRM_DEBUG("Invalid parameter %d\n", sp->param); - return -EINVAL; + return EINVAL; } return 0; @@ -3213,7 +3213,7 @@ int radeon_driver_open(struct drm_device *dev, struct drm_file *file_priv) drm_alloc(sizeof(*radeon_priv), DRM_MEM_FILES); if (!radeon_priv) - return -ENOMEM; + return ENOMEM; file_priv->driver_priv = radeon_priv; diff --git a/sys/dev/pci/drm/savage_bci.c b/sys/dev/pci/drm/savage_bci.c index 2b6bb0f24f4..a96e623f59a 100644 --- a/sys/dev/pci/drm/savage_bci.c +++ b/sys/dev/pci/drm/savage_bci.c @@ -60,7 +60,7 @@ savage_bci_wait_fifo_shadow(drm_savage_private_t *dev_priv, unsigned int n) DRM_ERROR("failed!\n"); DRM_INFO(" status=0x%08x, threshold=0x%08x\n", status, threshold); #endif - return -EBUSY; + return EBUSY; } static int @@ -81,7 +81,7 @@ savage_bci_wait_fifo_s3d(drm_savage_private_t *dev_priv, unsigned int n) DRM_ERROR("failed!\n"); DRM_INFO(" status=0x%08x\n", status); #endif - return -EBUSY; + return EBUSY; } static int @@ -102,7 +102,7 @@ savage_bci_wait_fifo_s4(drm_savage_private_t *dev_priv, unsigned int n) DRM_ERROR("failed!\n"); DRM_INFO(" status=0x%08x\n", status); #endif - return -EBUSY; + return EBUSY; } /* @@ -136,7 +136,7 @@ savage_bci_wait_event_shadow(drm_savage_private_t *dev_priv, uint16_t e) DRM_INFO(" status=0x%08x, e=0x%04x\n", status, e); #endif - return -EBUSY; + return EBUSY; } static int @@ -158,7 +158,7 @@ savage_bci_wait_event_reg(drm_savage_private_t *dev_priv, uint16_t e) DRM_INFO(" status=0x%08x, e=0x%04x\n", status, e); #endif - return -EBUSY; + return EBUSY; } 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) dev_priv->dma_pages = drm_calloc(sizeof(drm_savage_dma_page_t), dev_priv->nr_dma_pages, DRM_MEM_DRIVER); if (dev_priv->dma_pages == NULL) - return -ENOMEM; + return ENOMEM; for (i = 0; i < dev_priv->nr_dma_pages; ++i) { 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) dev_priv = drm_calloc(1, sizeof(drm_savage_private_t), DRM_MEM_DRIVER); if (dev_priv == NULL) - return -ENOMEM; + return ENOMEM; dev->dev_private = (void *)dev_priv; @@ -579,7 +579,7 @@ int savage_driver_firstopen(struct drm_device *dev) aperture_base = fb_base + SAVAGE_APERTURE_OFFSET; /* this should always be true */ if (drm_get_resource_len(dev, 0) == 0x08000000) { - /* Don't make MMIO write-cobining! We need 3 + /* Don't make MMIO write-combining! We need 3 * MTRRs. */ dev_priv->mtrr[0].base = fb_base; dev_priv->mtrr[0].size = 0x01000000; @@ -680,16 +680,16 @@ static int savage_do_init_bci(struct drm_device *dev, drm_savage_init_t *init) if (init->fb_bpp != 16 && init->fb_bpp != 32) { DRM_ERROR("invalid frame buffer bpp %d!\n", init->fb_bpp); - return -EINVAL; + return EINVAL; } if (init->depth_bpp != 16 && init->depth_bpp != 32) { DRM_ERROR("invalid depth buffer bpp %d!\n", init->fb_bpp); - return -EINVAL; + return EINVAL; } if (init->dma_type != SAVAGE_DMA_AGP && init->dma_type != SAVAGE_DMA_PCI) { DRM_ERROR("invalid dma memory type %d!\n", init->dma_type); - return -EINVAL; + return EINVAL; } dev_priv->cob_size = init->cob_size; @@ -713,14 +713,14 @@ static int savage_do_init_bci(struct drm_device *dev, drm_savage_init_t *init) if (!dev_priv->sarea) { DRM_ERROR("could not find sarea!\n"); savage_do_cleanup_bci(dev); - return -EINVAL; + return EINVAL; } if (init->status_offset != 0) { dev_priv->status = drm_core_findmap(dev, init->status_offset); if (!dev_priv->status) { DRM_ERROR("could not find shadow status region!\n"); savage_do_cleanup_bci(dev); - return -EINVAL; + return EINVAL; } } else { dev_priv->status = NULL; @@ -732,13 +732,13 @@ static int savage_do_init_bci(struct drm_device *dev, drm_savage_init_t *init) if (!dev->agp_buffer_map) { DRM_ERROR("could not find DMA buffer region!\n"); savage_do_cleanup_bci(dev); - return -EINVAL; + return EINVAL; } drm_core_ioremap(dev->agp_buffer_map, dev); if (!dev->agp_buffer_map) { DRM_ERROR("failed to ioremap DMA buffer region!\n"); savage_do_cleanup_bci(dev); - return -ENOMEM; + return ENOMEM; } } if (init->agp_textures_offset) { @@ -747,7 +747,7 @@ static int savage_do_init_bci(struct drm_device *dev, drm_savage_init_t *init) if (!dev_priv->agp_textures) { DRM_ERROR("could not find agp texture region!\n"); savage_do_cleanup_bci(dev); - return -EINVAL; + return EINVAL; } } else { dev_priv->agp_textures = NULL; @@ -758,39 +758,39 @@ static int savage_do_init_bci(struct drm_device *dev, drm_savage_init_t *init) DRM_ERROR("command DMA not supported on " "Savage3D/MX/IX.\n"); savage_do_cleanup_bci(dev); - return -EINVAL; + return EINVAL; } if (dev->dma && dev->dma->buflist) { DRM_ERROR("command and vertex DMA not supported " "at the same time.\n"); savage_do_cleanup_bci(dev); - return -EINVAL; + return EINVAL; } dev_priv->cmd_dma = drm_core_findmap(dev, init->cmd_dma_offset); if (!dev_priv->cmd_dma) { DRM_ERROR("could not find command DMA region!\n"); savage_do_cleanup_bci(dev); - return -EINVAL; + return EINVAL; } if (dev_priv->dma_type == SAVAGE_DMA_AGP) { if (dev_priv->cmd_dma->type != _DRM_AGP) { DRM_ERROR("AGP command DMA region is not a " "_DRM_AGP map!\n"); savage_do_cleanup_bci(dev); - return -EINVAL; + return EINVAL; } drm_core_ioremap(dev_priv->cmd_dma, dev); if (!dev_priv->cmd_dma->handle) { DRM_ERROR("failed to ioremap command " "DMA region!\n"); savage_do_cleanup_bci(dev); - return -ENOMEM; + return ENOMEM; } } else if (dev_priv->cmd_dma->type != _DRM_CONSISTENT) { DRM_ERROR("PCI command DMA region is not a " "_DRM_CONSISTENT map!\n"); savage_do_cleanup_bci(dev); - return -EINVAL; + return EINVAL; } } else { dev_priv->cmd_dma = NULL; @@ -807,7 +807,7 @@ static int savage_do_init_bci(struct drm_device *dev, drm_savage_init_t *init) if (!dev_priv->fake_dma.handle) { DRM_ERROR("could not allocate faked DMA buffer!\n"); savage_do_cleanup_bci(dev); - return -ENOMEM; + return ENOMEM; } dev_priv->cmd_dma = &dev_priv->fake_dma; dev_priv->dma_flush = savage_fake_dma_flush; @@ -884,13 +884,13 @@ static int savage_do_init_bci(struct drm_device *dev, drm_savage_init_t *init) if (savage_freelist_init(dev) < 0) { DRM_ERROR("could not initialize freelist\n"); savage_do_cleanup_bci(dev); - return -ENOMEM; + return ENOMEM; } if (savage_dma_init(dev_priv) < 0) { DRM_ERROR("could not initialize command DMA\n"); savage_do_cleanup_bci(dev); - return -ENOMEM; + return ENOMEM; } return 0; @@ -939,7 +939,7 @@ int savage_bci_init(struct drm_device *dev, void *data, struct drm_file *file_pr return savage_do_cleanup_bci(dev); } - return -EINVAL; + return EINVAL; } int savage_bci_event_emit(struct drm_device *dev, void *data, struct drm_file *file_priv) @@ -1002,16 +1002,16 @@ static int savage_bci_get_buffers(struct drm_device *dev, for (i = d->granted_count; i < d->request_count; i++) { buf = savage_freelist_get(dev); if (!buf) - return -EAGAIN; + return EAGAIN; buf->file_priv = file_priv; if (DRM_COPY_TO_USER(&d->request_indices[i], &buf->idx, sizeof(buf->idx))) - return -EFAULT; + return EFAULT; if (DRM_COPY_TO_USER(&d->request_sizes[i], &buf->total, sizeof(buf->total))) - return -EFAULT; + return EFAULT; d->granted_count++; } @@ -1031,7 +1031,7 @@ int savage_bci_buffers(struct drm_device *dev, void *data, struct drm_file *file if (d->send_count != 0) { DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", DRM_CURRENTPID, d->send_count); - return -EINVAL; + return EINVAL; } /* We'll send you buffers. @@ -1039,7 +1039,7 @@ int savage_bci_buffers(struct drm_device *dev, void *data, struct drm_file *file if (d->request_count < 0 || d->request_count > dma->buf_count) { DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", DRM_CURRENTPID, d->request_count, dma->buf_count); - return -EINVAL; + return EINVAL; } d->granted_count = 0; diff --git a/sys/dev/pci/drm/savage_state.c b/sys/dev/pci/drm/savage_state.c index a0e4105c538..0cb733090eb 100644 --- a/sys/dev/pci/drm/savage_state.c +++ b/sys/dev/pci/drm/savage_state.c @@ -83,7 +83,7 @@ static int savage_verify_texaddr(drm_savage_private_t *dev_priv, int unit, { if ((addr & 6) != 2) { /* reserved bits */ DRM_ERROR("bad texAddr%d %08x (reserved bits)\n", unit, addr); - return -EINVAL; + return EINVAL; } if (!(addr & 1)) { /* local */ addr &= ~7; @@ -92,13 +92,13 @@ static int savage_verify_texaddr(drm_savage_private_t *dev_priv, int unit, DRM_ERROR ("bad texAddr%d %08x (local addr out of range)\n", unit, addr); - return -EINVAL; + return EINVAL; } } else { /* AGP */ if (!dev_priv->agp_textures) { DRM_ERROR("bad texAddr%d %08x (AGP not available)\n", unit, addr); - return -EINVAL; + return EINVAL; } addr &= ~7; if (addr < dev_priv->agp_textures->offset || @@ -107,7 +107,7 @@ static int savage_verify_texaddr(drm_savage_private_t *dev_priv, int unit, DRM_ERROR ("bad texAddr%d %08x (AGP addr out of range)\n", unit, addr); - return -EINVAL; + return EINVAL; } } return 0; @@ -132,7 +132,7 @@ static int savage_verify_state_s3d(drm_savage_private_t *dev_priv, start + count - 1 > SAVAGE_DESTTEXRWWATERMARK_S3D) { DRM_ERROR("invalid register range (0x%04x-0x%04x)\n", start, start + count - 1); - return -EINVAL; + return EINVAL; } SAVE_STATE_MASK(SAVAGE_SCSTART_S3D, s3d.new_scstart, @@ -164,7 +164,7 @@ static int savage_verify_state_s4(drm_savage_private_t *dev_priv, start + count - 1 > SAVAGE_TEXBLENDCOLOR_S4) { DRM_ERROR("invalid register range (0x%04x-0x%04x)\n", start, start + count - 1); - return -EINVAL; + return EINVAL; } SAVE_STATE_MASK(SAVAGE_DRAWCTRL0_S4, s4.new_drawctrl0, @@ -287,7 +287,7 @@ static int savage_dispatch_dma_prim(drm_savage_private_t *dev_priv, if (!dmabuf) { DRM_ERROR("called without dma buffers!\n"); - return -EINVAL; + return EINVAL; } if (!n) @@ -301,7 +301,7 @@ static int savage_dispatch_dma_prim(drm_savage_private_t *dev_priv, if (n % 3 != 0) { DRM_ERROR("wrong number of vertices %u in TRILIST\n", n); - return -EINVAL; + return EINVAL; } break; case SAVAGE_PRIM_TRISTRIP: @@ -310,18 +310,18 @@ static int savage_dispatch_dma_prim(drm_savage_private_t *dev_priv, DRM_ERROR ("wrong number of vertices %u in TRIFAN/STRIP\n", n); - return -EINVAL; + return EINVAL; } break; default: DRM_ERROR("invalid primitive type %u\n", prim); - return -EINVAL; + return EINVAL; } if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { if (skip != 0) { DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip); - return -EINVAL; + return EINVAL; } } else { unsigned int size = 10 - (skip & 1) - (skip >> 1 & 1) - @@ -329,18 +329,18 @@ static int savage_dispatch_dma_prim(drm_savage_private_t *dev_priv, (skip >> 5 & 1) - (skip >> 6 & 1) - (skip >> 7 & 1); if (skip > SAVAGE_SKIP_ALL_S4 || size != 8) { DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip); - return -EINVAL; + return EINVAL; } if (reorder) { DRM_ERROR("TRILIST_201 used on Savage4 hardware\n"); - return -EINVAL; + return EINVAL; } } if (start + n > dmabuf->total / 32) { DRM_ERROR("vertex indices (%u-%u) out of range (0-%u)\n", start, start + n - 1, dmabuf->total / 32); - return -EINVAL; + return EINVAL; } /* Vertex DMA doesn't work with command DMA at the same time, @@ -438,7 +438,7 @@ static int savage_dispatch_vb_prim(drm_savage_private_t *dev_priv, if (n % 3 != 0) { DRM_ERROR("wrong number of vertices %u in TRILIST\n", n); - return -EINVAL; + return EINVAL; } break; case SAVAGE_PRIM_TRISTRIP: @@ -447,24 +447,24 @@ static int savage_dispatch_vb_prim(drm_savage_private_t *dev_priv, DRM_ERROR ("wrong number of vertices %u in TRIFAN/STRIP\n", n); - return -EINVAL; + return EINVAL; } break; default: DRM_ERROR("invalid primitive type %u\n", prim); - return -EINVAL; + return EINVAL; } if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { if (skip > SAVAGE_SKIP_ALL_S3D) { DRM_ERROR("invalid skip flags 0x%04x\n", skip); - return -EINVAL; + return EINVAL; } vtx_size = 8; /* full vertex */ } else { if (skip > SAVAGE_SKIP_ALL_S4) { DRM_ERROR("invalid skip flags 0x%04x\n", skip); - return -EINVAL; + return EINVAL; } vtx_size = 10; /* full vertex */ } @@ -476,13 +476,13 @@ static int savage_dispatch_vb_prim(drm_savage_private_t *dev_priv, if (vtx_size > vb_stride) { DRM_ERROR("vertex size greater than vb stride (%u > %u)\n", vtx_size, vb_stride); - return -EINVAL; + return EINVAL; } if (start + n > vb_size / (vb_stride * 4)) { DRM_ERROR("vertex indices (%u-%u) out of range (0-%u)\n", start, start + n - 1, vb_size / (vb_stride * 4)); - return -EINVAL; + return EINVAL; } prim <<= 25; @@ -545,7 +545,7 @@ static int savage_dispatch_dma_idx(drm_savage_private_t *dev_priv, if (!dmabuf) { DRM_ERROR("called without dma buffers!\n"); - return -EINVAL; + return EINVAL; } if (!n) @@ -558,7 +558,7 @@ static int savage_dispatch_dma_idx(drm_savage_private_t *dev_priv, case SAVAGE_PRIM_TRILIST: if (n % 3 != 0) { DRM_ERROR("wrong number of indices %u in TRILIST\n", n); - return -EINVAL; + return EINVAL; } break; case SAVAGE_PRIM_TRISTRIP: @@ -566,18 +566,18 @@ static int savage_dispatch_dma_idx(drm_savage_private_t *dev_priv, if (n < 3) { DRM_ERROR ("wrong number of indices %u in TRIFAN/STRIP\n", n); - return -EINVAL; + return EINVAL; } break; default: DRM_ERROR("invalid primitive type %u\n", prim); - return -EINVAL; + return EINVAL; } if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { if (skip != 0) { DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip); - return -EINVAL; + return EINVAL; } } else { unsigned int size = 10 - (skip & 1) - (skip >> 1 & 1) - @@ -585,11 +585,11 @@ static int savage_dispatch_dma_idx(drm_savage_private_t *dev_priv, (skip >> 5 & 1) - (skip >> 6 & 1) - (skip >> 7 & 1); if (skip > SAVAGE_SKIP_ALL_S4 || size != 8) { DRM_ERROR("invalid skip flags 0x%04x for DMA\n", skip); - return -EINVAL; + return EINVAL; } if (reorder) { DRM_ERROR("TRILIST_201 used on Savage4 hardware\n"); - return -EINVAL; + return EINVAL; } } @@ -626,7 +626,7 @@ static int savage_dispatch_dma_idx(drm_savage_private_t *dev_priv, if (idx[i] > dmabuf->total / 32) { DRM_ERROR("idx[%u]=%u out of range (0-%u)\n", i, idx[i], dmabuf->total / 32); - return -EINVAL; + return EINVAL; } } @@ -696,7 +696,7 @@ static int savage_dispatch_vb_idx(drm_savage_private_t *dev_priv, case SAVAGE_PRIM_TRILIST: if (n % 3 != 0) { DRM_ERROR("wrong number of indices %u in TRILIST\n", n); - return -EINVAL; + return EINVAL; } break; case SAVAGE_PRIM_TRISTRIP: @@ -704,24 +704,24 @@ static int savage_dispatch_vb_idx(drm_savage_private_t *dev_priv, if (n < 3) { DRM_ERROR ("wrong number of indices %u in TRIFAN/STRIP\n", n); - return -EINVAL; + return EINVAL; } break; default: DRM_ERROR("invalid primitive type %u\n", prim); - return -EINVAL; + return EINVAL; } if (S3_SAVAGE3D_SERIES(dev_priv->chipset)) { if (skip > SAVAGE_SKIP_ALL_S3D) { DRM_ERROR("invalid skip flags 0x%04x\n", skip); - return -EINVAL; + return EINVAL; } vtx_size = 8; /* full vertex */ } else { if (skip > SAVAGE_SKIP_ALL_S4) { DRM_ERROR("invalid skip flags 0x%04x\n", skip); - return -EINVAL; + return EINVAL; } vtx_size = 10; /* full vertex */ } @@ -733,7 +733,7 @@ static int savage_dispatch_vb_idx(drm_savage_private_t *dev_priv, if (vtx_size > vb_stride) { DRM_ERROR("vertex size greater than vb stride (%u > %u)\n", vtx_size, vb_stride); - return -EINVAL; + return EINVAL; } prim <<= 25; @@ -746,7 +746,7 @@ static int savage_dispatch_vb_idx(drm_savage_private_t *dev_priv, if (idx[i] > vb_size / (vb_stride * 4)) { DRM_ERROR("idx[%u]=%u out of range (0-%u)\n", i, idx[i], vb_size / (vb_stride * 4)); - return -EINVAL; + return EINVAL; } } @@ -941,7 +941,7 @@ static int savage_dispatch_draw(drm_savage_private_t *dev_priv, DRM_ERROR("IMPLEMENTATION ERROR: " "non-drawing-command %d\n", cmd_header.cmd.cmd); - return -EINVAL; + return EINVAL; } if (ret != 0) @@ -974,7 +974,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ DRM_ERROR ("vertex buffer index %u out of range (0-%u)\n", cmdbuf->dma_idx, dma->buf_count - 1); - return -EINVAL; + return EINVAL; } dmabuf = dma->buflist[cmdbuf->dma_idx]; } else { @@ -989,26 +989,26 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ if (cmdbuf->size) { kcmd_addr = drm_calloc(cmdbuf->size, 8, DRM_MEM_DRIVER); if (kcmd_addr == NULL) - return -ENOMEM; + return ENOMEM; if (DRM_COPY_FROM_USER(kcmd_addr, cmdbuf->cmd_addr, cmdbuf->size * 8)) { drm_free(kcmd_addr, cmdbuf->size * 8, DRM_MEM_DRIVER); - return -EFAULT; + return EFAULT; } cmdbuf->cmd_addr = kcmd_addr; } if (cmdbuf->vb_size) { kvb_addr = drm_alloc(cmdbuf->vb_size, DRM_MEM_DRIVER); if (kvb_addr == NULL) { - ret = -ENOMEM; + ret = ENOMEM; goto done; } if (DRM_COPY_FROM_USER(kvb_addr, cmdbuf->vb_addr, cmdbuf->vb_size)) { - ret = -EFAULT; + ret = EFAULT; goto done; } cmdbuf->vb_addr = kvb_addr; @@ -1017,14 +1017,14 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ kbox_addr = drm_calloc(cmdbuf->nbox, sizeof(struct drm_clip_rect), DRM_MEM_DRIVER); if (kbox_addr == NULL) { - ret = -ENOMEM; + ret = ENOMEM; goto done; } if (DRM_COPY_FROM_USER(kbox_addr, cmdbuf->box_addr, cmdbuf->nbox * sizeof(struct drm_clip_rect))) { - ret = -EFAULT; + ret = EFAULT; goto done; } cmdbuf->box_addr = kbox_addr; @@ -1057,7 +1057,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ DRM_ERROR("indexed drawing command extends " "beyond end of command buffer\n"); DMA_FLUSH(); - return -EINVAL; + return EINVAL; } /* fall through */ case SAVAGE_CMD_DMA_PRIM: @@ -1091,7 +1091,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ DRM_ERROR("command SAVAGE_CMD_STATE extends " "beyond end of command buffer\n"); DMA_FLUSH(); - ret = -EINVAL; + ret = EINVAL; goto done; } ret = savage_dispatch_state(dev_priv, &cmd_header, @@ -1104,7 +1104,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ DRM_ERROR("command SAVAGE_CMD_CLEAR extends " "beyond end of command buffer\n"); DMA_FLUSH(); - ret = -EINVAL; + ret = EINVAL; goto done; } ret = savage_dispatch_clear(dev_priv, &cmd_header, @@ -1122,7 +1122,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ DRM_ERROR("invalid command 0x%x\n", cmd_header.cmd.cmd); DMA_FLUSH(); - ret = -EINVAL; + ret = EINVAL; goto done; } diff --git a/sys/dev/pci/drm/sis_mm.c b/sys/dev/pci/drm/sis_mm.c index 8059e7435aa..f014805f786 100644 --- a/sys/dev/pci/drm/sis_mm.c +++ b/sys/dev/pci/drm/sis_mm.c @@ -101,7 +101,7 @@ int sis_fb_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv) if (!add_alloc_set(fb->context, VIDEO_TYPE, fb->free)) { DRM_DEBUG("adding to allocation set fails\n"); sis_free(req.offset); - retval = -EINVAL; + retval = EINVAL; } } else { fb->offset = 0; @@ -120,10 +120,10 @@ int sis_fb_free(struct drm_device *dev, void *data, struct drm_file *file_priv) int retval = 0; if (!fb->free) - return -EINVAL; + return EINVAL; if (!del_alloc_set(fb->context, VIDEO_TYPE, fb->free)) - retval = -EINVAL; + retval = EINVAL; sis_free(fb->free); DRM_DEBUG("free fb, offset = 0x%lx\n", fb->free); @@ -157,7 +157,7 @@ int sis_fb_init(struct drm_device *dev, void *data, struct drm_file *file_priv) } if (dev_priv->FBHeap != NULL) - return -EINVAL; + return EINVAL; dev_priv->FBHeap = mmInit(fb->offset, fb->size); @@ -174,7 +174,7 @@ int sis_fb_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv) int retval = 0; if (dev_priv == NULL || dev_priv->FBHeap == NULL) - return -EINVAL; + return EINVAL; block = mmAllocMem(dev_priv->FBHeap, fb->size, 0, 0); if (block) { @@ -184,7 +184,7 @@ int sis_fb_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv) if (!add_alloc_set(fb->context, VIDEO_TYPE, fb->free)) { DRM_DEBUG("adding to allocation set fails\n"); mmFreeMem((PMemBlock) fb->free); - retval = -EINVAL; + retval = EINVAL; } } else { fb->offset = 0; @@ -203,13 +203,13 @@ int sis_fb_free(struct drm_device *dev, void *data, struct drm_file *file_priv) drm_sis_mem_t *fb = data; if (dev_priv == NULL || dev_priv->FBHeap == NULL) - return -EINVAL; + return EINVAL; if (!mmBlockInHeap(dev_priv->FBHeap, (PMemBlock) fb->free)) - return -EINVAL; + return EINVAL; if (!del_alloc_set(fb->context, VIDEO_TYPE, fb->free)) - return -EINVAL; + return EINVAL; mmFreeMem((PMemBlock) fb->free); DRM_DEBUG("free fb, free = 0x%lx\n", fb->free); @@ -235,7 +235,7 @@ int sis_ioctl_agp_init(struct drm_device *dev, void *data, struct drm_file *file } if (dev_priv->AGPHeap != NULL) - return -EINVAL; + return EINVAL; dev_priv->AGPHeap = mmInit(agp->offset, agp->size); @@ -252,7 +252,7 @@ int sis_ioctl_agp_alloc(struct drm_device *dev, void *data, struct drm_file *fil int retval = 0; if (dev_priv == NULL || dev_priv->AGPHeap == NULL) - return -EINVAL; + return EINVAL; block = mmAllocMem(dev_priv->AGPHeap, agp->size, 0, 0); if (block) { @@ -282,14 +282,14 @@ int sis_ioctl_agp_free(struct drm_device *dev, void *data, struct drm_file *file drm_sis_mem_t *agp = data; if (dev_priv == NULL || dev_priv->AGPHeap == NULL) - return -EINVAL; + return EINVAL; if (!mmBlockInHeap(dev_priv->AGPHeap, (PMemBlock) agp->free)) - return -EINVAL; + return EINVAL; mmFreeMem((PMemBlock) agp->free); if (!del_alloc_set(agp->context, AGP_TYPE, agp->free)) - return -EINVAL; + return EINVAL; DRM_DEBUG("free agp, free = 0x%lx\n", agp->free); diff --git a/sys/dev/pci/drm/via_dma.c b/sys/dev/pci/drm/via_dma.c index 8263840a3cd..5bc38501868 100644 --- a/sys/dev/pci/drm/via_dma.c +++ b/sys/dev/pci/drm/via_dma.c @@ -165,22 +165,22 @@ static int via_initialize(struct drm_device * dev, { if (!dev_priv || !dev_priv->mmio) { DRM_ERROR("via_dma_init called before via_map_init\n"); - return -EFAULT; + return EFAULT; } if (dev_priv->ring.virtual_start != NULL) { DRM_ERROR("called again without calling cleanup\n"); - return -EFAULT; + return EFAULT; } if (!dev->agp || !dev->agp->base) { DRM_ERROR("called with no agp memory available\n"); - return -EFAULT; + return EFAULT; } if (dev_priv->chipset == VIA_DX9_0) { DRM_ERROR("AGP DMA is not supported on this chip\n"); - return -EINVAL; + return EINVAL; } dev_priv->ring.map.offset = dev->agp->base + init->offset; @@ -195,7 +195,7 @@ static int via_initialize(struct drm_device * dev, via_dma_cleanup(dev); DRM_ERROR("can not ioremap virtual address for" " ring buffer\n"); - return -ENOMEM; + return ENOMEM; } dev_priv->ring.virtual_start = dev_priv->ring.map.handle; @@ -224,22 +224,22 @@ static int via_dma_init(struct drm_device *dev, void *data, struct drm_file *fil switch (init->func) { case VIA_INIT_DMA: if (!DRM_SUSER(DRM_CURPROC)) - retcode = -EPERM; + retcode = EPERM; else retcode = via_initialize(dev, dev_priv, init); break; case VIA_CLEANUP_DMA: if (!DRM_SUSER(DRM_CURPROC)) - retcode = -EPERM; + retcode = EPERM; else retcode = via_dma_cleanup(dev); break; case VIA_DMA_INITIALIZED: retcode = (dev_priv->ring.virtual_start != NULL) ? - 0 : -EFAULT; + 0 : EFAULT; break; default: - retcode = -EINVAL; + retcode = EINVAL; break; } @@ -258,15 +258,15 @@ static int via_dispatch_cmdbuffer(struct drm_device * dev, drm_via_cmdbuffer_t * if (dev_priv->ring.virtual_start == NULL) { DRM_ERROR("called without initializing AGP ring buffer.\n"); - return -EFAULT; + return EFAULT; } if (cmd->size > VIA_PCI_BUF_SIZE) { - return -ENOMEM; + return ENOMEM; } if (DRM_COPY_FROM_USER(dev_priv->pci_buf, cmd->buf, cmd->size)) - return -EFAULT; + return EFAULT; /* * Running this function on AGP memory is dead slow. Therefore @@ -282,7 +282,7 @@ static int via_dispatch_cmdbuffer(struct drm_device * dev, drm_via_cmdbuffer_t * vb = via_check_dma(dev_priv, (cmd->size < 0x100) ? 0x102 : cmd->size); if (vb == NULL) { - return -EAGAIN; + return EAGAIN; } memcpy(vb, dev_priv->pci_buf, cmd->size); @@ -306,7 +306,7 @@ int via_driver_dma_quiescent(struct drm_device * dev) drm_via_private_t *dev_priv = dev->dev_private; if (!via_wait_idle(dev_priv)) { - return -EBUSY; + return EBUSY; } return 0; } @@ -343,10 +343,10 @@ static int via_dispatch_pci_cmdbuffer(struct drm_device * dev, int ret; if (cmd->size > VIA_PCI_BUF_SIZE) { - return -ENOMEM; + return ENOMEM; } if (DRM_COPY_FROM_USER(dev_priv->pci_buf, cmd->buf, cmd->size)) - return -EFAULT; + return EFAULT; if ((ret = via_verify_command_stream((uint32_t *) dev_priv->pci_buf, @@ -692,7 +692,7 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file * if (dev_priv->ring.virtual_start == NULL) { DRM_ERROR("called without initializing AGP ring buffer.\n"); - return -EFAULT; + return EFAULT; } count = 1000000; @@ -707,7 +707,7 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file * } if (!count) { DRM_ERROR("VIA_CMDBUF_SPACE timed out.\n"); - ret = -EAGAIN; + ret = EAGAIN; } break; case VIA_CMDBUF_LAG: @@ -719,11 +719,11 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file * } if (!count) { DRM_ERROR("VIA_CMDBUF_LAG timed out.\n"); - ret = -EAGAIN; + ret = EAGAIN; } break; default: - ret = -EFAULT; + ret = EFAULT; } d_siz->size = tmp_size; @@ -734,11 +734,11 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file * int via_dma_blit_sync( struct drm_device *dev, void *data, struct drm_file *file_priv ) { DRM_ERROR("PCI DMA BitBlt is not implemented for this system.\n"); - return -EINVAL; + return EINVAL; } int via_dma_blit( struct drm_device *dev, void *data, struct drm_file *file_priv ) { DRM_ERROR("PCI DMA BitBlt is not implemented for this system.\n"); - return -EINVAL; + return EINVAL; } #endif diff --git a/sys/dev/pci/drm/via_irq.c b/sys/dev/pci/drm/via_irq.c index c3279f8b5c2..56945bc9506 100644 --- a/sys/dev/pci/drm/via_irq.c +++ b/sys/dev/pci/drm/via_irq.c @@ -185,7 +185,7 @@ int via_enable_vblank(struct drm_device *dev, int crtc) if (crtc != 0) { DRM_ERROR("%s: bad crtc %d\n", __FUNCTION__, crtc); - return -EINVAL; + return EINVAL; } status = VIA_READ(VIA_REG_INTERRUPT); @@ -223,12 +223,12 @@ via_driver_irq_wait(struct drm_device * dev, unsigned int irq, int force_sequenc if (!dev_priv) { DRM_ERROR("called with no initialization\n"); - return -EINVAL; + return EINVAL; } if (irq >= drm_via_irq_num) { DRM_ERROR("Trying to wait on unknown irq %d\n", irq); - return -EINVAL; + return EINVAL; } real_irq = dev_priv->irq_map[irq]; @@ -236,7 +236,7 @@ via_driver_irq_wait(struct drm_device * dev, unsigned int irq, int force_sequenc if (real_irq < 0) { DRM_ERROR("Video IRQ %d not available on this hardware.\n", irq); - return -EINVAL; + return EINVAL; } masks = dev_priv->irq_masks; @@ -318,7 +318,7 @@ int via_driver_irq_postinstall(struct drm_device * dev) DRM_DEBUG("via_driver_irq_postinstall\n"); if (!dev_priv) - return -EINVAL; + return EINVAL; drm_vblank_init(dev, 1); status = VIA_READ(VIA_REG_INTERRUPT); @@ -361,12 +361,12 @@ int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv) int force_sequence; if (!dev->irq) - return -EINVAL; + return EINVAL; if (irqwait->request.irq >= dev_priv->num_irqs) { DRM_ERROR("Trying to wait on unknown irq %d\n", irqwait->request.irq); - return -EINVAL; + return EINVAL; } cur_irq += irqwait->request.irq; @@ -379,12 +379,12 @@ int via_wait_irq(struct drm_device *dev, void *data, struct drm_file *file_priv) case VIA_IRQ_ABSOLUTE: break; default: - return -EINVAL; + return EINVAL; } if (irqwait->request.type & VIA_IRQ_SIGNAL) { DRM_ERROR("Signals on Via IRQs not implemented yet.\n"); - return -EINVAL; + return EINVAL; } force_sequence = (irqwait->request.type & VIA_IRQ_FORCE_SEQUENCE); diff --git a/sys/dev/pci/drm/via_map.c b/sys/dev/pci/drm/via_map.c index 54934367e4b..f79811578df 100644 --- a/sys/dev/pci/drm/via_map.c +++ b/sys/dev/pci/drm/via_map.c @@ -37,7 +37,7 @@ static int via_do_init_map(struct drm_device * dev, drm_via_init_t * init) DRM_ERROR("could not find sarea!\n"); dev->dev_private = (void *)dev_priv; via_do_cleanup_map(dev); - return -EINVAL; + return EINVAL; } dev_priv->fb = drm_core_findmap(dev, init->fb_offset); @@ -45,14 +45,14 @@ static int via_do_init_map(struct drm_device * dev, drm_via_init_t * init) DRM_ERROR("could not find framebuffer!\n"); dev->dev_private = (void *)dev_priv; via_do_cleanup_map(dev); - return -EINVAL; + return EINVAL; } dev_priv->mmio = drm_core_findmap(dev, init->mmio_offset); if (!dev_priv->mmio) { DRM_ERROR("could not find mmio region!\n"); dev->dev_private = (void *)dev_priv; via_do_cleanup_map(dev); - return -EINVAL; + return EINVAL; } dev_priv->sarea_priv = @@ -101,7 +101,7 @@ int via_map_init(struct drm_device *dev, void *data, struct drm_file *file_priv) return via_do_cleanup_map(dev); } - return -EINVAL; + return EINVAL; } int via_driver_load(struct drm_device *dev, unsigned long chipset) @@ -111,7 +111,7 @@ int via_driver_load(struct drm_device *dev, unsigned long chipset) dev_priv = drm_calloc(1, sizeof(drm_via_private_t), DRM_MEM_DRIVER); if (dev_priv == NULL) - return -ENOMEM; + return ENOMEM; dev->dev_private = (void *)dev_priv; diff --git a/sys/dev/pci/drm/via_mm.c b/sys/dev/pci/drm/via_mm.c index 45790dc27af..2d175e17ad3 100644 --- a/sys/dev/pci/drm/via_mm.c +++ b/sys/dev/pci/drm/via_mm.c @@ -193,15 +193,15 @@ int via_mem_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv switch (mem.type) { case VIA_MEM_VIDEO: if (via_fb_alloc(mem) < 0) - return -EFAULT; + return EFAULT; return 0; case VIA_MEM_AGP: if (via_agp_alloc(mem) < 0) - return -EFAULT; + return EFAULT; return 0; } - return -EFAULT; + return EFAULT; } static int via_fb_alloc(drm_via_mem_t * mem) @@ -292,7 +292,7 @@ int via_mem_free(struct drm_device *dev, void *data, struct drm_file *file_priv) break; } - return -EFAULT; + return EFAULT; } static int via_fb_free(drm_via_mem_t * mem) diff --git a/sys/dev/pci/drm/via_verifier.c b/sys/dev/pci/drm/via_verifier.c index d2b69f745ca..20ef30fee0b 100644 --- a/sys/dev/pci/drm/via_verifier.c +++ b/sys/dev/pci/drm/via_verifier.c @@ -1031,12 +1031,12 @@ via_verify_command_stream(const uint32_t * buf, unsigned int size, case state_error: default: *hc_state = saved_state; - return -EINVAL; + return EINVAL; } } if (state == state_error) { *hc_state = saved_state; - return -EINVAL; + return EINVAL; } return 0; } @@ -1087,11 +1087,11 @@ via_parse_command_stream(struct drm_device * dev, const uint32_t * buf, break; case state_error: default: - return -EINVAL; + return EINVAL; } } if (state == state_error) { - return -EINVAL; + return EINVAL; } return 0; } diff --git a/sys/dev/pci/drm/via_video.c b/sys/dev/pci/drm/via_video.c index 6ec04ac1245..26a9bbc3f9f 100644 --- a/sys/dev/pci/drm/via_video.c +++ b/sys/dev/pci/drm/via_video.c @@ -76,7 +76,7 @@ int via_decoder_futex(struct drm_device *dev, void *data, struct drm_file *file_ DRM_DEBUG("\n"); if (fx->lock > VIA_NR_XVMC_LOCKS) - return -EFAULT; + return EFAULT; lock = (volatile int *)XVMCLOCKPTR(sAPriv, fx->lock); |