summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranholt <anholt@FreeBSD.org>2002-04-29 00:25:10 +0000
committeranholt <anholt@FreeBSD.org>2002-04-29 00:25:10 +0000
commitbb589e7417c17ba35f6dde61a74770697973f0c4 (patch)
treea41daedb2e90cf5f6d51ea1940bf76edec4de6a0
parent730253b82fd8aee07046e5d6a79003eac5811fdf (diff)
downloadFreeBSD-src-bb589e7417c17ba35f6dde61a74770697973f0c4.zip
FreeBSD-src-bb589e7417c17ba35f6dde61a74770697973f0c4.tar.gz
Diff reduction to my experimental code: clean up return code handling.
Approved by: des
-rw-r--r--sys/dev/drm/drm_auth.h6
-rw-r--r--sys/dev/drm/drm_bufs.h122
-rw-r--r--sys/dev/drm/drm_context.h38
-rw-r--r--sys/dev/drm/drm_dma.h28
-rw-r--r--sys/dev/drm/drm_drv.h38
-rw-r--r--sys/dev/drm/drm_fops.h4
-rw-r--r--sys/dev/drm/drm_ioctl.h18
-rw-r--r--sys/dev/drm/drm_lists.h8
-rw-r--r--sys/dev/drm/drm_memory.h22
-rw-r--r--sys/dev/drm/drm_os_freebsd.h2
-rw-r--r--sys/dev/drm/drm_scatter.h20
-rw-r--r--sys/dev/drm/drm_vm.h2
-rw-r--r--sys/dev/drm/gamma_dma.c42
-rw-r--r--sys/dev/drm/gamma_drv.h2
-rw-r--r--sys/dev/drm/mga_dma.c59
-rw-r--r--sys/dev/drm/mga_drv.h6
-rw-r--r--sys/dev/drm/mga_state.c26
-rw-r--r--sys/dev/drm/mga_warp.c10
-rw-r--r--sys/dev/drm/r128_cce.c56
-rw-r--r--sys/dev/drm/r128_drv.h4
-rw-r--r--sys/dev/drm/r128_state.c86
-rw-r--r--sys/dev/drm/radeon_cp.c56
-rw-r--r--sys/dev/drm/radeon_drv.h4
-rw-r--r--sys/dev/drm/radeon_state.c54
24 files changed, 354 insertions, 359 deletions
diff --git a/sys/dev/drm/drm_auth.h b/sys/dev/drm/drm_auth.h
index 2d5baf1..4eb62ab 100644
--- a/sys/dev/drm/drm_auth.h
+++ b/sys/dev/drm/drm_auth.h
@@ -65,7 +65,7 @@ int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
hash = DRM(hash_magic)(magic);
entry = (drm_magic_entry_t*) DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC);
- if (!entry) DRM_OS_RETURN(ENOMEM);
+ if (!entry) return DRM_OS_ERR(ENOMEM);
entry->magic = magic;
entry->priv = priv;
entry->next = NULL;
@@ -114,7 +114,7 @@ int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic)
DRM_OS_UNLOCK;
DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
int DRM(getmagic)(DRM_OS_IOCTL)
@@ -173,5 +173,5 @@ int DRM(authmagic)(DRM_OS_IOCTL)
DRM(remove_magic)(dev, auth.magic);
return 0;
}
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
diff --git a/sys/dev/drm/drm_bufs.h b/sys/dev/drm/drm_bufs.h
index 7d51b46..80308aa 100644
--- a/sys/dev/drm/drm_bufs.h
+++ b/sys/dev/drm/drm_bufs.h
@@ -98,16 +98,16 @@ int DRM(addmap)( DRM_OS_IOCTL )
#ifdef __FreeBSD__
if (!(dev->flags & (FREAD|FWRITE)))
#endif /* __FreeBSD__ */
- DRM_OS_RETURN(EACCES); /* Require read/write */
+ return DRM_OS_ERR(EACCES); /* Require read/write */
map = (drm_map_t *) DRM(alloc)( sizeof(*map), DRM_MEM_MAPS );
if ( !map )
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
#ifdef __linux__
if ( copy_from_user( map, (drm_map_t *)data, sizeof(*map) ) ) {
DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
- DRM_OS_RETURN(EFAULT);
+ return DRM_OS_ERR(EFAULT);
}
#endif /* __linux__ */
#ifdef __FreeBSD__
@@ -120,7 +120,7 @@ int DRM(addmap)( DRM_OS_IOCTL )
*/
if ( (map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM ) {
DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_DEBUG( "offset = 0x%08lx, size = 0x%08lx, type = %d\n",
map->offset, map->size, map->type );
@@ -131,7 +131,7 @@ int DRM(addmap)( DRM_OS_IOCTL )
if ( (map->offset & PAGE_MASK) || (map->size & PAGE_MASK) ) {
#endif /* __FreeBSD__ */
DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
map->mtrr = -1;
map->handle = 0;
@@ -161,7 +161,7 @@ int DRM(addmap)( DRM_OS_IOCTL )
#endif /* __linux__ */
) {
DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
#endif
#ifdef __alpha__
@@ -189,7 +189,7 @@ int DRM(addmap)( DRM_OS_IOCTL )
map->size, DRM(order)( map->size ), map->handle );
if ( !map->handle ) {
DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
map->offset = (unsigned long)map->handle;
if ( map->flags & _DRM_CONTAINS_LOCK ) {
@@ -208,20 +208,20 @@ int DRM(addmap)( DRM_OS_IOCTL )
case _DRM_SCATTER_GATHER:
if (!dev->sg) {
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
map->offset = map->offset + dev->sg->handle;
break;
default:
DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
list = DRM(alloc)(sizeof(*list), DRM_MEM_MAPS);
if(!list) {
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
memset(list, 0, sizeof(*list));
list->map = map;
@@ -237,7 +237,7 @@ int DRM(addmap)( DRM_OS_IOCTL )
#ifdef __linux__
if ( copy_to_user( (drm_map_t *)data, map, sizeof(*map) ) )
- DRM_OS_RETURN(EFAULT);
+ return DRM_OS_ERR(EFAULT);
#endif /* __linux__ */
#ifdef __FreeBSD__
*(drm_map_t *)data = *map;
@@ -248,7 +248,7 @@ int DRM(addmap)( DRM_OS_IOCTL )
if ( copy_to_user( &((drm_map_t *)data)->handle,
&map->offset,
sizeof(map->offset) ) )
- DRM_OS_RETURN(EFAULT);
+ return DRM_OS_ERR(EFAULT);
#endif /* __linux__ */
#ifdef __FreeBSD__
((drm_map_t *)data)->handle = (void *)map->offset;
@@ -295,7 +295,7 @@ int DRM(rmmap)( DRM_OS_IOCTL )
*/
if(list == (&dev->maplist->head)) {
DRM_OS_UNLOCK;
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
map = r_list->map;
list_del(list);
@@ -312,7 +312,7 @@ int DRM(rmmap)( DRM_OS_IOCTL )
*/
if(list == NULL) {
DRM_OS_UNLOCK;
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
TAILQ_REMOVE(dev->maplist, list, link);
#endif /* __FreeBSD__ */
@@ -419,7 +419,7 @@ int DRM(addbufs_agp)( DRM_OS_IOCTL )
int i;
drm_buf_t **temp_buflist;
- if ( !dma ) DRM_OS_RETURN(EINVAL);
+ if ( !dma ) return DRM_OS_ERR(EINVAL);
DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) );
@@ -449,14 +449,14 @@ int DRM(addbufs_agp)( DRM_OS_IOCTL )
DRM_DEBUG( "total: %d\n", total );
if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER )
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
if ( dev->queue_count )
- DRM_OS_RETURN(EBUSY); /* Not while in use */
+ return DRM_OS_ERR(EBUSY); /* Not while in use */
DRM_OS_SPINLOCK( &dev->count_lock );
if ( dev->buf_use ) {
DRM_OS_SPINUNLOCK( &dev->count_lock );
- DRM_OS_RETURN(EBUSY);
+ return DRM_OS_ERR(EBUSY);
}
atomic_inc( &dev->buf_alloc );
DRM_OS_SPINUNLOCK( &dev->count_lock );
@@ -466,13 +466,13 @@ int DRM(addbufs_agp)( DRM_OS_IOCTL )
if ( entry->buf_count ) {
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(ENOMEM); /* May only call once for each order */
+ return DRM_OS_ERR(ENOMEM); /* May only call once for each order */
}
if (count < 0 || count > 4096) {
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist),
@@ -480,7 +480,7 @@ int DRM(addbufs_agp)( DRM_OS_IOCTL )
if ( !entry->buflist ) {
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
memset( entry->buflist, 0, count * sizeof(*entry->buflist) );
@@ -544,7 +544,7 @@ int DRM(addbufs_agp)( DRM_OS_IOCTL )
DRM(cleanup_buf_error)(entry);
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
dma->buflist = temp_buflist;
@@ -600,7 +600,7 @@ int DRM(addbufs_pci)( DRM_OS_IOCTL )
unsigned long *temp_pagelist;
drm_buf_t **temp_buflist;
- if ( !dma ) DRM_OS_RETURN(EINVAL);
+ if ( !dma ) return DRM_OS_ERR(EINVAL);
DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) );
@@ -613,9 +613,9 @@ int DRM(addbufs_pci)( DRM_OS_IOCTL )
order, dev->queue_count );
if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER )
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
if ( dev->queue_count )
- DRM_OS_RETURN(EBUSY); /* Not while in use */
+ return DRM_OS_ERR(EBUSY); /* Not while in use */
alignment = (request.flags & _DRM_PAGE_ALIGN)
#ifdef __linux__
@@ -630,7 +630,7 @@ int DRM(addbufs_pci)( DRM_OS_IOCTL )
DRM_OS_SPINLOCK( &dev->count_lock );
if ( dev->buf_use ) {
DRM_OS_SPINUNLOCK( &dev->count_lock );
- DRM_OS_RETURN(EBUSY);
+ return DRM_OS_ERR(EBUSY);
}
atomic_inc( &dev->buf_alloc );
DRM_OS_SPINUNLOCK( &dev->count_lock );
@@ -640,13 +640,13 @@ int DRM(addbufs_pci)( DRM_OS_IOCTL )
if ( entry->buf_count ) {
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(ENOMEM); /* May only call once for each order */
+ return DRM_OS_ERR(ENOMEM); /* May only call once for each order */
}
if (count < 0 || count > 4096) {
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist),
@@ -654,7 +654,7 @@ int DRM(addbufs_pci)( DRM_OS_IOCTL )
if ( !entry->buflist ) {
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
memset( entry->buflist, 0, count * sizeof(*entry->buflist) );
@@ -666,7 +666,7 @@ int DRM(addbufs_pci)( DRM_OS_IOCTL )
DRM_MEM_BUFS );
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
memset( entry->seglist, 0, count * sizeof(*entry->seglist) );
@@ -684,7 +684,7 @@ int DRM(addbufs_pci)( DRM_OS_IOCTL )
DRM_MEM_SEGS );
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
dma->pagelist = temp_pagelist;
@@ -749,7 +749,7 @@ int DRM(addbufs_pci)( DRM_OS_IOCTL )
DRM(cleanup_buf_error)(entry);
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
dma->buflist = temp_buflist;
@@ -801,7 +801,7 @@ int DRM(addbufs_sg)( DRM_OS_IOCTL )
int i;
drm_buf_t **temp_buflist;
- if ( !dma ) DRM_OS_RETURN(EINVAL);
+ if ( !dma ) return DRM_OS_ERR(EINVAL);
DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) );
@@ -831,13 +831,13 @@ int DRM(addbufs_sg)( DRM_OS_IOCTL )
DRM_DEBUG( "total: %d\n", total );
if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER )
- DRM_OS_RETURN(EINVAL);
- if ( dev->queue_count ) DRM_OS_RETURN(EBUSY); /* Not while in use */
+ return DRM_OS_ERR(EINVAL);
+ if ( dev->queue_count ) return DRM_OS_ERR(EBUSY); /* Not while in use */
DRM_OS_SPINLOCK( &dev->count_lock );
if ( dev->buf_use ) {
DRM_OS_SPINUNLOCK( &dev->count_lock );
- DRM_OS_RETURN(EBUSY);
+ return DRM_OS_ERR(EBUSY);
}
atomic_inc( &dev->buf_alloc );
DRM_OS_SPINUNLOCK( &dev->count_lock );
@@ -847,13 +847,13 @@ int DRM(addbufs_sg)( DRM_OS_IOCTL )
if ( entry->buf_count ) {
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(ENOMEM); /* May only call once for each order */
+ return DRM_OS_ERR(ENOMEM); /* May only call once for each order */
}
if (count < 0 || count > 4096) {
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist),
@@ -861,7 +861,7 @@ int DRM(addbufs_sg)( DRM_OS_IOCTL )
if ( !entry->buflist ) {
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
memset( entry->buflist, 0, count * sizeof(*entry->buflist) );
@@ -900,7 +900,7 @@ int DRM(addbufs_sg)( DRM_OS_IOCTL )
DRM(cleanup_buf_error)(entry);
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
memset( buf->dev_private, 0, buf->dev_priv_size );
@@ -931,7 +931,7 @@ int DRM(addbufs_sg)( DRM_OS_IOCTL )
DRM(cleanup_buf_error)(entry);
DRM_OS_UNLOCK;
atomic_dec( &dev->buf_alloc );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
dma->buflist = temp_buflist;
@@ -999,7 +999,7 @@ int DRM(addbufs)( DRM_OS_IOCTL )
return DRM(addbufs_pci)( kdev, cmd, data, flags, p );
#endif /* __FreeBSD__ */
#else
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
#endif
}
@@ -1011,12 +1011,12 @@ int DRM(infobufs)( DRM_OS_IOCTL )
int i;
int count;
- if ( !dma ) DRM_OS_RETURN(EINVAL);
+ if ( !dma ) return DRM_OS_ERR(EINVAL);
DRM_OS_SPINLOCK( &dev->count_lock );
if ( atomic_read( &dev->buf_alloc ) ) {
DRM_OS_SPINUNLOCK( &dev->count_lock );
- DRM_OS_RETURN(EBUSY);
+ return DRM_OS_ERR(EBUSY);
}
++dev->buf_use; /* Can't allocate more after this call */
DRM_OS_SPINUNLOCK( &dev->count_lock );
@@ -1047,7 +1047,7 @@ int DRM(infobufs)( DRM_OS_IOCTL )
DRM_OS_COPYTOUSR( &to->high_mark,
&list->high_mark,
sizeof(list->high_mark) ) )
- DRM_OS_RETURN(EFAULT);
+ return DRM_OS_ERR(EFAULT);
DRM_DEBUG( "%d %d %d %d %d\n",
i,
@@ -1074,7 +1074,7 @@ int DRM(markbufs)( DRM_OS_IOCTL )
int order;
drm_buf_entry_t *entry;
- if ( !dma ) DRM_OS_RETURN(EINVAL);
+ if ( !dma ) return DRM_OS_ERR(EINVAL);
DRM_OS_KRNFROMUSR( request, (drm_buf_desc_t *)data, sizeof(request) );
@@ -1082,13 +1082,13 @@ int DRM(markbufs)( DRM_OS_IOCTL )
request.size, request.low_mark, request.high_mark );
order = DRM(order)( request.size );
if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER )
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
entry = &dma->bufs[order];
if ( request.low_mark < 0 || request.low_mark > entry->buf_count )
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
if ( request.high_mark < 0 || request.high_mark > entry->buf_count )
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
entry->freelist.low_mark = request.low_mark;
entry->freelist.high_mark = request.high_mark;
@@ -1105,7 +1105,7 @@ int DRM(freebufs)( DRM_OS_IOCTL )
int idx;
drm_buf_t *buf;
- if ( !dma ) DRM_OS_RETURN(EINVAL);
+ if ( !dma ) return DRM_OS_ERR(EINVAL);
DRM_OS_KRNFROMUSR( request, (drm_buf_free_t *)data, sizeof(request) );
@@ -1114,17 +1114,17 @@ int DRM(freebufs)( DRM_OS_IOCTL )
if ( DRM_OS_COPYFROMUSR( &idx,
&request.list[i],
sizeof(idx) ) )
- DRM_OS_RETURN(EFAULT);
+ return DRM_OS_ERR(EFAULT);
if ( idx < 0 || idx >= dma->buf_count ) {
DRM_ERROR( "Index %d (of %d max)\n",
idx, dma->buf_count - 1 );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
buf = dma->buflist[idx];
if ( buf->pid != DRM_OS_CURRENTPID ) {
DRM_ERROR( "Process %d freeing buffer owned by %d\n",
DRM_OS_CURRENTPID, buf->pid );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM(free_buffer)( dev, buf );
}
@@ -1152,12 +1152,12 @@ int DRM(mapbufs)( DRM_OS_IOCTL )
drm_buf_map_t request;
int i;
- if ( !dma ) DRM_OS_RETURN(EINVAL);
+ if ( !dma ) return DRM_OS_ERR(EINVAL);
DRM_OS_SPINLOCK( &dev->count_lock );
if ( atomic_read( &dev->buf_alloc ) ) {
DRM_OS_SPINUNLOCK( &dev->count_lock );
- DRM_OS_RETURN(EBUSY);
+ return DRM_OS_ERR(EBUSY);
}
dev->buf_use++; /* Can't allocate more after this call */
DRM_OS_SPINUNLOCK( &dev->count_lock );
@@ -1170,7 +1170,7 @@ int DRM(mapbufs)( DRM_OS_IOCTL )
drm_map_t *map = DRIVER_AGP_BUFFERS_MAP( dev );
if ( !map ) {
- retcode = EINVAL;
+ retcode = DRM_OS_ERR(EINVAL);
goto done;
}
@@ -1246,26 +1246,26 @@ int DRM(mapbufs)( DRM_OS_IOCTL )
if ( DRM_OS_COPYTOUSR( &request.list[i].idx,
&dma->buflist[i]->idx,
sizeof(request.list[0].idx) ) ) {
- retcode = EFAULT;
+ retcode = DRM_OS_ERR(EFAULT);
goto done;
}
if ( DRM_OS_COPYTOUSR( &request.list[i].total,
&dma->buflist[i]->total,
sizeof(request.list[0].total) ) ) {
- retcode = EFAULT;
+ retcode = DRM_OS_ERR(EFAULT);
goto done;
}
if ( DRM_OS_COPYTOUSR( &request.list[i].used,
&zero,
sizeof(zero) ) ) {
- retcode = EFAULT;
+ retcode = DRM_OS_ERR(EFAULT);
goto done;
}
address = virtual + dma->buflist[i]->offset; /* *** */
if ( DRM_OS_COPYTOUSR( &request.list[i].address,
&address,
sizeof(address) ) ) {
- retcode = EFAULT;
+ retcode = DRM_OS_ERR(EFAULT);
goto done;
}
}
@@ -1277,7 +1277,7 @@ int DRM(mapbufs)( DRM_OS_IOCTL )
DRM_OS_KRNTOUSR( (drm_buf_map_t *)data, request, sizeof(request) );
- DRM_OS_RETURN(retcode);
+ return retcode;
}
#endif /* __HAVE_DMA */
diff --git a/sys/dev/drm/drm_context.h b/sys/dev/drm/drm_context.h
index dd028ac..ec70483 100644
--- a/sys/dev/drm/drm_context.h
+++ b/sys/dev/drm/drm_context.h
@@ -118,7 +118,7 @@ int DRM(ctxbitmap_init)( drm_device_t *dev )
DRM_MEM_CTXBITMAP );
if ( dev->ctx_bitmap == NULL ) {
DRM_OS_UNLOCK;
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
memset( (void *)dev->ctx_bitmap, 0, PAGE_SIZE );
dev->context_sareas = NULL;
@@ -160,7 +160,7 @@ int DRM(getsareactx)( DRM_OS_IOCTL )
DRM_OS_LOCK;
if (dev->max_context < 0 || request.ctx_id >= (unsigned) dev->max_context) {
DRM_OS_UNLOCK;
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
map = dev->context_sareas[request.ctx_id];
@@ -208,7 +208,7 @@ int DRM(setsareactx)( DRM_OS_IOCTL )
bad:
DRM_OS_UNLOCK;
- return -EINVAL;
+ return DRM_OS_ERR(EINVAL);
found:
#ifdef __linux__
@@ -237,7 +237,7 @@ int DRM(context_switch)( drm_device_t *dev, int old, int new )
if ( test_and_set_bit( 0, &dev->context_flag ) ) {
DRM_ERROR( "Reentering -- FIXME\n" );
- DRM_OS_RETURN(EBUSY);
+ return DRM_OS_ERR(EBUSY);
}
#if __HAVE_DMA_HISTOGRAM
@@ -298,7 +298,7 @@ int DRM(resctx)( DRM_OS_IOCTL )
ctx.handle = i;
if ( DRM_OS_COPYTOUSR( &res.contexts[i],
&i, sizeof(i) ) )
- DRM_OS_RETURN(EFAULT);
+ return DRM_OS_ERR(EFAULT);
}
}
res.count = DRM_RESERVED_CONTEXTS;
@@ -324,7 +324,7 @@ int DRM(addctx)( DRM_OS_IOCTL )
if ( ctx.handle == -1 ) {
DRM_DEBUG( "Not enough free contexts.\n" );
/* Should this return -EBUSY instead? */
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
DRM_OS_KRNTOUSR( (drm_ctx_t *)data, ctx, sizeof(ctx) );
@@ -415,7 +415,7 @@ int DRM(context_switch)(drm_device_t *dev, int old, int new)
if (test_and_set_bit(0, &dev->context_flag)) {
DRM_ERROR("Reentering -- FIXME\n");
- DRM_OS_RETURN(EBUSY);
+ return DRM_OS_ERR(EBUSY);
}
#if __HAVE_DMA_HISTOGRAM
@@ -426,7 +426,7 @@ int DRM(context_switch)(drm_device_t *dev, int old, int new)
if (new >= dev->queue_count) {
clear_bit(0, &dev->context_flag);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
if (new == dev->last_context) {
@@ -439,7 +439,7 @@ int DRM(context_switch)(drm_device_t *dev, int old, int new)
if (atomic_read(&q->use_count) == 1) {
atomic_dec(&q->use_count);
clear_bit(0, &dev->context_flag);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
if (DRM(flags) & DRM_FLAG_NOCTX) {
@@ -569,7 +569,7 @@ static int DRM(alloc_queue)(drm_device_t *dev)
if (!dev->queuelist) {
DRM_OS_UNLOCK;
DRM_DEBUG("out of memory\n");
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
}
dev->queuelist[dev->queue_count-1] = queue;
@@ -596,7 +596,7 @@ int DRM(resctx)( DRM_OS_IOCTL )
if (DRM_OS_COPYTOUSR(&res.contexts[i],
&i,
sizeof(i)))
- DRM_OS_RETURN(EFAULT);
+ return DRM_OS_ERR(EFAULT);
}
}
res.count = DRM_RESERVED_CONTEXTS;
@@ -637,19 +637,19 @@ int DRM(modctx)( DRM_OS_IOCTL )
DRM_DEBUG("%d\n", ctx.handle);
if (ctx.handle < 0 || ctx.handle >= dev->queue_count)
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
q = dev->queuelist[ctx.handle];
atomic_inc(&q->use_count);
if (atomic_read(&q->use_count) == 1) {
/* No longer in use */
atomic_dec(&q->use_count);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
if (DRM_BUFCOUNT(&q->waitlist)) {
atomic_dec(&q->use_count);
- DRM_OS_RETURN(EBUSY);
+ return DRM_OS_ERR(EBUSY);
}
q->flags = ctx.flags;
@@ -669,14 +669,14 @@ int DRM(getctx)( DRM_OS_IOCTL )
DRM_DEBUG("%d\n", ctx.handle);
if (ctx.handle >= dev->queue_count)
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
q = dev->queuelist[ctx.handle];
atomic_inc(&q->use_count);
if (atomic_read(&q->use_count) == 1) {
/* No longer in use */
atomic_dec(&q->use_count);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
ctx.flags = q->flags;
@@ -722,14 +722,14 @@ int DRM(rmctx)( DRM_OS_IOCTL )
DRM_DEBUG("%d\n", ctx.handle);
- if (ctx.handle >= dev->queue_count) DRM_OS_RETURN(EINVAL);
+ if (ctx.handle >= dev->queue_count) return DRM_OS_ERR(EINVAL);
q = dev->queuelist[ctx.handle];
atomic_inc(&q->use_count);
if (atomic_read(&q->use_count) == 1) {
/* No longer in use */
atomic_dec(&q->use_count);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
atomic_inc(&q->finalization); /* Mark queue in finalization state */
@@ -741,7 +741,7 @@ int DRM(rmctx)( DRM_OS_IOCTL )
schedule();
if (signal_pending(current)) {
clear_bit(0, &dev->interrupt_flag);
- DRM_OS_RETURN(EINTR);
+ return DRM_OS_ERR(EINTR);
}
#endif /* __linux__ */
#ifdef __FreeBSD__
diff --git a/sys/dev/drm/drm_dma.h b/sys/dev/drm/drm_dma.h
index 73d0efb..e5e9948 100644
--- a/sys/dev/drm/drm_dma.h
+++ b/sys/dev/drm/drm_dma.h
@@ -67,7 +67,7 @@ int DRM(dma_setup)( drm_device_t *dev )
dev->dma = DRM(alloc)( sizeof(*dev->dma), DRM_MEM_DRIVER );
if ( !dev->dma )
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
memset( dev->dma, 0, sizeof(*dev->dma) );
@@ -371,7 +371,7 @@ int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *d)
if (!_DRM_LOCK_IS_HELD(context)) {
DRM_ERROR("No lock held during \"while locked\""
" request\n");
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
if (d->context != _DRM_LOCKING_CONTEXT(context)
&& _DRM_LOCKING_CONTEXT(context) != DRM_KERNEL_CONTEXT) {
@@ -379,7 +379,7 @@ int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *d)
" \"while locked\" request\n",
_DRM_LOCKING_CONTEXT(context),
d->context);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
q = dev->queuelist[DRM_KERNEL_CONTEXT];
while_locked = 1;
@@ -400,7 +400,7 @@ int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *d)
if (signal_pending(current)) {
atomic_dec(&q->use_count);
remove_wait_queue(&q->write_queue, &entry);
- DRM_OS_RETURN(EINTR);
+ return DRM_OS_ERR(EINTR);
}
}
atomic_dec(&q->block_count);
@@ -428,14 +428,14 @@ int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *d)
atomic_dec(&q->use_count);
DRM_ERROR("Index %d (of %d max)\n",
d->send_indices[i], dma->buf_count - 1);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
buf = dma->buflist[ idx ];
if (buf->pid != DRM_OS_CURRENTPID) {
atomic_dec(&q->use_count);
DRM_ERROR("Process %d using buffer owned by %d\n",
DRM_OS_CURRENTPID, buf->pid);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
if (buf->list != DRM_LIST_NONE) {
atomic_dec(&q->use_count);
@@ -453,14 +453,14 @@ int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *d)
DRM_ERROR("Queueing pending buffer:"
" buffer %d, offset %d\n",
d->send_indices[i], i);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
if (buf->waiting) {
atomic_dec(&q->use_count);
DRM_ERROR("Queueing waiting buffer:"
" buffer %d, offset %d\n",
d->send_indices[i], i);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
buf->waiting = 1;
if (atomic_read(&q->use_count) == 1
@@ -498,12 +498,12 @@ static int DRM(dma_get_buffers_of_order)(drm_device_t *dev, drm_dma_t *d,
if (DRM_OS_COPYTOUSR(&d->request_indices[i],
&buf->idx,
sizeof(buf->idx)))
- DRM_OS_RETURN(EFAULT);
+ return DRM_OS_ERR(EFAULT);
if (DRM_OS_COPYTOUSR(&d->request_sizes[i],
&buf->total,
sizeof(buf->total)))
- DRM_OS_RETURN(EFAULT);
+ return DRM_OS_ERR(EFAULT);
++d->granted_count;
}
@@ -563,12 +563,12 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
int retcode;
if ( !irq )
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
DRM_OS_LOCK;
if ( dev->irq ) {
DRM_OS_UNLOCK;
- DRM_OS_RETURN(EBUSY);
+ return DRM_OS_ERR(EBUSY);
}
dev->irq = irq;
DRM_OS_UNLOCK;
@@ -640,7 +640,7 @@ int DRM(irq_uninstall)( drm_device_t *dev )
DRM_OS_UNLOCK;
if ( !irq )
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq );
@@ -670,7 +670,7 @@ int DRM(control)( DRM_OS_IOCTL )
case DRM_UNINST_HANDLER:
return DRM(irq_uninstall)( dev );
default:
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
}
diff --git a/sys/dev/drm/drm_drv.h b/sys/dev/drm/drm_drv.h
index 16fe88d..5381f8f 100644
--- a/sys/dev/drm/drm_drv.h
+++ b/sys/dev/drm/drm_drv.h
@@ -402,7 +402,7 @@ static int DRM(setup)( drm_device_t *dev )
dev->maplist = DRM(alloc)(sizeof(*dev->maplist),
DRM_MEM_MAPS);
- if(dev->maplist == NULL) DRM_OS_RETURN(ENOMEM);
+ if(dev->maplist == NULL) return DRM_OS_ERR(ENOMEM);
memset(dev->maplist, 0, sizeof(*dev->maplist));
#ifdef __linux__
INIT_LIST_HEAD(&dev->maplist->head);
@@ -727,12 +727,12 @@ static int DRM(init)( device_t nbdev )
DRM(device) = DRM_OS_MALLOC(sizeof(*DRM(device)) * DRM(numdevs));
if (!DRM(device)) {
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
DRM(minor) = DRM_OS_MALLOC(sizeof(*(DRM(minor))) * DRM(numdevs));
if (!DRM(minor)) {
DRM_OS_FREE(DRM(device));
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
DRIVER_PREINIT();
@@ -789,7 +789,7 @@ static int DRM(init)( device_t nbdev )
destroy_dev(dev->devnode);
#endif /* __FreeBSD__ */
DRM(takedown)( dev );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
#endif
#if __REALLY_HAVE_MTRR
@@ -910,7 +910,7 @@ int DRM(version)( DRM_OS_IOCTL )
name##_len = strlen( value ); \
if ( len && name ) { \
if ( DRM_OS_COPYTOUSR( name, value, len ) ) \
- DRM_OS_RETURN(EFAULT); \
+ return DRM_OS_ERR(EFAULT); \
}
version.version_major = DRIVER_MAJOR;
@@ -950,7 +950,7 @@ int DRM( open)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p)
#endif /* __FreeBSD__ */
}
if (!dev) {
- DRM_OS_RETURN(ENODEV);
+ return DRM_OS_ERR(ENODEV);
}
DRM_DEBUG( "open_count = %d\n", dev->open_count );
@@ -1045,7 +1045,7 @@ int DRM( close)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p)
#endif /* __linux__ */
if ( !dev->lock.hw_lock ) {
/* Device has been unregistered */
- retcode = EINTR;
+ retcode = DRM_OS_ERR(EINTR);
break;
}
if ( DRM(lock_take)( &dev->lock.hw_lock->lock,
@@ -1067,7 +1067,7 @@ int DRM( close)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p)
#ifdef __linux__
schedule();
if ( signal_pending( current ) ) {
- retcode = ERESTARTSYS;
+ retcode = DRM_OS_ERR(ERESTARTSYS);
break;
}
#endif /* __linux__ */
@@ -1149,7 +1149,7 @@ int DRM( close)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p)
#ifdef __linux__
unlock_kernel();
#endif /* __linux__ */
- DRM_OS_RETURN(EBUSY);
+ return DRM_OS_ERR(EBUSY);
}
DRM_OS_SPINUNLOCK( &dev->count_lock );
#ifdef __linux__
@@ -1166,7 +1166,7 @@ int DRM( close)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p)
unlock_kernel();
#endif /* __linux__ */
- DRM_OS_RETURN(retcode);
+ return retcode;
}
/* DRM(ioctl) is called whenever a process performs an ioctl on /dev/drm.
@@ -1215,17 +1215,17 @@ int DRM(ioctl)( DRM_OS_IOCTL )
#endif /* __FreeBSD__ */
if ( nr >= DRIVER_IOCTL_COUNT ) {
- retcode = EINVAL;
+ retcode = DRM_OS_ERR(EINVAL);
} else {
ioctl = &DRM(ioctls)[nr];
func = ioctl->func;
if ( !func ) {
DRM_DEBUG( "no function\n" );
- retcode = EINVAL;
+ retcode = DRM_OS_ERR(EINVAL);
} else if ( ( ioctl->root_only && DRM_OS_CHECKSUSER )
|| ( ioctl->auth_needed && !priv->authenticated ) ) {
- retcode = EACCES;
+ retcode = DRM_OS_ERR(EACCES);
} else {
#ifdef __linux__
retcode = func( inode, filp, cmd, data );
@@ -1237,7 +1237,7 @@ int DRM(ioctl)( DRM_OS_IOCTL )
}
atomic_dec( &dev->ioctl_count );
- DRM_OS_RETURN(retcode);
+ return retcode;
}
int DRM(lock)( DRM_OS_IOCTL )
@@ -1262,7 +1262,7 @@ int DRM(lock)( DRM_OS_IOCTL )
if ( lock.context == DRM_KERNEL_CONTEXT ) {
DRM_ERROR( "Process %d using kernel context %d\n",
DRM_OS_CURRENTPID, lock.context );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_DEBUG( "%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
@@ -1271,10 +1271,10 @@ int DRM(lock)( DRM_OS_IOCTL )
#if __HAVE_DMA_QUEUE
if ( lock.context < 0 )
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
#elif __HAVE_MULTIPLE_DMA_QUEUES
if ( lock.context < 0 || lock.context >= dev->queue_count )
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
q = dev->queuelist[lock.context];
#endif
@@ -1366,7 +1366,7 @@ int DRM(lock)( DRM_OS_IOCTL )
atomic_inc(&dev->histo.lacq[DRM(histogram_slot)(get_cycles()-start)]);
#endif
- DRM_OS_RETURN(ret);
+ return DRM_OS_ERR(ret);
}
@@ -1380,7 +1380,7 @@ int DRM(unlock)( DRM_OS_IOCTL )
if ( lock.context == DRM_KERNEL_CONTEXT ) {
DRM_ERROR( "Process %d using kernel context %d\n",
DRM_OS_CURRENTPID, lock.context );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] );
diff --git a/sys/dev/drm/drm_fops.h b/sys/dev/drm/drm_fops.h
index 2673629..0ee345b 100644
--- a/sys/dev/drm/drm_fops.h
+++ b/sys/dev/drm/drm_fops.h
@@ -85,13 +85,13 @@ int DRM(open_helper)(dev_t kdev, int flags, int fmt, DRM_OS_STRUCTPROC *p,
dev->flags = flags;
#endif /* __FreeBSD__ */
if (!DRM(cpu_valid)())
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
DRM_DEBUG("pid = %d, minor = %d\n", DRM_OS_CURRENTPID, m);
#ifdef __linux__
priv = (drm_file_t *) DRM(alloc)(sizeof(*priv), DRM_MEM_FILES);
- if(!priv) DRM_OS_RETURN(ENOMEM);
+ if(!priv) return DRM_OS_ERR(ENOMEM);
memset(priv, 0, sizeof(*priv));
filp->private_data = priv;
diff --git a/sys/dev/drm/drm_ioctl.h b/sys/dev/drm/drm_ioctl.h
index 24e55e9..3989a31 100644
--- a/sys/dev/drm/drm_ioctl.h
+++ b/sys/dev/drm/drm_ioctl.h
@@ -101,7 +101,7 @@ int DRM(getunique)( DRM_OS_IOCTL )
if (u.unique_len >= dev->unique_len) {
if (DRM_OS_COPYTOUSR(u.unique, dev->unique, dev->unique_len))
- DRM_OS_RETURN(EFAULT);
+ return DRM_OS_ERR(EFAULT);
}
u.unique_len = dev->unique_len;
@@ -116,20 +116,20 @@ int DRM(setunique)( DRM_OS_IOCTL )
drm_unique_t u;
if (dev->unique_len || dev->unique)
- DRM_OS_RETURN(EBUSY);
+ return DRM_OS_ERR(EBUSY);
DRM_OS_KRNFROMUSR( u, (drm_unique_t *)data, sizeof(u) );
if (!u.unique_len || u.unique_len > 1024)
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
dev->unique_len = u.unique_len;
dev->unique = DRM(alloc)(u.unique_len + 1, DRM_MEM_DRIVER);
- if(!dev->unique) DRM_OS_RETURN(ENOMEM);
+ if(!dev->unique) return DRM_OS_ERR(ENOMEM);
if (DRM_OS_COPYFROMUSR(dev->unique, u.unique, dev->unique_len))
- DRM_OS_RETURN(EFAULT);
+ return DRM_OS_ERR(EFAULT);
dev->unique[dev->unique_len] = '\0';
@@ -137,7 +137,7 @@ int DRM(setunique)( DRM_OS_IOCTL )
DRM_MEM_DRIVER);
if(!dev->devname) {
DRM(free)(dev->devname, sizeof(*dev->devname), DRM_MEM_DRIVER);
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
sprintf(dev->devname, "%s@%s", dev->name, dev->unique);
@@ -192,7 +192,7 @@ int DRM(getmap)( DRM_OS_IOCTL )
DRM_OS_LOCK;
if (idx < 0 || idx >= dev->map_count) {
DRM_OS_UNLOCK;
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
#ifdef __linux__
@@ -205,7 +205,7 @@ int DRM(getmap)( DRM_OS_IOCTL )
}
if(!r_list || !r_list->map) {
DRM_OS_UNLOCK;
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
map.offset = r_list->map->offset;
@@ -261,7 +261,7 @@ int DRM(getclient)( DRM_OS_IOCTL )
if (!pt) {
DRM_OS_UNLOCK;
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
client.auth = pt->authenticated;
client.pid = pt->pid;
diff --git a/sys/dev/drm/drm_lists.h b/sys/dev/drm/drm_lists.h
index c0c819b..bc26687 100644
--- a/sys/dev/drm/drm_lists.h
+++ b/sys/dev/drm/drm_lists.h
@@ -39,12 +39,12 @@
int DRM(waitlist_create)(drm_waitlist_t *bl, int count)
{
if (bl->count)
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
bl->bufs = DRM(alloc)((bl->count + 2) * sizeof(*bl->bufs),
DRM_MEM_BUFLISTS);
- if(!bl->bufs) DRM_OS_RETURN(ENOMEM);
+ if(!bl->bufs) return DRM_OS_ERR(ENOMEM);
bl->count = count;
bl->rp = bl->bufs;
@@ -58,7 +58,7 @@ int DRM(waitlist_create)(drm_waitlist_t *bl, int count)
int DRM(waitlist_destroy)(drm_waitlist_t *bl)
{
if (bl->rp != bl->wp)
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
if (bl->bufs) DRM(free)(bl->bufs,
(bl->count + 2) * sizeof(*bl->bufs),
DRM_MEM_BUFLISTS);
@@ -83,7 +83,7 @@ int DRM(waitlist_put)(drm_waitlist_t *bl, drm_buf_t *buf)
if (!left) {
DRM_ERROR("Overflow while adding buffer %d from pid %d\n",
buf->idx, buf->pid);
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
#if __HAVE_DMA_HISTOGRAM
#ifdef __linux__
diff --git a/sys/dev/drm/drm_memory.h b/sys/dev/drm/drm_memory.h
index 51e99e3..4e56ea2 100644
--- a/sys/dev/drm/drm_memory.h
+++ b/sys/dev/drm/drm_memory.h
@@ -489,7 +489,7 @@ int DRM(free_agp)(agp_memory *handle, int pages)
if (!handle) {
DRM_MEM_ERROR(DRM_MEM_TOTALAGP,
"Attempt to free NULL AGP handle\n");
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
if (DRM(agp_free_memory)(handle)) {
@@ -506,7 +506,7 @@ int DRM(free_agp)(agp_memory *handle, int pages)
}
return 0;
}
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
int DRM(bind_agp)(agp_memory *handle, unsigned int start)
@@ -517,13 +517,13 @@ int DRM(bind_agp)(agp_memory *handle, unsigned int start)
struct agp_memory_info info;
if (!dev)
- return EINVAL;
+ return DRM_OS_ERR(EINVAL);
#endif /* __FreeBSD__ */
if (!handle) {
DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
"Attempt to bind NULL AGP handle\n");
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
if (!(retcode = DRM(agp_bind_memory)(handle, start))) {
@@ -539,31 +539,31 @@ int DRM(bind_agp)(agp_memory *handle, unsigned int start)
+= info.ami_size;
#endif /* __FreeBSD__ */
DRM_OS_SPINUNLOCK(&DRM(mem_lock));
- DRM_OS_RETURN(0);
+ return 0;
}
DRM_OS_SPINLOCK(&DRM(mem_lock));
++DRM(mem_stats)[DRM_MEM_BOUNDAGP].fail_count;
DRM_OS_SPINUNLOCK(&DRM(mem_lock));
- DRM_OS_RETURN(retcode);
+ return retcode;
}
int DRM(unbind_agp)(agp_memory *handle)
{
int alloc_count;
int free_count;
- int retcode = EINVAL;
+ int retcode = DRM_OS_ERR(EINVAL);
#ifdef __FreeBSD__
device_t dev = agp_find_device();
struct agp_memory_info info;
if (!dev)
- return EINVAL;
+ return DRM_OS_ERR(EINVAL);
#endif /* __FreeBSD__ */
if (!handle) {
DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
"Attempt to unbind NULL AGP handle\n");
- DRM_OS_RETURN(retcode);
+ return retcode;
}
#ifdef __FreeBSD__
@@ -571,7 +571,7 @@ int DRM(unbind_agp)(agp_memory *handle)
#endif /* __FreeBSD__ */
if ((retcode = DRM(agp_unbind_memory)(handle)))
- DRM_OS_RETURN(retcode);
+ return retcode;
DRM_OS_SPINLOCK(&DRM(mem_lock));
free_count = ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].free_count;
@@ -590,6 +590,6 @@ int DRM(unbind_agp)(agp_memory *handle)
"Excess frees: %d frees, %d allocs\n",
free_count, alloc_count);
}
- DRM_OS_RETURN(retcode);
+ return retcode;
}
#endif
diff --git a/sys/dev/drm/drm_os_freebsd.h b/sys/dev/drm/drm_os_freebsd.h
index 5c2483a..cbe715a 100644
--- a/sys/dev/drm/drm_os_freebsd.h
+++ b/sys/dev/drm/drm_os_freebsd.h
@@ -102,7 +102,7 @@ do { \
while (((tv2.tv_sec-tv1.tv_sec)*1000000 + tv2.tv_usec - tv1.tv_usec) < udelay ); \
} while (0)
-#define DRM_OS_RETURN(v) return v;
+#define DRM_OS_ERR(v) v
#define DRM_OS_KRNTOUSR(arg1, arg2, arg3) \
diff --git a/sys/dev/drm/drm_scatter.h b/sys/dev/drm/drm_scatter.h
index 2ad543c..c089704 100644
--- a/sys/dev/drm/drm_scatter.h
+++ b/sys/dev/drm/drm_scatter.h
@@ -75,16 +75,16 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
DRM_DEBUG( "%s\n", __FUNCTION__ );
if ( dev->sg )
- return -EINVAL;
+ return DRM_OS_ERR(EINVAL);
if ( copy_from_user( &request,
(drm_scatter_gather_t *)arg,
sizeof(request) ) )
- return -EFAULT;
+ return DRM_OS_ERR(EFAULT);
entry = DRM(alloc)( sizeof(*entry), DRM_MEM_SGLISTS );
if ( !entry )
- return -ENOMEM;
+ return DRM_OS_ERR(ENOMEM);
memset( entry, 0, sizeof(*entry) );
@@ -96,7 +96,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
DRM_MEM_PAGES );
if ( !entry->pagelist ) {
DRM(free)( entry, sizeof(*entry), DRM_MEM_SGLISTS );
- return -ENOMEM;
+ return DRM_OS_ERR(ENOMEM);
}
entry->busaddr = DRM(alloc)( pages * sizeof(*entry->busaddr),
@@ -108,7 +108,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
DRM(free)( entry,
sizeof(*entry),
DRM_MEM_SGLISTS );
- return -ENOMEM;
+ return DRM_OS_ERR(ENOMEM);
}
memset( (void *)entry->busaddr, 0, pages * sizeof(*entry->busaddr) );
@@ -123,7 +123,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
DRM(free)( entry,
sizeof(*entry),
DRM_MEM_SGLISTS );
- return -ENOMEM;
+ return DRM_OS_ERR(ENOMEM);
}
/* This also forces the mapping of COW pages, so our page list
@@ -160,7 +160,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
&request,
sizeof(request) ) ) {
DRM(sg_cleanup)( entry );
- return -EFAULT;
+ return DRM_OS_ERR(EFAULT);
}
dev->sg = entry;
@@ -209,7 +209,7 @@ int DRM(sg_alloc)( struct inode *inode, struct file *filp,
failed:
DRM(sg_cleanup)( entry );
- return -ENOMEM;
+ return DRM_OS_ERR(ENOMEM);
}
int DRM(sg_free)( struct inode *inode, struct file *filp,
@@ -223,13 +223,13 @@ int DRM(sg_free)( struct inode *inode, struct file *filp,
if ( copy_from_user( &request,
(drm_scatter_gather_t *)arg,
sizeof(request) ) )
- return -EFAULT;
+ return DRM_OS_ERR(EFAULT);
entry = dev->sg;
dev->sg = NULL;
if ( !entry || entry->handle != request.handle )
- return -EINVAL;
+ return DRM_OS_ERR(EINVAL);
DRM_DEBUG( "sg free virtual = %p\n", entry->virtual );
diff --git a/sys/dev/drm/drm_vm.h b/sys/dev/drm/drm_vm.h
index 1e9a7c5..5fd9a39 100644
--- a/sys/dev/drm/drm_vm.h
+++ b/sys/dev/drm/drm_vm.h
@@ -38,7 +38,7 @@ int DRM(mmap)(dev_t kdev, vm_offset_t offset, int prot)
return EINVAL;
}
- if (!priv->authenticated) DRM_OS_RETURN(EACCES);*/
+ if (!priv->authenticated) return DRM_OS_ERR(EACCES);*/
if (dev->dma
&& offset >= 0
diff --git a/sys/dev/drm/gamma_dma.c b/sys/dev/drm/gamma_dma.c
index df7f13d..b550674 100644
--- a/sys/dev/drm/gamma_dma.c
+++ b/sys/dev/drm/gamma_dma.c
@@ -159,7 +159,7 @@ static int gamma_do_dma(drm_device_t *dev, int locked)
cycles_t dma_start, dma_stop;
#endif
- if (test_and_set_bit(0, &dev->dma_flag)) DRM_OS_RETURN( EBUSY );
+ if (test_and_set_bit(0, &dev->dma_flag)) return DRM_OS_ERR(EBUSY);
#if DRM_DMA_HISTOGRAM
dma_start = get_cycles();
@@ -168,7 +168,7 @@ static int gamma_do_dma(drm_device_t *dev, int locked)
if (!dma->next_buffer) {
DRM_ERROR("No next_buffer\n");
clear_bit(0, &dev->dma_flag);
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
buf = dma->next_buffer;
@@ -182,7 +182,7 @@ static int gamma_do_dma(drm_device_t *dev, int locked)
gamma_clear_next_buffer(dev);
gamma_free_buffer(dev, buf);
clear_bit(0, &dev->dma_flag);
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if (!length) {
@@ -195,7 +195,7 @@ static int gamma_do_dma(drm_device_t *dev, int locked)
if (!gamma_dma_is_ready(dev)) {
clear_bit(0, &dev->dma_flag);
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
if (buf->while_locked) {
@@ -208,7 +208,7 @@ static int gamma_do_dma(drm_device_t *dev, int locked)
if (!locked && !gamma_lock_take(&dev->lock.hw_lock->lock,
DRM_KERNEL_CONTEXT)) {
clear_bit(0, &dev->dma_flag);
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
}
@@ -221,7 +221,7 @@ static int gamma_do_dma(drm_device_t *dev, int locked)
DRM(clear_next_buffer)(dev);
DRM(free_buffer)(dev, buf);
}
- retcode = EBUSY;
+ retcode = DRM_OS_ERR(EBUSY);
goto cleanup;
/* POST: we will wait for the context
@@ -261,7 +261,7 @@ cleanup:
atomic_inc(&dev->histo.dma[gamma_histogram_slot(dma_stop - dma_start)]);
#endif
- DRM_OS_RETURN( retcode );
+ return retcode;
}
static void gamma_dma_timer_bh(unsigned long dev)
@@ -291,7 +291,7 @@ int gamma_dma_schedule(drm_device_t *dev, int locked)
if (test_and_set_bit(0, &dev->interrupt_flag)) {
/* Not reentrant */
atomic_inc(&dev->counts[10]); /* _DRM_STAT_MISSED */
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
missed = atomic_read(&dev->counts[10]);
@@ -302,7 +302,7 @@ int gamma_dma_schedule(drm_device_t *dev, int locked)
again:
if (dev->context_flag) {
clear_bit(0, &dev->interrupt_flag);
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
if (dma->next_buffer) {
/* Unsent buffer that was previously
@@ -373,7 +373,7 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d)
while (test_and_set_bit(0, &dev->interrupt_flag)) {
#ifdef __linux__
schedule();
- if (signal_pending(current)) return -EINTR;
+ if (signal_pending(current)) return DRM_OS_ERR(EINTR);
#endif /* __linux__ */
#ifdef __FreeBSD__
retcode = tsleep(&never, PZERO|PCATCH, "gamp1", 1);
@@ -388,7 +388,7 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d)
schedule();
if (signal_pending(current)) {
clear_bit(0, &dev->interrupt_flag);
- return -EINTR;
+ return DRM_OS_ERR(EINTR);
}
#endif /* __linux__ */
#ifdef __FreeBSD__
@@ -411,13 +411,13 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d)
if (buf->pid != DRM_OS_CURRENTPID) {
DRM_ERROR("Process %d using buffer owned by %d\n",
DRM_OS_CURRENTPID, buf->pid);
- retcode = EINVAL;
+ retcode = DRM_OS_ERR(EINVAL);
goto cleanup;
}
if (buf->list != DRM_LIST_NONE) {
DRM_ERROR("Process %d using %d's buffer on list %d\n",
DRM_OS_CURRENTPID, buf->pid, buf->list);
- retcode = EINVAL;
+ retcode = DRM_OS_ERR(EINVAL);
goto cleanup;
}
/* This isn't a race condition on
@@ -438,14 +438,14 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d)
DRM_ERROR("Sending pending buffer:"
" buffer %d, offset %d\n",
d->send_indices[i], i);
- retcode = EINVAL;
+ retcode = DRM_OS_ERR(EINVAL);
goto cleanup;
}
if (buf->waiting) {
DRM_ERROR("Sending waiting buffer:"
" buffer %d, offset %d\n",
d->send_indices[i], i);
- retcode = EINVAL;
+ retcode = DRM_OS_ERR(EINVAL);
goto cleanup;
}
buf->pending = 1;
@@ -470,7 +470,7 @@ static int gamma_dma_priority(drm_device_t *dev, drm_dma_t *d)
current->state = TASK_RUNNING;
remove_wait_queue(&dev->context_wait, &entry);
if (signal_pending(current)) {
- retcode = EINTR;
+ retcode = DRM_OS_ERR(EINTR);
goto cleanup;
}
#endif /* __linux__ */
@@ -515,7 +515,7 @@ cleanup:
}
}
clear_bit(0, &dev->interrupt_flag);
- DRM_OS_RETURN( retcode );
+ return retcode;
}
static int gamma_dma_send_buffers(drm_device_t *dev, drm_dma_t *d)
@@ -559,7 +559,7 @@ static int gamma_dma_send_buffers(drm_device_t *dev, drm_dma_t *d)
break; /* finished */
schedule();
if (signal_pending(current)) {
- retcode = EINTR; /* Can't restart */
+ retcode = DRM_OS_ERR(EINTR); /* Can't restart */
break;
}
}
@@ -602,7 +602,7 @@ static int gamma_dma_send_buffers(drm_device_t *dev, drm_dma_t *d)
DRM_OS_CURRENTPID);
}
}
- DRM_OS_RETURN( retcode );
+ return retcode;
}
int gamma_dma( DRM_OS_IOCTL )
@@ -617,13 +617,13 @@ int gamma_dma( DRM_OS_IOCTL )
if (d.send_count < 0 || d.send_count > dma->buf_count) {
DRM_ERROR("Process %d trying to send %d buffers (of %d max)\n",
DRM_OS_CURRENTPID, d.send_count, dma->buf_count);
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
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_OS_CURRENTPID, d.request_count, dma->buf_count);
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if (d.send_count) {
diff --git a/sys/dev/drm/gamma_drv.h b/sys/dev/drm/gamma_drv.h
index 5ee3e37..f6a8978 100644
--- a/sys/dev/drm/gamma_drv.h
+++ b/sys/dev/drm/gamma_drv.h
@@ -48,7 +48,7 @@ do { \
dev->lock.pid != DRM_OS_CURRENTPID ) { \
DRM_ERROR( "%s called without lock held\n", \
__FUNCTION__ ); \
- DRM_OS_RETURN( EINVAL ); \
+ return DRM_OS_ERR(EINVAL); \
} \
} while (0)
diff --git a/sys/dev/drm/mga_dma.c b/sys/dev/drm/mga_dma.c
index 8c5d233..7dab88c 100644
--- a/sys/dev/drm/mga_dma.c
+++ b/sys/dev/drm/mga_dma.c
@@ -72,7 +72,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
- DRM_OS_RETURN(EBUSY);
+ return DRM_OS_ERR(EBUSY);
}
int mga_do_dma_idle( drm_mga_private_t *dev_priv )
@@ -90,7 +90,7 @@ int mga_do_dma_idle( drm_mga_private_t *dev_priv )
#if MGA_DMA_DEBUG
DRM_ERROR( "failed! status=0x%08x\n", status );
#endif
- DRM_OS_RETURN(EBUSY);
+ return DRM_OS_ERR(EBUSY);
}
int mga_do_dma_reset( drm_mga_private_t *dev_priv )
@@ -309,7 +309,7 @@ static int mga_freelist_init( drm_device_t *dev, drm_mga_private_t *dev_priv )
dev_priv->head = DRM(alloc)( sizeof(drm_mga_freelist_t),
DRM_MEM_DRIVER );
if ( dev_priv->head == NULL )
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
memset( dev_priv->head, 0, sizeof(drm_mga_freelist_t) );
SET_AGE( &dev_priv->head->age, MGA_BUFFER_USED, 0 );
@@ -321,7 +321,7 @@ static int mga_freelist_init( drm_device_t *dev, drm_mga_private_t *dev_priv )
entry = DRM(alloc)( sizeof(drm_mga_freelist_t),
DRM_MEM_DRIVER );
if ( entry == NULL )
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
memset( entry, 0, sizeof(drm_mga_freelist_t) );
@@ -465,7 +465,7 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
dev_priv = DRM(alloc)( sizeof(drm_mga_private_t), DRM_MEM_DRIVER );
if ( !dev_priv )
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
memset( dev_priv, 0, sizeof(drm_mga_private_t) );
@@ -522,7 +522,7 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
/* Assign dev_private so we can do cleanup. */
dev->dev_private = (void *)dev_priv;
mga_do_cleanup_dma( dev );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
@@ -532,7 +532,7 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
/* Assign dev_private so we can do cleanup. */
dev->dev_private = (void *)dev_priv;
mga_do_cleanup_dma( dev );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset );
if(!dev_priv->mmio) {
@@ -540,7 +540,7 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
/* Assign dev_private so we can do cleanup. */
dev->dev_private = (void *)dev_priv;
mga_do_cleanup_dma( dev );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->status, init->status_offset );
if(!dev_priv->status) {
@@ -548,7 +548,7 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
/* Assign dev_private so we can do cleanup. */
dev->dev_private = (void *)dev_priv;
mga_do_cleanup_dma( dev );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->warp, init->warp_offset );
if(!dev_priv->warp) {
@@ -556,7 +556,7 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
/* Assign dev_private so we can do cleanup. */
dev->dev_private = (void *)dev_priv;
mga_do_cleanup_dma( dev );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->primary, init->primary_offset );
if(!dev_priv->primary) {
@@ -564,7 +564,7 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
/* Assign dev_private so we can do cleanup. */
dev->dev_private = (void *)dev_priv;
mga_do_cleanup_dma( dev );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset );
if(!dev_priv->buffers) {
@@ -572,7 +572,7 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
/* Assign dev_private so we can do cleanup. */
dev->dev_private = (void *)dev_priv;
mga_do_cleanup_dma( dev );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
dev_priv->sarea_priv =
@@ -590,25 +590,25 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
/* Assign dev_private so we can do cleanup. */
dev->dev_private = (void *)dev_priv;
mga_do_cleanup_dma( dev );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
ret = mga_warp_install_microcode( dev_priv );
- if ( ret < 0 ) {
+ if ( ret ) {
DRM_ERROR( "failed to install WARP ucode!\n" );
/* Assign dev_private so we can do cleanup. */
dev->dev_private = (void *)dev_priv;
mga_do_cleanup_dma( dev );
- DRM_OS_RETURN(ret);
+ return DRM_OS_ERR(ret);
}
ret = mga_warp_init( dev_priv );
- if ( ret < 0 ) {
+ if ( ret ) {
DRM_ERROR( "failed to init WARP engine!\n" );
/* Assign dev_private so we can do cleanup. */
dev->dev_private = (void *)dev_priv;
mga_do_cleanup_dma( dev );
- DRM_OS_RETURN(ret);
+ return DRM_OS_ERR(ret);
}
dev_priv->prim.status = (u32 *)dev_priv->status->handle;
@@ -656,7 +656,7 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init )
/* Assign dev_private so we can do cleanup. */
dev->dev_private = (void *)dev_priv;
mga_do_cleanup_dma( dev );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
/* Make dev_private visable to others. */
@@ -701,7 +701,7 @@ int mga_dma_init( DRM_OS_IOCTL )
return mga_do_cleanup_dma( dev );
}
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
@@ -734,12 +734,7 @@ int mga_dma_flush( DRM_OS_IOCTL )
if ( lock.flags & _DRM_LOCK_QUIESCENT ) {
#if MGA_DMA_DEBUG
int ret = mga_do_wait_for_idle( dev_priv );
-#ifdef __linux__
- if ( ret < 0 )
-#endif /* __linux__ */
-#ifdef __FreeBSD__
if ( ret )
-#endif /* __FreeBSD__ */
DRM_INFO( __FUNCTION__": -EBUSY\n" );
return ret;
#else
@@ -774,16 +769,16 @@ static int mga_dma_get_buffers( drm_device_t *dev, drm_dma_t *d )
for ( i = d->granted_count ; i < d->request_count ; i++ ) {
buf = mga_freelist_get( dev );
if ( !buf )
- DRM_OS_RETURN( EAGAIN );
+ return DRM_OS_ERR(EAGAIN);
buf->pid = current->pid;
if ( DRM_OS_COPYTOUSR( &d->request_indices[i],
&buf->idx, sizeof(buf->idx) ) )
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
if ( DRM_OS_COPYTOUSR( &d->request_sizes[i],
&buf->total, sizeof(buf->total) ) )
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
d->granted_count++;
}
@@ -810,7 +805,7 @@ int mga_dma_buffers( DRM_OS_IOCTL )
if ( d.send_count != 0 ) {
DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n",
DRM_OS_CURRENTPID, d.send_count );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
/* We'll send you buffers.
@@ -818,7 +813,7 @@ int mga_dma_buffers( DRM_OS_IOCTL )
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_OS_CURRENTPID, d.request_count, dma->buf_count );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
WRAP_TEST_WITH_RETURN( dev_priv );
@@ -829,16 +824,16 @@ int mga_dma_buffers( DRM_OS_IOCTL )
for ( i = d.granted_count ; i < d.request_count ; i++ ) {
buf = mga_freelist_get( dev );
if ( !buf )
- DRM_OS_RETURN( EAGAIN );
+ return DRM_OS_ERR(EAGAIN);
buf->pid = DRM_OS_CURRENTPID;
if ( DRM_OS_COPYTOUSR( &d.request_indices[i],
&buf->idx, sizeof(buf->idx) ) )
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
if ( DRM_OS_COPYTOUSR( &d.request_sizes[i],
&buf->total, sizeof(buf->total) ) )
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
d.granted_count++;
}
diff --git a/sys/dev/drm/mga_drv.h b/sys/dev/drm/mga_drv.h
index 002b3c7..9483068 100644
--- a/sys/dev/drm/mga_drv.h
+++ b/sys/dev/drm/mga_drv.h
@@ -198,7 +198,7 @@ do { \
dev->lock.pid != DRM_OS_CURRENTPID ) { \
DRM_ERROR( "%s called without lock held\n", \
__FUNCTION__ ); \
- DRM_OS_RETURN( EINVAL ); \
+ return DRM_OS_ERR(EINVAL); \
} \
} while (0)
@@ -211,7 +211,7 @@ do { \
dev_priv->prim.high_mark ) { \
if ( MGA_DMA_DEBUG ) \
DRM_INFO( __FUNCTION__": wrap...\n" ); \
- DRM_OS_RETURN( EBUSY); \
+ return DRM_OS_ERR(EBUSY); \
} \
} \
} while (0)
@@ -222,7 +222,7 @@ do { \
if ( mga_do_wait_for_idle( dev_priv ) ) { \
if ( MGA_DMA_DEBUG ) \
DRM_INFO( __FUNCTION__": wrap...\n" ); \
- DRM_OS_RETURN( EBUSY); \
+ return DRM_OS_ERR(EBUSY); \
} \
mga_do_dma_wrap_end( dev_priv ); \
} \
diff --git a/sys/dev/drm/mga_state.c b/sys/dev/drm/mga_state.c
index 8628b0d..8f468a0 100644
--- a/sys/dev/drm/mga_state.c
+++ b/sys/dev/drm/mga_state.c
@@ -414,7 +414,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;
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
return 0;
@@ -434,7 +434,7 @@ static int mga_verify_tex( drm_mga_private_t *dev_priv, int unit )
DRM_ERROR( "*** bad TEXORG: 0x%x, unit %d\n",
tex->texorg, unit );
tex->texorg = 0;
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
return 0;
@@ -476,13 +476,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 );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( length & MGA_ILOAD_MASK ) {
DRM_ERROR( "*** bad iload length: 0x%x\n",
length & MGA_ILOAD_MASK );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
return 0;
@@ -495,7 +495,7 @@ static int mga_verify_blit( drm_mga_private_t *dev_priv,
(dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) ) {
DRM_ERROR( "*** bad blit: src=0x%x dst=0x%x\n",
srcorg, dstorg );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
return 0;
}
@@ -935,7 +935,7 @@ int mga_dma_vertex( DRM_OS_IOCTL )
DRM_OS_KRNFROMUSR( vertex, (drm_mga_vertex_t *) data, sizeof(vertex) );
- if(vertex.idx < 0 || vertex.idx > dma->buf_count) DRM_OS_RETURN( EINVAL );
+ if(vertex.idx < 0 || vertex.idx > dma->buf_count) return DRM_OS_ERR(EINVAL);
buf = dma->buflist[vertex.idx];
buf_priv = buf->dev_private;
@@ -949,7 +949,7 @@ int mga_dma_vertex( DRM_OS_IOCTL )
buf_priv->dispatched = 0;
mga_freelist_put( dev, buf );
}
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
WRAP_TEST_WITH_RETURN( dev_priv );
@@ -972,7 +972,7 @@ int mga_dma_indices( DRM_OS_IOCTL )
DRM_OS_KRNFROMUSR( indices, (drm_mga_indices_t *) data, sizeof(indices) );
- if(indices.idx < 0 || indices.idx > dma->buf_count) DRM_OS_RETURN( EINVAL );
+ if(indices.idx < 0 || indices.idx > dma->buf_count) return DRM_OS_ERR(EINVAL);
buf = dma->buflist[indices.idx];
buf_priv = buf->dev_private;
@@ -986,7 +986,7 @@ int mga_dma_indices( DRM_OS_IOCTL )
buf_priv->dispatched = 0;
mga_freelist_put( dev, buf );
}
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
WRAP_TEST_WITH_RETURN( dev_priv );
@@ -1014,17 +1014,17 @@ int mga_dma_iload( DRM_OS_IOCTL )
if ( mga_do_wait_for_idle( dev_priv ) ) {
if ( MGA_DMA_DEBUG )
DRM_INFO( __FUNCTION__": -EBUSY\n" );
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
#endif
- if(iload.idx < 0 || iload.idx > dma->buf_count) DRM_OS_RETURN( EINVAL );
+ if(iload.idx < 0 || iload.idx > dma->buf_count) return DRM_OS_ERR(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 );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
WRAP_TEST_WITH_RETURN( dev_priv );
@@ -1054,7 +1054,7 @@ int mga_dma_blit( DRM_OS_IOCTL )
sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS;
if ( mga_verify_blit( dev_priv, blit.srcorg, blit.dstorg ) )
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
WRAP_TEST_WITH_RETURN( dev_priv );
diff --git a/sys/dev/drm/mga_warp.c b/sys/dev/drm/mga_warp.c
index d2b8f20..a9830b4 100644
--- a/sys/dev/drm/mga_warp.c
+++ b/sys/dev/drm/mga_warp.c
@@ -107,7 +107,7 @@ static int mga_warp_install_g400_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 );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
memset( dev_priv->warp_pipe_phys, 0,
@@ -144,7 +144,7 @@ static int mga_warp_install_g200_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 );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
memset( dev_priv->warp_pipe_phys, 0,
@@ -170,7 +170,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:
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
}
@@ -195,7 +195,7 @@ int mga_warp_init( drm_mga_private_t *dev_priv )
MGA_WRITE( MGA_WVRTXSZ, 7 );
break;
default:
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
MGA_WRITE( MGA_WMISC, (MGA_WUCODECACHE_ENABLE |
@@ -205,7 +205,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 );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
return 0;
diff --git a/sys/dev/drm/r128_cce.c b/sys/dev/drm/r128_cce.c
index c6b5728..aba0294 100644
--- a/sys/dev/drm/r128_cce.c
+++ b/sys/dev/drm/r128_cce.c
@@ -139,7 +139,7 @@ static int r128_do_pixcache_flush( drm_r128_private_t *dev_priv )
#if R128_FIFO_DEBUG
DRM_ERROR( "%s failed!\n", __FUNCTION__ );
#endif
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
static int r128_do_wait_for_fifo( drm_r128_private_t *dev_priv, int entries )
@@ -155,7 +155,7 @@ static int r128_do_wait_for_fifo( drm_r128_private_t *dev_priv, int entries )
#if R128_FIFO_DEBUG
DRM_ERROR( "%s failed!\n", __FUNCTION__ );
#endif
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
int r128_do_wait_for_idle( drm_r128_private_t *dev_priv )
@@ -181,7 +181,7 @@ int r128_do_wait_for_idle( drm_r128_private_t *dev_priv )
#if R128_FIFO_DEBUG
DRM_ERROR( "%s failed!\n", __FUNCTION__ );
#endif
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
@@ -242,7 +242,7 @@ int r128_do_cce_idle( drm_r128_private_t *dev_priv )
DRM_ERROR( "failed!\n" );
r128_status( dev_priv );
#endif
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
/* Start the Concurrent Command Engine.
@@ -400,7 +400,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
dev_priv = DRM(alloc)( sizeof(drm_r128_private_t), DRM_MEM_DRIVER );
if ( dev_priv == NULL )
- DRM_OS_RETURN( ENOMEM );
+ return DRM_OS_ERR(ENOMEM);
memset( dev_priv, 0, sizeof(drm_r128_private_t) );
@@ -410,7 +410,7 @@ static int r128_do_init_cce( drm_device_t *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 );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
dev_priv->usec_timeout = init->usec_timeout;
@@ -419,7 +419,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
DRM_DEBUG( "TIMEOUT problem!\n" );
dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce( dev );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
dev_priv->cce_mode = init->cce_mode;
@@ -439,7 +439,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
DRM_DEBUG( "Bad cce_mode!\n" );
dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce( dev );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
switch ( init->cce_mode ) {
@@ -527,7 +527,7 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
DRM_ERROR("could not find sarea!\n");
dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce( dev );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->fb, init->fb_offset );
@@ -535,35 +535,35 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init )
DRM_ERROR("could not find framebuffer!\n");
dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce( dev );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset );
if(!dev_priv->mmio) {
DRM_ERROR("could not find mmio region!\n");
dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce( dev );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->cce_ring, 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 );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->ring_rptr, 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 );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset );
if(!dev_priv->buffers) {
DRM_ERROR("could not find dma buffer region!\n");
dev->dev_private = (void *)dev_priv;
r128_do_cleanup_cce( dev );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
if ( !dev_priv->is_pci ) {
@@ -573,7 +573,7 @@ static int r128_do_init_cce( drm_device_t *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 );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
}
@@ -591,7 +591,7 @@ static int r128_do_init_cce( drm_device_t *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 );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
} else {
dev_priv->cce_ring->handle =
@@ -636,7 +636,7 @@ static int r128_do_init_cce( drm_device_t *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 );
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
R128_WRITE( R128_PCI_GART_PAGE, dev_priv->bus_pci_gart );
}
@@ -696,7 +696,7 @@ int r128_cce_init( DRM_OS_IOCTL )
return r128_do_cleanup_cce( dev );
}
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
int r128_cce_start( DRM_OS_IOCTL )
@@ -776,7 +776,7 @@ int r128_cce_reset( DRM_OS_IOCTL )
if ( !dev_priv ) {
DRM_DEBUG( "%s called before init done\n", __FUNCTION__ );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
r128_do_cce_reset( dev_priv );
@@ -865,7 +865,7 @@ int r128_fullscreen( DRM_OS_IOCTL )
return r128_do_cleanup_pageflip( dev );
}
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
@@ -888,7 +888,7 @@ static int r128_freelist_init( drm_device_t *dev )
dev_priv->head = DRM(alloc)( sizeof(drm_r128_freelist_t),
DRM_MEM_DRIVER );
if ( dev_priv->head == NULL )
- DRM_OS_RETURN( ENOMEM );
+ return DRM_OS_ERR(ENOMEM);
memset( dev_priv->head, 0, sizeof(drm_r128_freelist_t) );
dev_priv->head->age = R128_BUFFER_USED;
@@ -899,7 +899,7 @@ static int r128_freelist_init( drm_device_t *dev )
entry = DRM(alloc)( sizeof(drm_r128_freelist_t),
DRM_MEM_DRIVER );
- if ( !entry ) DRM_OS_RETURN( ENOMEM );
+ if ( !entry ) return DRM_OS_ERR(ENOMEM);
entry->age = R128_BUFFER_FREE;
entry->buf = buf;
@@ -992,7 +992,7 @@ int r128_wait_ring( drm_r128_private_t *dev_priv, int n )
/* FIXME: This is being ignored... */
DRM_ERROR( "failed!\n" );
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
static int r128_cce_get_buffers( drm_device_t *dev, drm_dma_t *d)
@@ -1002,16 +1002,16 @@ static int r128_cce_get_buffers( drm_device_t *dev, drm_dma_t *d)
for ( i = d->granted_count ; i < d->request_count ; i++ ) {
buf = r128_freelist_get( dev );
- if ( !buf ) DRM_OS_RETURN( EAGAIN );
+ if ( !buf ) return DRM_OS_ERR(EAGAIN);
buf->pid = DRM_OS_CURRENTPID;
if ( DRM_OS_COPYTOUSR( &d->request_indices[i], &buf->idx,
sizeof(buf->idx) ) )
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
if ( DRM_OS_COPYTOUSR( &d->request_sizes[i], &buf->total,
sizeof(buf->total) ) )
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
d->granted_count++;
}
return 0;
@@ -1033,7 +1033,7 @@ int r128_cce_buffers( DRM_OS_IOCTL )
if ( d.send_count != 0 ) {
DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n",
DRM_OS_CURRENTPID, d.send_count );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
/* We'll send you buffers.
@@ -1041,7 +1041,7 @@ int r128_cce_buffers( DRM_OS_IOCTL )
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_OS_CURRENTPID, d.request_count, dma->buf_count );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
d.granted_count = 0;
diff --git a/sys/dev/drm/r128_drv.h b/sys/dev/drm/r128_drv.h
index 7aacd48..16fd323 100644
--- a/sys/dev/drm/r128_drv.h
+++ b/sys/dev/drm/r128_drv.h
@@ -451,7 +451,7 @@ do { \
dev->lock.pid != DRM_OS_CURRENTPID ) { \
DRM_ERROR( "%s called without lock held\n", \
__FUNCTION__ ); \
- DRM_OS_RETURN( EINVAL ); \
+ return DRM_OS_ERR(EINVAL); \
} \
} while (0)
@@ -466,7 +466,7 @@ do { \
DRM_OS_DELAY( 1 ); \
} \
DRM_ERROR( "ring space check failed!\n" ); \
- DRM_OS_RETURN( EBUSY ); \
+ return DRM_OS_ERR(EBUSY); \
} \
__ring_space_done: \
} while (0)
diff --git a/sys/dev/drm/r128_state.c b/sys/dev/drm/r128_state.c
index d76f272..762bb3a 100644
--- a/sys/dev/drm/r128_state.c
+++ b/sys/dev/drm/r128_state.c
@@ -817,7 +817,7 @@ static int r128_cce_dispatch_blit( drm_device_t *dev,
break;
default:
DRM_ERROR( "invalid blit format %d\n", blit->format );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
/* Flush the pixel cache, and mark the contents as Read Invalid.
@@ -840,11 +840,11 @@ static int r128_cce_dispatch_blit( drm_device_t *dev,
if ( buf->pid != pid ) {
DRM_ERROR( "process %d using buffer owned by %d\n",
pid, buf->pid );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( buf->pending ) {
DRM_ERROR( "sending pending buffer %d\n", blit->idx );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
buf_priv->discard = 1;
@@ -910,32 +910,32 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev,
count = depth->n;
if ( DRM_OS_COPYFROMUSR( &x, depth->x, sizeof(x) ) ) {
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
if ( DRM_OS_COPYFROMUSR( &y, depth->y, sizeof(y) ) ) {
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
buffer = DRM_OS_MALLOC( depth->n * sizeof(u32) );
if ( buffer == NULL )
- DRM_OS_RETURN( ENOMEM );
+ return DRM_OS_ERR(ENOMEM);
if ( DRM_OS_COPYFROMUSR( buffer, depth->buffer,
depth->n * sizeof(u32) ) ) {
DRM_OS_FREE( buffer );
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
if ( depth->mask ) {
mask = DRM_OS_MALLOC( depth->n * sizeof(u8) );
if ( mask == NULL ) {
DRM_OS_FREE( buffer );
- DRM_OS_RETURN( ENOMEM );
+ return DRM_OS_ERR(ENOMEM);
}
if ( DRM_OS_COPYFROMUSR( mask, depth->mask,
depth->n * sizeof(u8) ) ) {
DRM_OS_FREE( buffer );
DRM_OS_FREE( mask );
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
for ( i = 0 ; i < count ; i++, x++ ) {
@@ -1005,36 +1005,36 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev,
x = DRM_OS_MALLOC( count * sizeof(*x) );
if ( x == NULL ) {
- DRM_OS_RETURN( ENOMEM );
+ return DRM_OS_ERR(ENOMEM);
}
y = DRM_OS_MALLOC( count * sizeof(*y) );
if ( y == NULL ) {
DRM_OS_FREE( x );
- DRM_OS_RETURN( ENOMEM );
+ return DRM_OS_ERR(ENOMEM);
}
if ( DRM_OS_COPYFROMUSR( x, depth->x, count * sizeof(int) ) ) {
DRM_OS_FREE( x );
DRM_OS_FREE( y );
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
if ( DRM_OS_COPYFROMUSR( y, depth->y, count * sizeof(int) ) ) {
DRM_OS_FREE( x );
DRM_OS_FREE( y );
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
buffer = DRM_OS_MALLOC( depth->n * sizeof(u32) );
if ( buffer == NULL ) {
DRM_OS_FREE( x );
DRM_OS_FREE( y );
- DRM_OS_RETURN( ENOMEM );
+ return DRM_OS_ERR(ENOMEM);
}
if ( DRM_OS_COPYFROMUSR( buffer, depth->buffer,
depth->n * sizeof(u32) ) ) {
DRM_OS_FREE( x );
DRM_OS_FREE( y );
DRM_OS_FREE( buffer );
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
if ( depth->mask ) {
@@ -1043,7 +1043,7 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev,
DRM_OS_FREE( x );
DRM_OS_FREE( y );
DRM_OS_FREE( buffer );
- DRM_OS_RETURN( ENOMEM );
+ return DRM_OS_ERR(ENOMEM);
}
if ( DRM_OS_COPYFROMUSR( mask, depth->mask,
depth->n * sizeof(u8) ) ) {
@@ -1051,7 +1051,7 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev,
DRM_OS_FREE( y );
DRM_OS_FREE( buffer );
DRM_OS_FREE( mask );
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
for ( i = 0 ; i < count ; i++ ) {
@@ -1118,10 +1118,10 @@ static int r128_cce_dispatch_read_span( drm_device_t *dev,
count = depth->n;
if ( DRM_OS_COPYFROMUSR( &x, depth->x, sizeof(x) ) ) {
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
if ( DRM_OS_COPYFROMUSR( &y, depth->y, sizeof(y) ) ) {
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
BEGIN_RING( 7 );
@@ -1165,22 +1165,22 @@ static int r128_cce_dispatch_read_pixels( drm_device_t *dev,
x = DRM_OS_MALLOC( count * sizeof(*x) );
if ( x == NULL ) {
- DRM_OS_RETURN( ENOMEM );
+ return DRM_OS_ERR(ENOMEM);
}
y = DRM_OS_MALLOC( count * sizeof(*y) );
if ( y == NULL ) {
DRM_OS_FREE( x );
- DRM_OS_RETURN( ENOMEM );
+ return DRM_OS_ERR(ENOMEM);
}
if ( DRM_OS_COPYFROMUSR( x, depth->x, count * sizeof(int) ) ) {
DRM_OS_FREE( x );
DRM_OS_FREE( y );
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
if ( DRM_OS_COPYFROMUSR( y, depth->y, count * sizeof(int) ) ) {
DRM_OS_FREE( x );
DRM_OS_FREE( y );
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
for ( i = 0 ; i < count ; i++ ) {
@@ -1305,7 +1305,7 @@ int r128_cce_vertex( DRM_OS_IOCTL )
if ( !dev_priv ) {
DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
DRM_OS_KRNFROMUSR( vertex, (drm_r128_vertex_t *) data,
@@ -1318,12 +1318,12 @@ int r128_cce_vertex( DRM_OS_IOCTL )
if ( vertex.idx < 0 || vertex.idx >= dma->buf_count ) {
DRM_ERROR( "buffer index %d (of %d max)\n",
vertex.idx, dma->buf_count - 1 );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( vertex.prim < 0 ||
vertex.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 ) {
DRM_ERROR( "buffer prim %d\n", vertex.prim );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
RING_SPACE_TEST_WITH_RETURN( dev_priv );
@@ -1335,11 +1335,11 @@ int r128_cce_vertex( DRM_OS_IOCTL )
if ( buf->pid != DRM_OS_CURRENTPID ) {
DRM_ERROR( "process %d using buffer owned by %d\n",
DRM_OS_CURRENTPID, buf->pid );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( buf->pending ) {
DRM_ERROR( "sending pending buffer %d\n", vertex.idx );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
buf->used = vertex.count;
@@ -1365,7 +1365,7 @@ int r128_cce_indices( DRM_OS_IOCTL )
if ( !dev_priv ) {
DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
DRM_OS_KRNFROMUSR( elts, (drm_r128_indices_t *) data,
@@ -1378,12 +1378,12 @@ int r128_cce_indices( DRM_OS_IOCTL )
if ( elts.idx < 0 || elts.idx >= dma->buf_count ) {
DRM_ERROR( "buffer index %d (of %d max)\n",
elts.idx, dma->buf_count - 1 );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( elts.prim < 0 ||
elts.prim > R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 ) {
DRM_ERROR( "buffer prim %d\n", elts.prim );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
RING_SPACE_TEST_WITH_RETURN( dev_priv );
@@ -1395,11 +1395,11 @@ int r128_cce_indices( DRM_OS_IOCTL )
if ( buf->pid != DRM_OS_CURRENTPID ) {
DRM_ERROR( "process %d using buffer owned by %d\n",
DRM_OS_CURRENTPID, buf->pid );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( buf->pending ) {
DRM_ERROR( "sending pending buffer %d\n", elts.idx );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
count = (elts.end - elts.start) / sizeof(u16);
@@ -1407,11 +1407,11 @@ int r128_cce_indices( DRM_OS_IOCTL )
if ( elts.start & 0x7 ) {
DRM_ERROR( "misaligned buffer 0x%x\n", elts.start );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( elts.start < buf->used ) {
DRM_ERROR( "no header 0x%x - 0x%x\n", elts.start, buf->used );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
buf->used = elts.end;
@@ -1441,7 +1441,7 @@ int r128_cce_blit( DRM_OS_IOCTL )
if ( blit.idx < 0 || blit.idx >= dma->buf_count ) {
DRM_ERROR( "buffer index %d (of %d max)\n",
blit.idx, dma->buf_count - 1 );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
RING_SPACE_TEST_WITH_RETURN( dev_priv );
@@ -1474,7 +1474,7 @@ int r128_cce_depth( DRM_OS_IOCTL )
return r128_cce_dispatch_read_pixels( dev, &depth );
}
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
int r128_cce_stipple( DRM_OS_IOCTL )
@@ -1491,7 +1491,7 @@ int r128_cce_stipple( DRM_OS_IOCTL )
if ( DRM_OS_COPYFROMUSR( &mask, stipple.mask,
32 * sizeof(u32) ) )
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
RING_SPACE_TEST_WITH_RETURN( dev_priv );
@@ -1516,7 +1516,7 @@ int r128_cce_indirect( DRM_OS_IOCTL )
if ( !dev_priv ) {
DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_OS_KRNFROMUSR( indirect, (drm_r128_indirect_t *) data,
@@ -1529,7 +1529,7 @@ int r128_cce_indirect( DRM_OS_IOCTL )
if ( indirect.idx < 0 || indirect.idx >= dma->buf_count ) {
DRM_ERROR( "buffer index %d (of %d max)\n",
indirect.idx, dma->buf_count - 1 );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
buf = dma->buflist[indirect.idx];
@@ -1538,17 +1538,17 @@ int r128_cce_indirect( DRM_OS_IOCTL )
if ( buf->pid != DRM_OS_CURRENTPID ) {
DRM_ERROR( "process %d using buffer owned by %d\n",
DRM_OS_CURRENTPID, buf->pid );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
if ( buf->pending ) {
DRM_ERROR( "sending pending buffer %d\n", indirect.idx );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
if ( indirect.start < buf->used ) {
DRM_ERROR( "reusing indirect: start=0x%x actual=0x%x\n",
indirect.start, buf->used );
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
RING_SPACE_TEST_WITH_RETURN( dev_priv );
diff --git a/sys/dev/drm/radeon_cp.c b/sys/dev/drm/radeon_cp.c
index d69d3cd..821d8e4 100644
--- a/sys/dev/drm/radeon_cp.c
+++ b/sys/dev/drm/radeon_cp.c
@@ -371,7 +371,7 @@ static int radeon_do_pixcache_flush( drm_radeon_private_t *dev_priv )
DRM_ERROR( "failed!\n" );
radeon_status( dev_priv );
#endif
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
static int radeon_do_wait_for_fifo( drm_radeon_private_t *dev_priv,
@@ -390,7 +390,7 @@ static int radeon_do_wait_for_fifo( drm_radeon_private_t *dev_priv,
DRM_ERROR( "failed!\n" );
radeon_status( dev_priv );
#endif
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
static int radeon_do_wait_for_idle( drm_radeon_private_t *dev_priv )
@@ -417,7 +417,7 @@ static int radeon_do_wait_for_idle( drm_radeon_private_t *dev_priv )
DRM_ERROR( "failed!\n" );
radeon_status( dev_priv );
#endif
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
@@ -675,7 +675,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
dev_priv = DRM(alloc)( sizeof(drm_radeon_private_t), DRM_MEM_DRIVER );
if ( dev_priv == NULL )
- DRM_OS_RETURN( ENOMEM );
+ return DRM_OS_ERR(ENOMEM);
memset( dev_priv, 0, sizeof(drm_radeon_private_t) );
@@ -688,7 +688,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
DRM_ERROR( "PCI GART not yet supported for Radeon!\n" );
dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
#endif
@@ -696,7 +696,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
DRM_ERROR( "PCI GART memory not allocated!\n" );
dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
dev_priv->usec_timeout = init->usec_timeout;
@@ -705,7 +705,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
DRM_DEBUG( "TIMEOUT problem!\n" );
dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
dev_priv->cp_mode = init->cp_mode;
@@ -723,7 +723,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
DRM_DEBUG( "BAD cp_mode (%x)!\n", init->cp_mode );
dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
switch ( init->fb_bpp ) {
@@ -815,7 +815,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
DRM_ERROR("could not find sarea!\n");
dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->fb, init->fb_offset );
@@ -823,35 +823,35 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
DRM_ERROR("could not find framebuffer!\n");
dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset );
if(!dev_priv->mmio) {
DRM_ERROR("could not find mmio region!\n");
dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->cp_ring, init->ring_offset );
if(!dev_priv->cp_ring) {
DRM_ERROR("could not find cp ring region!\n");
dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset );
if(!dev_priv->ring_rptr) {
DRM_ERROR("could not find ring read pointer!\n");
dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset );
if(!dev_priv->buffers) {
DRM_ERROR("could not find dma buffer region!\n");
dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
if ( !dev_priv->is_pci ) {
@@ -861,7 +861,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
DRM_ERROR("could not find agp texture region!\n");
dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
}
@@ -879,7 +879,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
DRM_ERROR("could not find ioremap agp regions!\n");
dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
- DRM_OS_RETURN(EINVAL);
+ return DRM_OS_ERR(EINVAL);
}
} else {
dev_priv->cp_ring->handle =
@@ -966,7 +966,7 @@ static int radeon_do_init_cp( drm_device_t *dev, drm_radeon_init_t *init )
DRM_ERROR( "failed to init PCI GART!\n" );
dev->dev_private = (void *)dev_priv;
radeon_do_cleanup_cp(dev);
- DRM_OS_RETURN(ENOMEM);
+ return DRM_OS_ERR(ENOMEM);
}
/* Turn on PCI GART
*/
@@ -1057,7 +1057,7 @@ int radeon_cp_init( DRM_OS_IOCTL )
return radeon_do_cleanup_cp( dev );
}
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
int radeon_cp_start( DRM_OS_IOCTL )
@@ -1142,7 +1142,7 @@ int radeon_cp_reset( DRM_OS_IOCTL )
if ( !dev_priv ) {
DRM_DEBUG( "%s called before init done\n", __FUNCTION__ );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
radeon_do_cp_reset( dev_priv );
@@ -1229,7 +1229,7 @@ int radeon_fullscreen( DRM_OS_IOCTL )
return radeon_do_cleanup_pageflip( dev );
}
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
@@ -1252,7 +1252,7 @@ static int radeon_freelist_init( drm_device_t *dev )
dev_priv->head = DRM(alloc)( sizeof(drm_radeon_freelist_t),
DRM_MEM_DRIVER );
if ( dev_priv->head == NULL )
- DRM_OS_RETURN( ENOMEM );
+ return DRM_OS_ERR(ENOMEM);
memset( dev_priv->head, 0, sizeof(drm_radeon_freelist_t) );
dev_priv->head->age = RADEON_BUFFER_USED;
@@ -1263,7 +1263,7 @@ static int radeon_freelist_init( drm_device_t *dev )
entry = DRM(alloc)( sizeof(drm_radeon_freelist_t),
DRM_MEM_DRIVER );
- if ( !entry ) DRM_OS_RETURN( ENOMEM );
+ if ( !entry ) return DRM_OS_ERR(ENOMEM);
entry->age = RADEON_BUFFER_FREE;
entry->buf = buf;
@@ -1393,7 +1393,7 @@ int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n )
radeon_status( dev_priv );
DRM_ERROR( "failed!\n" );
#endif
- DRM_OS_RETURN( EBUSY );
+ return DRM_OS_ERR(EBUSY);
}
static int radeon_cp_get_buffers( drm_device_t *dev, drm_dma_t *d )
@@ -1403,16 +1403,16 @@ static int radeon_cp_get_buffers( drm_device_t *dev, drm_dma_t *d )
for ( i = d->granted_count ; i < d->request_count ; i++ ) {
buf = radeon_freelist_get( dev );
- if ( !buf ) DRM_OS_RETURN( EAGAIN );
+ if ( !buf ) return DRM_OS_ERR(EAGAIN);
buf->pid = DRM_OS_CURRENTPID;
if (DRM_OS_COPYTOUSR( &d->request_indices[i], &buf->idx,
sizeof(buf->idx) ) )
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
if (DRM_OS_COPYTOUSR( &d->request_sizes[i], &buf->total,
sizeof(buf->total) ) )
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
d->granted_count++;
}
@@ -1435,7 +1435,7 @@ int radeon_cp_buffers( DRM_OS_IOCTL )
if ( d.send_count != 0 ) {
DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n",
DRM_OS_CURRENTPID, d.send_count );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
/* We'll send you buffers.
@@ -1443,7 +1443,7 @@ int radeon_cp_buffers( DRM_OS_IOCTL )
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_OS_CURRENTPID, d.request_count, dma->buf_count );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
d.granted_count = 0;
diff --git a/sys/dev/drm/radeon_drv.h b/sys/dev/drm/radeon_drv.h
index 80f7a87..51fa987 100644
--- a/sys/dev/drm/radeon_drv.h
+++ b/sys/dev/drm/radeon_drv.h
@@ -631,7 +631,7 @@ do { \
dev->lock.pid != DRM_OS_CURRENTPID ) { \
DRM_ERROR( "%s called without lock held\n", \
__FUNCTION__ ); \
- DRM_OS_RETURN( EINVAL ); \
+ return DRM_OS_ERR(EINVAL); \
} \
} while (0)
@@ -646,7 +646,7 @@ do { \
DRM_OS_DELAY( 1 ); \
} \
DRM_ERROR( "ring space check failed!\n" ); \
- DRM_OS_RETURN( EBUSY ); \
+ return DRM_OS_ERR(EBUSY); \
} \
__ring_space_done: \
} while (0)
diff --git a/sys/dev/drm/radeon_state.c b/sys/dev/drm/radeon_state.c
index ee3f834..f1ac9ed 100644
--- a/sys/dev/drm/radeon_state.c
+++ b/sys/dev/drm/radeon_state.c
@@ -984,7 +984,7 @@ static int radeon_cp_dispatch_texture( drm_device_t *dev,
/* FIXME: Be smarter about this...
*/
buf = radeon_freelist_get( dev );
- if ( !buf ) DRM_OS_RETURN( EAGAIN );
+ if ( !buf ) return DRM_OS_ERR(EAGAIN);
DRM_DEBUG( "tex: ofs=0x%x p=%d f=%d x=%hd y=%hd w=%hd h=%hd\n",
tex->offset >> 10, tex->pitch, tex->format,
@@ -1019,7 +1019,7 @@ static int radeon_cp_dispatch_texture( drm_device_t *dev,
break;
default:
DRM_ERROR( "invalid texture format %d\n", tex->format );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
DRM_DEBUG( " tex=%dx%d blit=%d\n",
@@ -1060,7 +1060,7 @@ static int radeon_cp_dispatch_texture( drm_device_t *dev,
if ( DRM_OS_COPYTOUSR( tex->image, image, sizeof(*image) ) ) {
DRM_ERROR( "EFAULT on tex->image\n" );
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
} else if ( size < 4 && size > 0 ) {
size = 4;
@@ -1097,7 +1097,7 @@ static int radeon_cp_dispatch_texture( drm_device_t *dev,
*/
if ( DRM_OS_COPYFROMUSR( buffer, data, dwords * sizeof(u32) ) ) {
DRM_ERROR( "EFAULT on data, %d dwords\n", dwords );
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
} else {
/* Texture image width is less than the minimum, so we
@@ -1108,7 +1108,7 @@ static int radeon_cp_dispatch_texture( drm_device_t *dev,
if ( DRM_OS_COPYFROMUSR( buffer, data, tex_width ) ) {
DRM_ERROR( "EFAULT on pad, %d bytes\n",
tex_width );
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
}
buffer += 8;
data += tex_width;
@@ -1132,7 +1132,7 @@ static int radeon_cp_dispatch_texture( drm_device_t *dev,
ADVANCE_RING();
- DRM_OS_RETURN( ret );
+ return ret;
}
static void radeon_cp_dispatch_stipple( drm_device_t *dev, u32 *stipple )
@@ -1181,7 +1181,7 @@ int radeon_cp_clear( DRM_OS_IOCTL )
if ( DRM_OS_COPYFROMUSR( &depth_boxes, clear.depth_boxes,
sarea_priv->nbox * sizeof(depth_boxes[0]) ) )
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
radeon_cp_dispatch_clear( dev, &clear, depth_boxes );
@@ -1226,7 +1226,7 @@ int radeon_cp_vertex( DRM_OS_IOCTL )
if ( !dev_priv ) {
DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
DRM_OS_KRNFROMUSR( vertex, (drm_radeon_vertex_t *) data,
@@ -1239,12 +1239,12 @@ int radeon_cp_vertex( DRM_OS_IOCTL )
if ( vertex.idx < 0 || vertex.idx >= dma->buf_count ) {
DRM_ERROR( "buffer index %d (of %d max)\n",
vertex.idx, dma->buf_count - 1 );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( vertex.prim < 0 ||
vertex.prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST ) {
DRM_ERROR( "buffer prim %d\n", vertex.prim );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
RING_SPACE_TEST_WITH_RETURN( dev_priv );
@@ -1256,11 +1256,11 @@ int radeon_cp_vertex( DRM_OS_IOCTL )
if ( buf->pid != DRM_OS_CURRENTPID ) {
DRM_ERROR( "process %d using buffer owned by %d\n",
DRM_OS_CURRENTPID, buf->pid );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( buf->pending ) {
DRM_ERROR( "sending pending buffer %d\n", vertex.idx );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
buf->used = vertex.count;
@@ -1286,7 +1286,7 @@ int radeon_cp_indices( DRM_OS_IOCTL )
if ( !dev_priv ) {
DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
DRM_OS_KRNFROMUSR( elts, (drm_radeon_indices_t *) data,
@@ -1299,12 +1299,12 @@ int radeon_cp_indices( DRM_OS_IOCTL )
if ( elts.idx < 0 || elts.idx >= dma->buf_count ) {
DRM_ERROR( "buffer index %d (of %d max)\n",
elts.idx, dma->buf_count - 1 );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( elts.prim < 0 ||
elts.prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST ) {
DRM_ERROR( "buffer prim %d\n", elts.prim );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
RING_SPACE_TEST_WITH_RETURN( dev_priv );
@@ -1316,11 +1316,11 @@ int radeon_cp_indices( DRM_OS_IOCTL )
if ( buf->pid != DRM_OS_CURRENTPID ) {
DRM_ERROR( "process %d using buffer owned by %d\n",
DRM_OS_CURRENTPID, buf->pid );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( buf->pending ) {
DRM_ERROR( "sending pending buffer %d\n", elts.idx );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
count = (elts.end - elts.start) / sizeof(u16);
@@ -1328,11 +1328,11 @@ int radeon_cp_indices( DRM_OS_IOCTL )
if ( elts.start & 0x7 ) {
DRM_ERROR( "misaligned buffer 0x%x\n", elts.start );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( elts.start < buf->used ) {
DRM_ERROR( "no header 0x%x - 0x%x\n", elts.start, buf->used );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
buf->used = elts.end;
@@ -1357,13 +1357,13 @@ int radeon_cp_texture( DRM_OS_IOCTL )
if ( tex.image == NULL ) {
DRM_ERROR( "null texture image!\n" );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( DRM_OS_COPYFROMUSR( &image,
(drm_radeon_tex_image_t *)tex.image,
sizeof(image) ) )
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
RING_SPACE_TEST_WITH_RETURN( dev_priv );
VB_AGE_TEST_WITH_RETURN( dev_priv );
@@ -1384,7 +1384,7 @@ int radeon_cp_stipple( DRM_OS_IOCTL )
sizeof(stipple) );
if ( DRM_OS_COPYFROMUSR( &mask, stipple.mask, 32 * sizeof(u32) ) )
- DRM_OS_RETURN( EFAULT );
+ return DRM_OS_ERR(EFAULT);
RING_SPACE_TEST_WITH_RETURN( dev_priv );
@@ -1407,7 +1407,7 @@ int radeon_cp_indirect( DRM_OS_IOCTL )
if ( !dev_priv ) {
DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
DRM_OS_KRNFROMUSR( indirect, (drm_radeon_indirect_t *) data,
@@ -1420,7 +1420,7 @@ int radeon_cp_indirect( DRM_OS_IOCTL )
if ( indirect.idx < 0 || indirect.idx >= dma->buf_count ) {
DRM_ERROR( "buffer index %d (of %d max)\n",
indirect.idx, dma->buf_count - 1 );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
buf = dma->buflist[indirect.idx];
@@ -1429,17 +1429,17 @@ int radeon_cp_indirect( DRM_OS_IOCTL )
if ( buf->pid != DRM_OS_CURRENTPID ) {
DRM_ERROR( "process %d using buffer owned by %d\n",
DRM_OS_CURRENTPID, buf->pid );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( buf->pending ) {
DRM_ERROR( "sending pending buffer %d\n", indirect.idx );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
if ( indirect.start < buf->used ) {
DRM_ERROR( "reusing indirect: start=0x%x actual=0x%x\n",
indirect.start, buf->used );
- DRM_OS_RETURN( EINVAL );
+ return DRM_OS_ERR(EINVAL);
}
RING_SPACE_TEST_WITH_RETURN( dev_priv );
OpenPOWER on IntegriCloud