Stylistic preparation for SMPng locking work: DRM_LOCK/DRM_UNLOCK have side
effects, so make them look like functions (add parenthesis).main
parent
e187d665e4
commit
929536172c
|
@ -43,14 +43,14 @@ static drm_file_t *DRM(find_file)(drm_device_t *dev, drm_magic_t magic)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
|||
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;
|
||||
|
@ -77,7 +77,7 @@ int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
|||
dev->magiclist[hash].head = entry;
|
||||
dev->magiclist[hash].tail = entry;
|
||||
}
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic)
|
|||
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) {
|
||||
|
@ -103,11 +103,11 @@ int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic)
|
|||
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);
|
||||
|
|
|
@ -178,9 +178,9 @@ int DRM(addmap)( DRM_IOCTL_ARGS )
|
|||
}
|
||||
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;
|
||||
|
@ -212,7 +212,7 @@ int DRM(rmmap)( DRM_IOCTL_ARGS )
|
|||
|
||||
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 &&
|
||||
|
@ -222,7 +222,7 @@ int DRM(rmmap)( DRM_IOCTL_ARGS )
|
|||
|
||||
/* No match found. */
|
||||
if (list == NULL) {
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
TAILQ_REMOVE(dev->maplist, list, link);
|
||||
|
@ -268,7 +268,7 @@ int DRM(rmmap)( DRM_IOCTL_ARGS )
|
|||
break;
|
||||
}
|
||||
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -353,17 +353,17 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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) );
|
||||
|
@ -394,7 +394,7 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
/* 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);
|
||||
}
|
||||
|
||||
|
@ -413,7 +413,7 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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;
|
||||
|
@ -428,7 +428,7 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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;
|
||||
|
@ -475,10 +475,10 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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 */
|
||||
}
|
||||
|
||||
|
@ -503,7 +503,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
DRM_MEM_SEGS);
|
||||
DRM(free)(entry->seglist_bus, count *
|
||||
sizeof(*entry->seglist_bus), DRM_MEM_SEGS);
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
||||
|
@ -532,7 +532,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
DRM(free)(temp_pagelist, (dma->page_count +
|
||||
(count << page_order)) * sizeof(*dma->pagelist),
|
||||
DRM_MEM_PAGES);
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
||||
|
@ -571,7 +571,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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);
|
||||
|
@ -593,7 +593,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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;
|
||||
|
@ -614,7 +614,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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;
|
||||
|
@ -665,17 +665,17 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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) );
|
||||
|
@ -706,7 +706,7 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
/* 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);
|
||||
}
|
||||
|
||||
|
@ -728,7 +728,7 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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;
|
||||
|
@ -743,7 +743,7 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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;
|
||||
|
|
|
@ -49,10 +49,10 @@ void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle )
|
|||
return;
|
||||
}
|
||||
|
||||
DRM_LOCK;
|
||||
DRM_LOCK();
|
||||
clear_bit(ctx_handle, dev->ctx_bitmap);
|
||||
dev->context_sareas[ctx_handle] = NULL;
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -63,10 +63,10 @@ int DRM(ctxbitmap_next)( drm_device_t *dev )
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ int DRM(ctxbitmap_next)( drm_device_t *dev )
|
|||
DRM_MEM_MAPS);
|
||||
if (ctx_sareas == NULL) {
|
||||
clear_bit(bit, dev->ctx_bitmap);
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return -1;
|
||||
}
|
||||
dev->context_sareas = ctx_sareas;
|
||||
|
@ -96,13 +96,13 @@ int DRM(ctxbitmap_next)( drm_device_t *dev )
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -111,16 +111,16 @@ int DRM(ctxbitmap_init)( drm_device_t *dev )
|
|||
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 );
|
||||
|
@ -132,12 +132,12 @@ int DRM(ctxbitmap_init)( drm_device_t *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();
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
|
@ -153,14 +153,14 @@ int DRM(getsareactx)( DRM_IOCTL_ARGS )
|
|||
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;
|
||||
|
||||
|
@ -179,7 +179,7 @@ int DRM(setsareactx)( DRM_IOCTL_ARGS )
|
|||
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) {
|
||||
|
@ -188,13 +188,13 @@ int DRM(setsareactx)( DRM_IOCTL_ARGS )
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -159,13 +159,13 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
|
|||
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 );
|
||||
|
||||
|
@ -195,10 +195,10 @@ int DRM(irq_install)( drm_device_t *dev, int 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;
|
||||
}
|
||||
|
||||
|
@ -216,13 +216,13 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
|
|||
(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;
|
||||
}
|
||||
|
||||
|
@ -237,12 +237,12 @@ int DRM(irq_uninstall)( drm_device_t *dev )
|
|||
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);
|
||||
|
|
|
@ -517,7 +517,7 @@ static int DRM(takedown)( drm_device_t *dev )
|
|||
DRM(irq_uninstall)( dev );
|
||||
#endif
|
||||
|
||||
DRM_LOCK;
|
||||
DRM_LOCK();
|
||||
callout_stop( &dev->timer );
|
||||
|
||||
if ( dev->unique ) {
|
||||
|
@ -627,7 +627,7 @@ static int DRM(takedown)( drm_device_t *dev )
|
|||
dev->lock.filp = NULL;
|
||||
DRM_WAKEUP_INT((void *)&dev->lock.lock_queue);
|
||||
}
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -935,7 +935,7 @@ int DRM(close)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p)
|
|||
dev->buf_pgid = 0;
|
||||
#endif /* __NetBSD__ */
|
||||
|
||||
DRM_LOCK;
|
||||
DRM_LOCK();
|
||||
priv = DRM(find_file_by_proc)(dev, p);
|
||||
if (priv) {
|
||||
priv->refs--;
|
||||
|
@ -944,7 +944,7 @@ int DRM(close)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p)
|
|||
DRM(free)( priv, sizeof(*priv), DRM_MEM_FILES );
|
||||
}
|
||||
}
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
|
||||
|
||||
/* ========================================================
|
||||
|
|
|
@ -84,9 +84,9 @@ int DRM(open_helper)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
|||
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;
|
||||
|
|
|
@ -138,9 +138,9 @@ int DRM(getmap)( DRM_IOCTL_ARGS )
|
|||
|
||||
idx = map.offset;
|
||||
|
||||
DRM_LOCK;
|
||||
DRM_LOCK();
|
||||
if (idx < 0) {
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ int DRM(getmap)( DRM_IOCTL_ARGS )
|
|||
i++;
|
||||
}
|
||||
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
|
||||
if (!list)
|
||||
return EINVAL;
|
||||
|
@ -179,7 +179,7 @@ int DRM(getclient)( DRM_IOCTL_ARGS )
|
|||
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)
|
||||
{
|
||||
|
@ -188,14 +188,14 @@ int DRM(getclient)( DRM_IOCTL_ARGS )
|
|||
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) );
|
||||
|
||||
|
@ -210,7 +210,7 @@ int DRM(getstats)( DRM_IOCTL_ARGS )
|
|||
|
||||
memset(&stats, 0, sizeof(stats));
|
||||
|
||||
DRM_LOCK;
|
||||
DRM_LOCK();
|
||||
|
||||
for (i = 0; i < dev->counters; i++) {
|
||||
if (dev->types[i] == _DRM_STAT_LOCK)
|
||||
|
@ -224,7 +224,7 @@ int DRM(getstats)( DRM_IOCTL_ARGS )
|
|||
|
||||
stats.count = dev->counters;
|
||||
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
|
||||
DRM_COPY_TO_USER_IOCTL( (drm_stats_t *)data, stats, sizeof(stats) );
|
||||
|
||||
|
|
|
@ -139,8 +139,8 @@
|
|||
* 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
|
||||
|
|
|
@ -112,8 +112,8 @@ extern struct cfdriver DRM(cd);
|
|||
* 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
|
||||
|
|
|
@ -176,9 +176,9 @@ static int DRM(vm_info)DRM_SYSCTL_HANDLER_ARGS
|
|||
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;
|
||||
}
|
||||
|
@ -228,9 +228,9 @@ static int DRM(bufs_info) DRM_SYSCTL_HANDLER_ARGS
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -262,9 +262,9 @@ static int DRM(clients_info)DRM_SYSCTL_HANDLER_ARGS
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,14 +43,14 @@ static drm_file_t *DRM(find_file)(drm_device_t *dev, drm_magic_t magic)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
|||
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;
|
||||
|
@ -77,7 +77,7 @@ int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
|
|||
dev->magiclist[hash].head = entry;
|
||||
dev->magiclist[hash].tail = entry;
|
||||
}
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic)
|
|||
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) {
|
||||
|
@ -103,11 +103,11 @@ int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic)
|
|||
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);
|
||||
|
|
|
@ -178,9 +178,9 @@ int DRM(addmap)( DRM_IOCTL_ARGS )
|
|||
}
|
||||
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;
|
||||
|
@ -212,7 +212,7 @@ int DRM(rmmap)( DRM_IOCTL_ARGS )
|
|||
|
||||
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 &&
|
||||
|
@ -222,7 +222,7 @@ int DRM(rmmap)( DRM_IOCTL_ARGS )
|
|||
|
||||
/* No match found. */
|
||||
if (list == NULL) {
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
TAILQ_REMOVE(dev->maplist, list, link);
|
||||
|
@ -268,7 +268,7 @@ int DRM(rmmap)( DRM_IOCTL_ARGS )
|
|||
break;
|
||||
}
|
||||
DRM(free)(map, sizeof(*map), DRM_MEM_MAPS);
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -353,17 +353,17 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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) );
|
||||
|
@ -394,7 +394,7 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
/* 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);
|
||||
}
|
||||
|
||||
|
@ -413,7 +413,7 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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;
|
||||
|
@ -428,7 +428,7 @@ static int DRM(addbufs_agp)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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;
|
||||
|
@ -475,10 +475,10 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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 */
|
||||
}
|
||||
|
||||
|
@ -503,7 +503,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
DRM_MEM_SEGS);
|
||||
DRM(free)(entry->seglist_bus, count *
|
||||
sizeof(*entry->seglist_bus), DRM_MEM_SEGS);
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
||||
|
@ -532,7 +532,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
DRM(free)(temp_pagelist, (dma->page_count +
|
||||
(count << page_order)) * sizeof(*dma->pagelist),
|
||||
DRM_MEM_PAGES);
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return DRM_ERR(ENOMEM);
|
||||
}
|
||||
|
||||
|
@ -571,7 +571,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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);
|
||||
|
@ -593,7 +593,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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;
|
||||
|
@ -614,7 +614,7 @@ static int DRM(addbufs_pci)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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;
|
||||
|
@ -665,17 +665,17 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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) );
|
||||
|
@ -706,7 +706,7 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
/* 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);
|
||||
}
|
||||
|
||||
|
@ -728,7 +728,7 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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;
|
||||
|
@ -743,7 +743,7 @@ static int DRM(addbufs_sg)(drm_device_t *dev, drm_buf_desc_t *request)
|
|||
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;
|
||||
|
|
|
@ -49,10 +49,10 @@ void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle )
|
|||
return;
|
||||
}
|
||||
|
||||
DRM_LOCK;
|
||||
DRM_LOCK();
|
||||
clear_bit(ctx_handle, dev->ctx_bitmap);
|
||||
dev->context_sareas[ctx_handle] = NULL;
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -63,10 +63,10 @@ int DRM(ctxbitmap_next)( drm_device_t *dev )
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ int DRM(ctxbitmap_next)( drm_device_t *dev )
|
|||
DRM_MEM_MAPS);
|
||||
if (ctx_sareas == NULL) {
|
||||
clear_bit(bit, dev->ctx_bitmap);
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return -1;
|
||||
}
|
||||
dev->context_sareas = ctx_sareas;
|
||||
|
@ -96,13 +96,13 @@ int DRM(ctxbitmap_next)( drm_device_t *dev )
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -111,16 +111,16 @@ int DRM(ctxbitmap_init)( drm_device_t *dev )
|
|||
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 );
|
||||
|
@ -132,12 +132,12 @@ int DRM(ctxbitmap_init)( drm_device_t *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();
|
||||
}
|
||||
|
||||
/* ================================================================
|
||||
|
@ -153,14 +153,14 @@ int DRM(getsareactx)( DRM_IOCTL_ARGS )
|
|||
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;
|
||||
|
||||
|
@ -179,7 +179,7 @@ int DRM(setsareactx)( DRM_IOCTL_ARGS )
|
|||
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) {
|
||||
|
@ -188,13 +188,13 @@ int DRM(setsareactx)( DRM_IOCTL_ARGS )
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -159,13 +159,13 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
|
|||
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 );
|
||||
|
||||
|
@ -195,10 +195,10 @@ int DRM(irq_install)( drm_device_t *dev, int 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;
|
||||
}
|
||||
|
||||
|
@ -216,13 +216,13 @@ int DRM(irq_install)( drm_device_t *dev, int irq )
|
|||
(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;
|
||||
}
|
||||
|
||||
|
@ -237,12 +237,12 @@ int DRM(irq_uninstall)( drm_device_t *dev )
|
|||
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);
|
||||
|
|
|
@ -517,7 +517,7 @@ static int DRM(takedown)( drm_device_t *dev )
|
|||
DRM(irq_uninstall)( dev );
|
||||
#endif
|
||||
|
||||
DRM_LOCK;
|
||||
DRM_LOCK();
|
||||
callout_stop( &dev->timer );
|
||||
|
||||
if ( dev->unique ) {
|
||||
|
@ -627,7 +627,7 @@ static int DRM(takedown)( drm_device_t *dev )
|
|||
dev->lock.filp = NULL;
|
||||
DRM_WAKEUP_INT((void *)&dev->lock.lock_queue);
|
||||
}
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -935,7 +935,7 @@ int DRM(close)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p)
|
|||
dev->buf_pgid = 0;
|
||||
#endif /* __NetBSD__ */
|
||||
|
||||
DRM_LOCK;
|
||||
DRM_LOCK();
|
||||
priv = DRM(find_file_by_proc)(dev, p);
|
||||
if (priv) {
|
||||
priv->refs--;
|
||||
|
@ -944,7 +944,7 @@ int DRM(close)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p)
|
|||
DRM(free)( priv, sizeof(*priv), DRM_MEM_FILES );
|
||||
}
|
||||
}
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
|
||||
|
||||
/* ========================================================
|
||||
|
|
|
@ -84,9 +84,9 @@ int DRM(open_helper)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p,
|
|||
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;
|
||||
|
|
|
@ -138,9 +138,9 @@ int DRM(getmap)( DRM_IOCTL_ARGS )
|
|||
|
||||
idx = map.offset;
|
||||
|
||||
DRM_LOCK;
|
||||
DRM_LOCK();
|
||||
if (idx < 0) {
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
return DRM_ERR(EINVAL);
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ int DRM(getmap)( DRM_IOCTL_ARGS )
|
|||
i++;
|
||||
}
|
||||
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
|
||||
if (!list)
|
||||
return EINVAL;
|
||||
|
@ -179,7 +179,7 @@ int DRM(getclient)( DRM_IOCTL_ARGS )
|
|||
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)
|
||||
{
|
||||
|
@ -188,14 +188,14 @@ int DRM(getclient)( DRM_IOCTL_ARGS )
|
|||
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) );
|
||||
|
||||
|
@ -210,7 +210,7 @@ int DRM(getstats)( DRM_IOCTL_ARGS )
|
|||
|
||||
memset(&stats, 0, sizeof(stats));
|
||||
|
||||
DRM_LOCK;
|
||||
DRM_LOCK();
|
||||
|
||||
for (i = 0; i < dev->counters; i++) {
|
||||
if (dev->types[i] == _DRM_STAT_LOCK)
|
||||
|
@ -224,7 +224,7 @@ int DRM(getstats)( DRM_IOCTL_ARGS )
|
|||
|
||||
stats.count = dev->counters;
|
||||
|
||||
DRM_UNLOCK;
|
||||
DRM_UNLOCK();
|
||||
|
||||
DRM_COPY_TO_USER_IOCTL( (drm_stats_t *)data, stats, sizeof(stats) );
|
||||
|
||||
|
|
|
@ -139,8 +139,8 @@
|
|||
* 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
|
||||
|
|
|
@ -112,8 +112,8 @@ extern struct cfdriver DRM(cd);
|
|||
* 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
|
||||
|
|
|
@ -176,9 +176,9 @@ static int DRM(vm_info)DRM_SYSCTL_HANDLER_ARGS
|
|||
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;
|
||||
}
|
||||
|
@ -228,9 +228,9 @@ static int DRM(bufs_info) DRM_SYSCTL_HANDLER_ARGS
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -262,9 +262,9 @@ static int DRM(clients_info)DRM_SYSCTL_HANDLER_ARGS
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue