effects, so make them look like functions (add parenthesis).
drm_magic_entry_t *pt;
int hash = DRM(hash_magic)(magic);
- DRM_LOCK;
+ DRM_LOCK();
for (pt = dev->magiclist[hash].head; pt; pt = pt->next) {
if (pt->magic == magic) {
retval = pt->priv;
break;
}
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
return retval;
}
entry->priv = priv;
entry->next = NULL;
- DRM_LOCK;
+ DRM_LOCK();
if (dev->magiclist[hash].tail) {
dev->magiclist[hash].tail->next = entry;
dev->magiclist[hash].tail = entry;
dev->magiclist[hash].head = entry;
dev->magiclist[hash].tail = entry;
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
return 0;
}
DRM_DEBUG("%d\n", magic);
hash = DRM(hash_magic)(magic);
- DRM_LOCK;
+ DRM_LOCK();
for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) {
if (pt->magic == magic) {
if (dev->magiclist[hash].head == pt) {
if (prev) {
prev->next = pt->next;
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
return 0;
}
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC);
return DRM_ERR(EINVAL);
}
list->map = map;
- DRM_LOCK;
+ DRM_LOCK();
TAILQ_INSERT_TAIL(dev->maplist, list, link);
- DRM_UNLOCK;
+ DRM_UNLOCK();
request.offset = map->offset;
request.size = map->size;
DRM_COPY_FROM_USER_IOCTL( request, (drm_map_t *)data, sizeof(request) );
- DRM_LOCK;
+ DRM_LOCK();
TAILQ_FOREACH(list, dev->maplist, link) {
map = list->map;
if (map->handle == request.handle &&
/* No match found. */
if (list == NULL) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(EINVAL);
}
TAILQ_REMOVE(dev->maplist, list, link);
break;
}
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return 0;
}
if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER )
return DRM_ERR(EINVAL);
- DRM_LOCK;
+ DRM_LOCK();
entry = &dma->bufs[order];
if ( entry->buf_count ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM); /* May only call once for each order */
}
entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist),
DRM_MEM_BUFS );
if ( !entry->buflist ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
memset( entry->buflist, 0, count * sizeof(*entry->buflist) );
/* Set count correctly so we free the proper amount. */
entry->buf_count = count;
DRM(cleanup_buf_error)(dev, entry);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
if (temp_buflist == NULL) {
/* Free the entry because it isn't valid */
DRM(cleanup_buf_error)(dev, entry);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
dma->buflist = temp_buflist;
DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count );
DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count );
- DRM_UNLOCK;
+ DRM_UNLOCK();
request->count = entry->buf_count;
request->size = size;
page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
total = PAGE_SIZE << page_order;
- DRM_LOCK;
+ DRM_LOCK();
entry = &dma->bufs[order];
if ( entry->buf_count ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM); /* May only call once for each order */
}
DRM_MEM_SEGS);
DRM(free)(entry->seglist_bus, count *
sizeof(*entry->seglist_bus), DRM_MEM_SEGS);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
DRM(free)(temp_pagelist, (dma->page_count +
(count << page_order)) * sizeof(*dma->pagelist),
DRM_MEM_PAGES);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
DRM(free)(temp_pagelist, (dma->page_count +
(count << page_order)) *
sizeof(*dma->pagelist), DRM_MEM_PAGES );
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
bzero(buf->dev_private, buf->dev_priv_size);
DRM(free)(temp_pagelist, (dma->page_count +
(count << page_order)) * sizeof(*dma->pagelist),
DRM_MEM_PAGES);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
dma->buflist = temp_buflist;
dma->page_count += entry->seg_count << page_order;
dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order);
- DRM_UNLOCK;
+ DRM_UNLOCK();
request->count = entry->buf_count;
request->size = size;
if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER )
return DRM_ERR(EINVAL);
- DRM_LOCK;
+ DRM_LOCK();
entry = &dma->bufs[order];
if ( entry->buf_count ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM); /* May only call once for each order */
}
entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist),
DRM_MEM_BUFS );
if ( !entry->buflist ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
memset( entry->buflist, 0, count * sizeof(*entry->buflist) );
/* Set count correctly so we free the proper amount. */
entry->buf_count = count;
DRM(cleanup_buf_error)(dev, entry);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
if (temp_buflist == NULL) {
/* Free the entry because it isn't valid */
DRM(cleanup_buf_error)(dev, entry);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
dma->buflist = temp_buflist;
DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count );
DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count );
- DRM_UNLOCK;
+ DRM_UNLOCK();
request->count = entry->buf_count;
request->size = size;
return;
}
- DRM_LOCK;
+ DRM_LOCK();
clear_bit(ctx_handle, dev->ctx_bitmap);
dev->context_sareas[ctx_handle] = NULL;
- DRM_UNLOCK;
+ DRM_UNLOCK();
return;
}
if (dev->ctx_bitmap == NULL)
return -1;
- DRM_LOCK;
+ DRM_LOCK();
bit = find_first_zero_bit( dev->ctx_bitmap, DRM_MAX_CTXBITMAP );
if (bit >= DRM_MAX_CTXBITMAP) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return -1;
}
DRM_MEM_MAPS);
if (ctx_sareas == NULL) {
clear_bit(bit, dev->ctx_bitmap);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return -1;
}
dev->context_sareas = ctx_sareas;
sizeof(*dev->context_sareas), DRM_MEM_MAPS);
if (dev->context_sareas == NULL) {
clear_bit(bit, dev->ctx_bitmap);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return -1;
}
dev->context_sareas[bit] = NULL;
}
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
return bit;
}
int i;
int temp;
- DRM_LOCK;
+ DRM_LOCK();
dev->ctx_bitmap = (atomic_t *)DRM(calloc)(1, PAGE_SIZE,
DRM_MEM_CTXBITMAP);
if ( dev->ctx_bitmap == NULL ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
dev->context_sareas = NULL;
dev->max_context = -1;
- DRM_UNLOCK;
+ DRM_UNLOCK();
for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) {
temp = DRM(ctxbitmap_next)( dev );
void DRM(ctxbitmap_cleanup)( drm_device_t *dev )
{
- DRM_LOCK;
+ DRM_LOCK();
if (dev->context_sareas != NULL)
DRM(free)(dev->context_sareas, sizeof(*dev->context_sareas) *
dev->max_context, DRM_MEM_MAPS);
DRM(free)( (void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP );
- DRM_UNLOCK;
+ DRM_UNLOCK();
}
/* ================================================================
DRM_COPY_FROM_USER_IOCTL( request, (drm_ctx_priv_map_t *)data,
sizeof(request) );
- DRM_LOCK;
+ DRM_LOCK();
if (dev->max_context < 0 || request.ctx_id >= (unsigned) dev->max_context) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(EINVAL);
}
map = dev->context_sareas[request.ctx_id];
- DRM_UNLOCK;
+ DRM_UNLOCK();
request.handle = map->handle;
DRM_COPY_FROM_USER_IOCTL( request, (drm_ctx_priv_map_t *)data,
sizeof(request) );
- DRM_LOCK;
+ DRM_LOCK();
TAILQ_FOREACH(list, dev->maplist, link) {
map=list->map;
if (map->handle == request.handle) {
if (request.ctx_id >= (unsigned) dev->max_context)
goto bad;
dev->context_sareas[request.ctx_id] = map;
- DRM_UNLOCK;
+ DRM_UNLOCK();
return 0;
}
}
bad:
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(EINVAL);
}
if ( irq == 0 || dev->dev_private == NULL)
return DRM_ERR(EINVAL);
- DRM_LOCK;
+ DRM_LOCK();
if ( dev->irq ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(EBUSY);
}
dev->irq = irq;
- DRM_UNLOCK;
+ DRM_UNLOCK();
DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq );
#elif defined(__NetBSD__)
if (pci_intr_map(&dev->pa, &dev->ih) != 0) {
#endif
- DRM_LOCK;
+ DRM_LOCK();
dev->irq = 0;
dev->irqrid = 0;
- DRM_UNLOCK;
+ DRM_UNLOCK();
return ENOENT;
}
(irqreturn_t (*)(DRM_IRQ_ARGS))DRM(dma_service), dev);
if ( !dev->irqh ) {
#endif
- DRM_LOCK;
+ DRM_LOCK();
#ifdef __FreeBSD__
bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr);
#endif
dev->irq = 0;
dev->irqrid = 0;
- DRM_UNLOCK;
+ DRM_UNLOCK();
return retcode;
}
int irq;
int irqrid;
- DRM_LOCK;
+ DRM_LOCK();
irq = dev->irq;
irqrid = dev->irqrid;
dev->irq = 0;
dev->irqrid = 0;
- DRM_UNLOCK;
+ DRM_UNLOCK();
if ( !irq )
return DRM_ERR(EINVAL);
DRM(irq_uninstall)( dev );
#endif
- DRM_LOCK;
+ DRM_LOCK();
callout_stop( &dev->timer );
if ( dev->unique ) {
dev->lock.filp = NULL;
DRM_WAKEUP_INT((void *)&dev->lock.lock_queue);
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
return 0;
}
dev->buf_pgid = 0;
#endif /* __NetBSD__ */
- DRM_LOCK;
+ DRM_LOCK();
priv = DRM(find_file_by_proc)(dev, p);
if (priv) {
priv->refs--;
DRM(free)( priv, sizeof(*priv), DRM_MEM_FILES );
}
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
/* ========================================================
priv->devXX = dev;
priv->ioctl_count = 0;
priv->authenticated = !DRM_SUSER(p);
- DRM_LOCK;
+ DRM_LOCK();
TAILQ_INSERT_TAIL(&dev->files, priv, link);
- DRM_UNLOCK;
+ DRM_UNLOCK();
}
#ifdef __FreeBSD__
kdev->si_drv1 = dev;
idx = map.offset;
- DRM_LOCK;
+ DRM_LOCK();
if (idx < 0) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(EINVAL);
}
i++;
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
if (!list)
return EINVAL;
DRM_COPY_FROM_USER_IOCTL( client, (drm_client_t *)data, sizeof(client) );
idx = client.idx;
- DRM_LOCK;
+ DRM_LOCK();
TAILQ_FOREACH(pt, &dev->files, link) {
if (i==idx)
{
client.uid = pt->uid;
client.magic = pt->magic;
client.iocs = pt->ioctl_count;
- DRM_UNLOCK;
+ DRM_UNLOCK();
*(drm_client_t *)data = client;
return 0;
}
i++;
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
DRM_COPY_TO_USER_IOCTL( (drm_client_t *)data, client, sizeof(client) );
memset(&stats, 0, sizeof(stats));
- DRM_LOCK;
+ DRM_LOCK();
for (i = 0; i < dev->counters; i++) {
if (dev->types[i] == _DRM_STAT_LOCK)
stats.count = dev->counters;
- DRM_UNLOCK;
+ DRM_UNLOCK();
DRM_COPY_TO_USER_IOCTL( (drm_stats_t *)data, stats, sizeof(stats) );
* code for that is not yet written */
#define DRMFILE void *
#define DRM_IOCTL_ARGS dev_t kdev, u_long cmd, caddr_t data, int flags, DRM_STRUCTPROC *p, DRMFILE filp
-#define DRM_LOCK lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, DRM_CURPROC)
-#define DRM_UNLOCK lockmgr(&dev->dev_lock, LK_RELEASE, 0, DRM_CURPROC)
+#define DRM_LOCK() lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, DRM_CURPROC)
+#define DRM_UNLOCK() lockmgr(&dev->dev_lock, LK_RELEASE, 0, DRM_CURPROC)
#define DRM_SUSER(p) suser(p)
#define DRM_TASKQUEUE_ARGS void *arg, int pending
#define DRM_IRQ_ARGS void *arg
* code for that is not yet written */
#define DRMFILE void *
#define DRM_IOCTL_ARGS dev_t kdev, u_long cmd, caddr_t data, int flags, DRM_STRUCTPROC *p, DRMFILE filp
-#define DRM_LOCK lockmgr(&dev->dev_lock, LK_EXCLUSIVE, NULL)
-#define DRM_UNLOCK lockmgr(&dev->dev_lock, LK_RELEASE, NULL)
+#define DRM_LOCK() lockmgr(&dev->dev_lock, LK_EXCLUSIVE, NULL)
+#define DRM_UNLOCK() lockmgr(&dev->dev_lock, LK_RELEASE, NULL)
#define DRM_SUSER(p) suser(p->p_ucred, &p->p_acflag)
#define DRM_TASKQUEUE_ARGS void *dev, int pending
#define DRM_IRQ_ARGS void *arg
drm_device_t *dev = arg1;
int ret;
- DRM_LOCK;
+ DRM_LOCK();
ret = DRM(_vm_info)(oidp, arg1, arg2, req);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return ret;
}
drm_device_t *dev = arg1;
int ret;
- DRM_LOCK;
+ DRM_LOCK();
ret = DRM(_bufs_info)(oidp, arg1, arg2, req);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return ret;
}
drm_device_t *dev = arg1;
int ret;
- DRM_LOCK;
+ DRM_LOCK();
ret = DRM(_clients_info)(oidp, arg1, arg2, req);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return ret;
}
drm_magic_entry_t *pt;
int hash = DRM(hash_magic)(magic);
- DRM_LOCK;
+ DRM_LOCK();
for (pt = dev->magiclist[hash].head; pt; pt = pt->next) {
if (pt->magic == magic) {
retval = pt->priv;
break;
}
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
return retval;
}
entry->priv = priv;
entry->next = NULL;
- DRM_LOCK;
+ DRM_LOCK();
if (dev->magiclist[hash].tail) {
dev->magiclist[hash].tail->next = entry;
dev->magiclist[hash].tail = entry;
dev->magiclist[hash].head = entry;
dev->magiclist[hash].tail = entry;
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
return 0;
}
DRM_DEBUG("%d\n", magic);
hash = DRM(hash_magic)(magic);
- DRM_LOCK;
+ DRM_LOCK();
for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) {
if (pt->magic == magic) {
if (dev->magiclist[hash].head == pt) {
if (prev) {
prev->next = pt->next;
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
return 0;
}
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC);
return DRM_ERR(EINVAL);
}
list->map = map;
- DRM_LOCK;
+ DRM_LOCK();
TAILQ_INSERT_TAIL(dev->maplist, list, link);
- DRM_UNLOCK;
+ DRM_UNLOCK();
request.offset = map->offset;
request.size = map->size;
DRM_COPY_FROM_USER_IOCTL( request, (drm_map_t *)data, sizeof(request) );
- DRM_LOCK;
+ DRM_LOCK();
TAILQ_FOREACH(list, dev->maplist, link) {
map = list->map;
if (map->handle == request.handle &&
/* No match found. */
if (list == NULL) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(EINVAL);
}
TAILQ_REMOVE(dev->maplist, list, link);
break;
}
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return 0;
}
if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER )
return DRM_ERR(EINVAL);
- DRM_LOCK;
+ DRM_LOCK();
entry = &dma->bufs[order];
if ( entry->buf_count ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM); /* May only call once for each order */
}
entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist),
DRM_MEM_BUFS );
if ( !entry->buflist ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
memset( entry->buflist, 0, count * sizeof(*entry->buflist) );
/* Set count correctly so we free the proper amount. */
entry->buf_count = count;
DRM(cleanup_buf_error)(dev, entry);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
if (temp_buflist == NULL) {
/* Free the entry because it isn't valid */
DRM(cleanup_buf_error)(dev, entry);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
dma->buflist = temp_buflist;
DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count );
DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count );
- DRM_UNLOCK;
+ DRM_UNLOCK();
request->count = entry->buf_count;
request->size = size;
page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
total = PAGE_SIZE << page_order;
- DRM_LOCK;
+ DRM_LOCK();
entry = &dma->bufs[order];
if ( entry->buf_count ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM); /* May only call once for each order */
}
DRM_MEM_SEGS);
DRM(free)(entry->seglist_bus, count *
sizeof(*entry->seglist_bus), DRM_MEM_SEGS);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
DRM(free)(temp_pagelist, (dma->page_count +
(count << page_order)) * sizeof(*dma->pagelist),
DRM_MEM_PAGES);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
DRM(free)(temp_pagelist, (dma->page_count +
(count << page_order)) *
sizeof(*dma->pagelist), DRM_MEM_PAGES );
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
bzero(buf->dev_private, buf->dev_priv_size);
DRM(free)(temp_pagelist, (dma->page_count +
(count << page_order)) * sizeof(*dma->pagelist),
DRM_MEM_PAGES);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
dma->buflist = temp_buflist;
dma->page_count += entry->seg_count << page_order;
dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order);
- DRM_UNLOCK;
+ DRM_UNLOCK();
request->count = entry->buf_count;
request->size = size;
if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER )
return DRM_ERR(EINVAL);
- DRM_LOCK;
+ DRM_LOCK();
entry = &dma->bufs[order];
if ( entry->buf_count ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM); /* May only call once for each order */
}
entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist),
DRM_MEM_BUFS );
if ( !entry->buflist ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
memset( entry->buflist, 0, count * sizeof(*entry->buflist) );
/* Set count correctly so we free the proper amount. */
entry->buf_count = count;
DRM(cleanup_buf_error)(dev, entry);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
if (temp_buflist == NULL) {
/* Free the entry because it isn't valid */
DRM(cleanup_buf_error)(dev, entry);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
dma->buflist = temp_buflist;
DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count );
DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count );
- DRM_UNLOCK;
+ DRM_UNLOCK();
request->count = entry->buf_count;
request->size = size;
return;
}
- DRM_LOCK;
+ DRM_LOCK();
clear_bit(ctx_handle, dev->ctx_bitmap);
dev->context_sareas[ctx_handle] = NULL;
- DRM_UNLOCK;
+ DRM_UNLOCK();
return;
}
if (dev->ctx_bitmap == NULL)
return -1;
- DRM_LOCK;
+ DRM_LOCK();
bit = find_first_zero_bit( dev->ctx_bitmap, DRM_MAX_CTXBITMAP );
if (bit >= DRM_MAX_CTXBITMAP) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return -1;
}
DRM_MEM_MAPS);
if (ctx_sareas == NULL) {
clear_bit(bit, dev->ctx_bitmap);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return -1;
}
dev->context_sareas = ctx_sareas;
sizeof(*dev->context_sareas), DRM_MEM_MAPS);
if (dev->context_sareas == NULL) {
clear_bit(bit, dev->ctx_bitmap);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return -1;
}
dev->context_sareas[bit] = NULL;
}
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
return bit;
}
int i;
int temp;
- DRM_LOCK;
+ DRM_LOCK();
dev->ctx_bitmap = (atomic_t *)DRM(calloc)(1, PAGE_SIZE,
DRM_MEM_CTXBITMAP);
if ( dev->ctx_bitmap == NULL ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(ENOMEM);
}
dev->context_sareas = NULL;
dev->max_context = -1;
- DRM_UNLOCK;
+ DRM_UNLOCK();
for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) {
temp = DRM(ctxbitmap_next)( dev );
void DRM(ctxbitmap_cleanup)( drm_device_t *dev )
{
- DRM_LOCK;
+ DRM_LOCK();
if (dev->context_sareas != NULL)
DRM(free)(dev->context_sareas, sizeof(*dev->context_sareas) *
dev->max_context, DRM_MEM_MAPS);
DRM(free)( (void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP );
- DRM_UNLOCK;
+ DRM_UNLOCK();
}
/* ================================================================
DRM_COPY_FROM_USER_IOCTL( request, (drm_ctx_priv_map_t *)data,
sizeof(request) );
- DRM_LOCK;
+ DRM_LOCK();
if (dev->max_context < 0 || request.ctx_id >= (unsigned) dev->max_context) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(EINVAL);
}
map = dev->context_sareas[request.ctx_id];
- DRM_UNLOCK;
+ DRM_UNLOCK();
request.handle = map->handle;
DRM_COPY_FROM_USER_IOCTL( request, (drm_ctx_priv_map_t *)data,
sizeof(request) );
- DRM_LOCK;
+ DRM_LOCK();
TAILQ_FOREACH(list, dev->maplist, link) {
map=list->map;
if (map->handle == request.handle) {
if (request.ctx_id >= (unsigned) dev->max_context)
goto bad;
dev->context_sareas[request.ctx_id] = map;
- DRM_UNLOCK;
+ DRM_UNLOCK();
return 0;
}
}
bad:
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(EINVAL);
}
if ( irq == 0 || dev->dev_private == NULL)
return DRM_ERR(EINVAL);
- DRM_LOCK;
+ DRM_LOCK();
if ( dev->irq ) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(EBUSY);
}
dev->irq = irq;
- DRM_UNLOCK;
+ DRM_UNLOCK();
DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq );
#elif defined(__NetBSD__)
if (pci_intr_map(&dev->pa, &dev->ih) != 0) {
#endif
- DRM_LOCK;
+ DRM_LOCK();
dev->irq = 0;
dev->irqrid = 0;
- DRM_UNLOCK;
+ DRM_UNLOCK();
return ENOENT;
}
(irqreturn_t (*)(DRM_IRQ_ARGS))DRM(dma_service), dev);
if ( !dev->irqh ) {
#endif
- DRM_LOCK;
+ DRM_LOCK();
#ifdef __FreeBSD__
bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr);
#endif
dev->irq = 0;
dev->irqrid = 0;
- DRM_UNLOCK;
+ DRM_UNLOCK();
return retcode;
}
int irq;
int irqrid;
- DRM_LOCK;
+ DRM_LOCK();
irq = dev->irq;
irqrid = dev->irqrid;
dev->irq = 0;
dev->irqrid = 0;
- DRM_UNLOCK;
+ DRM_UNLOCK();
if ( !irq )
return DRM_ERR(EINVAL);
DRM(irq_uninstall)( dev );
#endif
- DRM_LOCK;
+ DRM_LOCK();
callout_stop( &dev->timer );
if ( dev->unique ) {
dev->lock.filp = NULL;
DRM_WAKEUP_INT((void *)&dev->lock.lock_queue);
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
return 0;
}
dev->buf_pgid = 0;
#endif /* __NetBSD__ */
- DRM_LOCK;
+ DRM_LOCK();
priv = DRM(find_file_by_proc)(dev, p);
if (priv) {
priv->refs--;
DRM(free)( priv, sizeof(*priv), DRM_MEM_FILES );
}
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
/* ========================================================
priv->devXX = dev;
priv->ioctl_count = 0;
priv->authenticated = !DRM_SUSER(p);
- DRM_LOCK;
+ DRM_LOCK();
TAILQ_INSERT_TAIL(&dev->files, priv, link);
- DRM_UNLOCK;
+ DRM_UNLOCK();
}
#ifdef __FreeBSD__
kdev->si_drv1 = dev;
idx = map.offset;
- DRM_LOCK;
+ DRM_LOCK();
if (idx < 0) {
- DRM_UNLOCK;
+ DRM_UNLOCK();
return DRM_ERR(EINVAL);
}
i++;
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
if (!list)
return EINVAL;
DRM_COPY_FROM_USER_IOCTL( client, (drm_client_t *)data, sizeof(client) );
idx = client.idx;
- DRM_LOCK;
+ DRM_LOCK();
TAILQ_FOREACH(pt, &dev->files, link) {
if (i==idx)
{
client.uid = pt->uid;
client.magic = pt->magic;
client.iocs = pt->ioctl_count;
- DRM_UNLOCK;
+ DRM_UNLOCK();
*(drm_client_t *)data = client;
return 0;
}
i++;
}
- DRM_UNLOCK;
+ DRM_UNLOCK();
DRM_COPY_TO_USER_IOCTL( (drm_client_t *)data, client, sizeof(client) );
memset(&stats, 0, sizeof(stats));
- DRM_LOCK;
+ DRM_LOCK();
for (i = 0; i < dev->counters; i++) {
if (dev->types[i] == _DRM_STAT_LOCK)
stats.count = dev->counters;
- DRM_UNLOCK;
+ DRM_UNLOCK();
DRM_COPY_TO_USER_IOCTL( (drm_stats_t *)data, stats, sizeof(stats) );
* code for that is not yet written */
#define DRMFILE void *
#define DRM_IOCTL_ARGS dev_t kdev, u_long cmd, caddr_t data, int flags, DRM_STRUCTPROC *p, DRMFILE filp
-#define DRM_LOCK lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, DRM_CURPROC)
-#define DRM_UNLOCK lockmgr(&dev->dev_lock, LK_RELEASE, 0, DRM_CURPROC)
+#define DRM_LOCK() lockmgr(&dev->dev_lock, LK_EXCLUSIVE, 0, DRM_CURPROC)
+#define DRM_UNLOCK() lockmgr(&dev->dev_lock, LK_RELEASE, 0, DRM_CURPROC)
#define DRM_SUSER(p) suser(p)
#define DRM_TASKQUEUE_ARGS void *arg, int pending
#define DRM_IRQ_ARGS void *arg
* code for that is not yet written */
#define DRMFILE void *
#define DRM_IOCTL_ARGS dev_t kdev, u_long cmd, caddr_t data, int flags, DRM_STRUCTPROC *p, DRMFILE filp
-#define DRM_LOCK lockmgr(&dev->dev_lock, LK_EXCLUSIVE, NULL)
-#define DRM_UNLOCK lockmgr(&dev->dev_lock, LK_RELEASE, NULL)
+#define DRM_LOCK() lockmgr(&dev->dev_lock, LK_EXCLUSIVE, NULL)
+#define DRM_UNLOCK() lockmgr(&dev->dev_lock, LK_RELEASE, NULL)
#define DRM_SUSER(p) suser(p->p_ucred, &p->p_acflag)
#define DRM_TASKQUEUE_ARGS void *dev, int pending
#define DRM_IRQ_ARGS void *arg
drm_device_t *dev = arg1;
int ret;
- DRM_LOCK;
+ DRM_LOCK();
ret = DRM(_vm_info)(oidp, arg1, arg2, req);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return ret;
}
drm_device_t *dev = arg1;
int ret;
- DRM_LOCK;
+ DRM_LOCK();
ret = DRM(_bufs_info)(oidp, arg1, arg2, req);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return ret;
}
drm_device_t *dev = arg1;
int ret;
- DRM_LOCK;
+ DRM_LOCK();
ret = DRM(_clients_info)(oidp, arg1, arg2, req);
- DRM_UNLOCK;
+ DRM_UNLOCK();
return ret;
}