diff options
author | Eric Anholt <eric@anholt.net> | 2007-07-19 17:00:17 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-07-20 12:53:52 -0700 |
commit | e39286eb5eab8846a228863abf8f1b8b07a9e29d (patch) | |
tree | 7f0f599e514917546e195f2ec19eb869deb141c1 /linux-core | |
parent | 5dc9fd96d7bf48003db832f145ad8acb4bcb73b4 (diff) |
Remove DRM_ERR OS macro.
This was used to make all ioctl handlers return -errno on linux and errno on
*BSD. Instead, just return -errno in shared code, and flip sign on return from
shared code to *BSD code.
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/drm_drawable.c | 6 | ||||
-rw-r--r-- | linux-core/drm_ioctl.c | 2 | ||||
-rw-r--r-- | linux-core/drm_lock.c | 2 | ||||
-rw-r--r-- | linux-core/drm_os_linux.h | 1 | ||||
-rw-r--r-- | linux-core/i810_dma.c | 2 | ||||
-rw-r--r-- | linux-core/nouveau_sgdma.c | 10 | ||||
-rw-r--r-- | linux-core/sis_drv.c | 2 | ||||
-rw-r--r-- | linux-core/sis_mm.c | 4 | ||||
-rw-r--r-- | linux-core/via_buffer.c | 2 | ||||
-rw-r--r-- | linux-core/via_dmablit.c | 32 | ||||
-rw-r--r-- | linux-core/via_fence.c | 2 | ||||
-rw-r--r-- | linux-core/via_mm.c | 6 |
12 files changed, 35 insertions, 36 deletions
diff --git a/linux-core/drm_drawable.c b/linux-core/drm_drawable.c index d6cdba56..2787c9a3 100644 --- a/linux-core/drm_drawable.c +++ b/linux-core/drm_drawable.c @@ -130,7 +130,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) if (update.num && !rects) { DRM_ERROR("Failed to allocate cliprect memory\n"); - err = DRM_ERR(ENOMEM); + err = -ENOMEM; goto error; } @@ -140,7 +140,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) update.num * sizeof(*rects))) { DRM_ERROR("Failed to copy cliprects from userspace\n"); - err = DRM_ERR(EFAULT); + err = -EFAULT; goto error; } @@ -161,7 +161,7 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) break; default: DRM_ERROR("Invalid update type %d\n", update.type); - return DRM_ERR(EINVAL); + return -EINVAL; } return 0; diff --git a/linux-core/drm_ioctl.c b/linux-core/drm_ioctl.c index a7bacbb8..a2c3952c 100644 --- a/linux-core/drm_ioctl.c +++ b/linux-core/drm_ioctl.c @@ -121,7 +121,7 @@ int drm_setunique(struct inode *inode, struct file *filp, */ ret = sscanf(dev->unique, "PCI:%d:%d:%d", &bus, &slot, &func); if (ret != 3) - return DRM_ERR(EINVAL); + return -EINVAL; domain = bus >> 8; bus &= 0xff; diff --git a/linux-core/drm_lock.c b/linux-core/drm_lock.c index 1ba01aab..f3685ce0 100644 --- a/linux-core/drm_lock.c +++ b/linux-core/drm_lock.c @@ -125,7 +125,7 @@ int drm_lock(struct inode *inode, struct file *filp, if (dev->driver->dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT)) { if (dev->driver->dma_quiescent(dev)) { DRM_DEBUG( "%d waiting for DMA quiescent\n", lock.context); - return DRM_ERR(EBUSY); + return -EBUSY; } } diff --git a/linux-core/drm_os_linux.h b/linux-core/drm_os_linux.h index 9d0d3f69..3d2ad779 100644 --- a/linux-core/drm_os_linux.h +++ b/linux-core/drm_os_linux.h @@ -10,7 +10,6 @@ #define DRMFILE struct file * /** Ioctl arguments */ #define DRM_IOCTL_ARGS struct inode *inode, struct file *filp, unsigned int cmd, unsigned long data -#define DRM_ERR(d) -(d) /** Current process ID */ #define DRM_CURRENTPID current->pid #define DRM_SUSER(p) capable(CAP_SYS_ADMIN) diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c index 1e6d8cd3..4b43647e 100644 --- a/linux-core/i810_dma.c +++ b/linux-core/i810_dma.c @@ -399,7 +399,7 @@ static int i810_dma_initialize(struct drm_device * dev, i810_dma_cleanup(dev); DRM_ERROR("can not ioremap virtual address for" " ring buffer\n"); - return DRM_ERR(ENOMEM); + return -ENOMEM; } dev_priv->ring.virtual_start = dev_priv->ring.map.handle; diff --git a/linux-core/nouveau_sgdma.c b/linux-core/nouveau_sgdma.c index a65317cd..0ddac952 100644 --- a/linux-core/nouveau_sgdma.c +++ b/linux-core/nouveau_sgdma.c @@ -33,7 +33,7 @@ nouveau_sgdma_populate(struct drm_ttm_backend *be, unsigned long num_pages, DRM_DEBUG("num_pages = %ld\n", num_pages); if (nvbe->pagelist) - return DRM_ERR(EINVAL); + return -EINVAL; nvbe->pages = (num_pages << PAGE_SHIFT) >> NV_CTXDMA_PAGE_SHIFT; nvbe->pagelist = drm_alloc(nvbe->pages*sizeof(dma_addr_t), DRM_MEM_PAGES); @@ -48,7 +48,7 @@ nouveau_sgdma_populate(struct drm_ttm_backend *be, unsigned long num_pages, if (pci_dma_mapping_error(nvbe->pagelist[d])) { be->func->clear(be); DRM_ERROR("pci_map_page failed\n"); - return DRM_ERR(EINVAL); + return -EINVAL; } nvbe->pages_populated = ++d; } @@ -92,7 +92,7 @@ nouveau_sgdma_bind(struct drm_ttm_backend *be, unsigned long pg_start, DRM_DEBUG("pg=0x%lx (0x%llx), cached=%d\n", pg_start, offset, cached); if (offset & NV_CTXDMA_PAGE_MASK) - return DRM_ERR(EINVAL); + return -EINVAL; nvbe->pte_start = (offset >> NV_CTXDMA_PAGE_SHIFT); if (dev_priv->card_type < NV_50) nvbe->pte_start += 2; /* skip ctxdma header */ @@ -102,7 +102,7 @@ nouveau_sgdma_bind(struct drm_ttm_backend *be, unsigned long pg_start, if (pteval & NV_CTXDMA_PAGE_MASK) { DRM_ERROR("Bad pteval 0x%llx\n", pteval); - return DRM_ERR(EINVAL); + return -EINVAL; } if (dev_priv->card_type < NV_50) { @@ -282,7 +282,7 @@ nouveau_sgdma_nottm_hack_init(struct drm_device *dev) dev_priv->gart_info.sg_be = nouveau_sgdma_init_ttm(dev); if (!dev_priv->gart_info.sg_be) - return DRM_ERR(ENOMEM); + return -ENOMEM; be = dev_priv->gart_info.sg_be; /* Hack the aperture size down to the amount of system memory diff --git a/linux-core/sis_drv.c b/linux-core/sis_drv.c index b4c3f93b..c9112c63 100644 --- a/linux-core/sis_drv.c +++ b/linux-core/sis_drv.c @@ -43,7 +43,7 @@ static int sis_driver_load(struct drm_device *dev, unsigned long chipset) dev_priv = drm_calloc(1, sizeof(drm_sis_private_t), DRM_MEM_DRIVER); if (dev_priv == NULL) - return DRM_ERR(ENOMEM); + return -ENOMEM; dev->dev_private = (void *)dev_priv; dev_priv->chipset = chipset; diff --git a/linux-core/sis_mm.c b/linux-core/sis_mm.c index edbf8bf4..f9c7a7e2 100644 --- a/linux-core/sis_mm.c +++ b/linux-core/sis_mm.c @@ -139,7 +139,7 @@ static int sis_drm_alloc(struct drm_device * dev, struct drm_file * priv, dev_priv->agp_initialized)) { DRM_ERROR ("Attempt to allocate from uninitialized memory manager.\n"); - return DRM_ERR(EINVAL); + return -EINVAL; } mem.size = (mem.size + SIS_MM_ALIGN_MASK) >> SIS_MM_ALIGN_SHIFT; @@ -158,7 +158,7 @@ static int sis_drm_alloc(struct drm_device * dev, struct drm_file * priv, mem.offset = 0; mem.size = 0; mem.free = 0; - retval = DRM_ERR(ENOMEM); + retval = -ENOMEM; } DRM_COPY_TO_USER_IOCTL(argp, mem, sizeof(mem)); diff --git a/linux-core/via_buffer.c b/linux-core/via_buffer.c index 0461b3c7..eb5ea826 100644 --- a/linux-core/via_buffer.c +++ b/linux-core/via_buffer.c @@ -60,7 +60,7 @@ static int via_vram_info(struct drm_device *dev, struct pci_dev *pdev = dev->pdev; unsigned long flags; - int ret = DRM_ERR(EINVAL); + int ret = -EINVAL; int i; for (i=0; i<6; ++i) { flags = pci_resource_flags(pdev, i); diff --git a/linux-core/via_dmablit.c b/linux-core/via_dmablit.c index 6422609c..5e73bd1a 100644 --- a/linux-core/via_dmablit.c +++ b/linux-core/via_dmablit.c @@ -236,7 +236,7 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) first_pfn + 1; if (NULL == (vsg->pages = vmalloc(sizeof(struct page *) * vsg->num_pages))) - return DRM_ERR(ENOMEM); + return -ENOMEM; memset(vsg->pages, 0, sizeof(struct page *) * vsg->num_pages); down_read(¤t->mm->mmap_sem); ret = get_user_pages(current, current->mm, (unsigned long) xfer->mem_addr, @@ -248,7 +248,7 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) if (ret < 0) return ret; vsg->state = dr_via_pages_locked; - return DRM_ERR(EINVAL); + return -EINVAL; } vsg->state = dr_via_pages_locked; DRM_DEBUG("DMA pages locked\n"); @@ -271,14 +271,14 @@ via_alloc_desc_pages(drm_via_sg_info_t *vsg) vsg->descriptors_per_page; if (NULL == (vsg->desc_pages = kmalloc(sizeof(void *) * vsg->num_desc_pages, GFP_KERNEL))) - return DRM_ERR(ENOMEM); + return -ENOMEM; memset(vsg->desc_pages, 0, sizeof(void *) * vsg->num_desc_pages); vsg->state = dr_via_desc_pages_alloc; for (i=0; i<vsg->num_desc_pages; ++i) { if (NULL == (vsg->desc_pages[i] = (drm_via_descriptor_t *) __get_free_page(GFP_KERNEL))) - return DRM_ERR(ENOMEM); + return -ENOMEM; } DRM_DEBUG("Allocated %d pages for %d descriptors.\n", vsg->num_desc_pages, vsg->num_desc); @@ -606,7 +606,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli if (xfer->num_lines <= 0 || xfer->line_length <= 0) { DRM_ERROR("Zero size bitblt.\n"); - return DRM_ERR(EINVAL); + return -EINVAL; } /* @@ -619,7 +619,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli if ((xfer->mem_stride - xfer->line_length) >= PAGE_SIZE) { DRM_ERROR("Too large system memory stride. Stride: %d, " "Length: %d\n", xfer->mem_stride, xfer->line_length); - return DRM_ERR(EINVAL); + return -EINVAL; } if ((xfer->mem_stride == xfer->line_length) && @@ -637,7 +637,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli if (xfer->num_lines > 2048 || (xfer->num_lines*xfer->mem_stride > (2048*2048*4))) { DRM_ERROR("Too large PCI DMA bitblt.\n"); - return DRM_ERR(EINVAL); + return -EINVAL; } /* @@ -648,7 +648,7 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli if (xfer->mem_stride < xfer->line_length || abs(xfer->fb_stride) < xfer->line_length) { DRM_ERROR("Invalid frame-buffer / memory stride.\n"); - return DRM_ERR(EINVAL); + return -EINVAL; } /* @@ -661,13 +661,13 @@ via_build_sg_info(struct drm_device *dev, drm_via_sg_info_t *vsg, drm_via_dmabli if ((((unsigned long)xfer->mem_addr & 3) != ((unsigned long)xfer->fb_addr & 3)) || ((xfer->num_lines > 1) && ((xfer->mem_stride & 3) != (xfer->fb_stride & 3)))) { DRM_ERROR("Invalid DRM bitblt alignment.\n"); - return DRM_ERR(EINVAL); + return -EINVAL; } #else if ((((unsigned long)xfer->mem_addr & 15) || ((unsigned long)xfer->fb_addr & 3)) || ((xfer->num_lines > 1) && ((xfer->mem_stride & 15) || (xfer->fb_stride & 3)))) { DRM_ERROR("Invalid DRM bitblt alignment.\n"); - return DRM_ERR(EINVAL); + return -EINVAL; } #endif @@ -707,7 +707,7 @@ via_dmablit_grab_slot(drm_via_blitq_t *blitq, int engine) DRM_WAIT_ON(ret, blitq->busy_queue, DRM_HZ, blitq->num_free > 0); if (ret) { - return (DRM_ERR(EINTR) == ret) ? DRM_ERR(EAGAIN) : ret; + return (-EINTR == ret) ? -EAGAIN : ret; } spin_lock_irqsave(&blitq->blit_lock, irqsave); @@ -751,7 +751,7 @@ via_dmablit(struct drm_device *dev, drm_via_dmablit_t *xfer) if (dev_priv == NULL) { DRM_ERROR("Called without initialization.\n"); - return DRM_ERR(EINVAL); + return -EINVAL; } engine = (xfer->to_fb) ? 0 : 1; @@ -761,7 +761,7 @@ via_dmablit(struct drm_device *dev, drm_via_dmablit_t *xfer) } if (NULL == (vsg = kmalloc(sizeof(*vsg), GFP_KERNEL))) { via_dmablit_release_slot(blitq); - return DRM_ERR(ENOMEM); + return -ENOMEM; } if (0 != (ret = via_build_sg_info(dev, vsg, xfer))) { via_dmablit_release_slot(blitq); @@ -801,12 +801,12 @@ via_dma_blit_sync( DRM_IOCTL_ARGS ) DRM_COPY_FROM_USER_IOCTL(sync, (drm_via_blitsync_t *)data, sizeof(sync)); if (sync.engine >= VIA_NUM_BLIT_ENGINES) - return DRM_ERR(EINVAL); + return -EINVAL; err = via_dmablit_sync(dev, sync.sync_handle, sync.engine); - if (DRM_ERR(EINTR) == err) - err = DRM_ERR(EAGAIN); + if (-EINTR) == err + err = -EAGAIN; return err; } diff --git a/linux-core/via_fence.c b/linux-core/via_fence.c index a8db3d12..a6d4ece9 100644 --- a/linux-core/via_fence.c +++ b/linux-core/via_fence.c @@ -142,7 +142,7 @@ int via_fence_emit_sequence(struct drm_device * dev, uint32_t class, uint32_t fl *native_type = DRM_FENCE_TYPE_EXE; break; default: - ret = DRM_ERR(EINVAL); + ret = -EINVAL; break; } return ret; diff --git a/linux-core/via_mm.c b/linux-core/via_mm.c index 1ac51050..7cb8651d 100644 --- a/linux-core/via_mm.c +++ b/linux-core/via_mm.c @@ -138,7 +138,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS) if (mem.type > VIA_MEM_AGP) { DRM_ERROR("Unknown memory type allocation\n"); - return DRM_ERR(EINVAL); + return -EINVAL; } mutex_lock(&dev->struct_mutex); if (0 == ((mem.type == VIA_MEM_VIDEO) ? dev_priv->vram_initialized : @@ -146,7 +146,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS) DRM_ERROR ("Attempt to allocate from uninitialized memory manager.\n"); mutex_unlock(&dev->struct_mutex); - return DRM_ERR(EINVAL); + return -EINVAL; } tmpSize = (mem.size + VIA_MM_ALIGN_MASK) >> VIA_MM_ALIGN_SHIFT; @@ -164,7 +164,7 @@ int via_mem_alloc(DRM_IOCTL_ARGS) mem.size = 0; mem.index = 0; DRM_DEBUG("Video memory allocation failed\n"); - retval = DRM_ERR(ENOMEM); + retval = -ENOMEM; } DRM_COPY_TO_USER_IOCTL((drm_via_mem_t __user *) data, mem, sizeof(mem)); |