summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvehemens <vehemens@verizon.net>2008-09-02 04:57:36 -0700
committerRobert Noland <rnoland@2hip.net>2008-09-05 12:42:41 -0400
commit76dd74c64ef9b92025e76dd256e0641ff6fce0f4 (patch)
treeb4981b73c07f18f00c9726ce45955a7a1e350fa8
parented6dd03818f2fa4dd0f2ba34dee58b09c7ff253e (diff)
Style white space cleanup.
Signed-off-by: Robert Noland <rnoland@2hip.net>
-rw-r--r--bsd-core/drm_auth.c2
-rw-r--r--bsd-core/drm_bufs.c154
-rw-r--r--bsd-core/drm_context.c70
-rw-r--r--bsd-core/drm_dma.c15
-rw-r--r--bsd-core/drm_drv.c66
-rw-r--r--bsd-core/drm_ioctl.c5
-rw-r--r--bsd-core/drm_irq.c20
-rw-r--r--bsd-core/drm_lock.c34
-rw-r--r--bsd-core/drm_scatter.c16
9 files changed, 192 insertions, 190 deletions
diff --git a/bsd-core/drm_auth.c b/bsd-core/drm_auth.c
index c11c887a..2f836189 100644
--- a/bsd-core/drm_auth.c
+++ b/bsd-core/drm_auth.c
@@ -138,7 +138,7 @@ int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
static drm_magic_t sequence = 0;
struct drm_auth *auth = data;
- /* Find unique magic */
+ /* Find unique magic */
if (file_priv->magic) {
auth->magic = file_priv->magic;
} else {
diff --git a/bsd-core/drm_bufs.c b/bsd-core/drm_bufs.c
index ed13f02f..45e01470 100644
--- a/bsd-core/drm_bufs.c
+++ b/bsd-core/drm_bufs.c
@@ -44,9 +44,9 @@ int drm_order(unsigned long size)
int order;
unsigned long tmp;
- for ( order = 0, tmp = size ; tmp >>= 1 ; ++order );
+ for (order = 0, tmp = size; tmp >>= 1; ++order);
- if ( size & ~(1 << order) )
+ if (size & ~(1 << order))
++order;
return order;
@@ -152,7 +152,7 @@ int drm_addmap(struct drm_device * dev, unsigned long offset,
* initialization necessary.
*/
map = malloc(sizeof(*map), M_DRM, M_ZERO | M_NOWAIT);
- if ( !map ) {
+ if (!map) {
DRM_LOCK();
return ENOMEM;
}
@@ -162,7 +162,7 @@ int drm_addmap(struct drm_device * dev, unsigned long offset,
map->type = type;
map->flags = flags;
- switch ( map->type ) {
+ switch (map->type) {
case _DRM_REGISTERS:
map->handle = drm_ioremap(dev, map);
if (!(map->flags & _DRM_WRITE_COMBINING))
@@ -174,15 +174,15 @@ int drm_addmap(struct drm_device * dev, unsigned long offset,
break;
case _DRM_SHM:
map->handle = malloc(map->size, M_DRM, M_NOWAIT);
- DRM_DEBUG( "%lu %d %p\n",
- map->size, drm_order(map->size), map->handle );
- if ( !map->handle ) {
+ DRM_DEBUG("%lu %d %p\n",
+ map->size, drm_order(map->size), map->handle);
+ if (!map->handle) {
free(map, M_DRM);
DRM_LOCK();
return ENOMEM;
}
map->offset = (unsigned long)map->handle;
- if ( map->flags & _DRM_CONTAINS_LOCK ) {
+ if (map->flags & _DRM_CONTAINS_LOCK) {
/* Prevent a 2nd X Server from creating a 2nd lock */
DRM_LOCK();
if (dev->lock.hw_lock != NULL) {
@@ -426,20 +426,20 @@ static int drm_do_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *reque
size = 1 << order;
alignment = (request->flags & _DRM_PAGE_ALIGN)
- ? round_page(size) : size;
+ ? round_page(size) : size;
page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
total = PAGE_SIZE << page_order;
byte_count = 0;
agp_offset = dev->agp->base + request->agp_start;
- DRM_DEBUG( "count: %d\n", count );
- DRM_DEBUG( "order: %d\n", order );
- DRM_DEBUG( "size: %d\n", size );
- DRM_DEBUG( "agp_offset: 0x%lx\n", agp_offset );
- DRM_DEBUG( "alignment: %d\n", alignment );
- DRM_DEBUG( "page_order: %d\n", page_order );
- DRM_DEBUG( "total: %d\n", total );
+ DRM_DEBUG("count: %d\n", count);
+ DRM_DEBUG("order: %d\n", order);
+ DRM_DEBUG("size: %d\n", size);
+ DRM_DEBUG("agp_offset: 0x%lx\n", agp_offset);
+ DRM_DEBUG("alignment: %d\n", alignment);
+ DRM_DEBUG("page_order: %d\n", page_order);
+ DRM_DEBUG("total: %d\n", total);
/* Make sure buffers are located in AGP memory that we own */
/* Breaks MGA due to drm_alloc_agp not setting up entries for the
@@ -465,7 +465,7 @@ static int drm_do_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *reque
entry->buflist = malloc(count * sizeof(*entry->buflist), M_DRM,
M_NOWAIT | M_ZERO);
- if ( !entry->buflist ) {
+ if (!entry->buflist) {
return ENOMEM;
}
@@ -474,7 +474,7 @@ static int drm_do_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *reque
offset = 0;
- while ( entry->buf_count < count ) {
+ while (entry->buf_count < count) {
buf = &entry->buflist[entry->buf_count];
buf->idx = dma->buf_count + entry->buf_count;
buf->total = alignment;
@@ -503,7 +503,7 @@ static int drm_do_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *reque
byte_count += PAGE_SIZE << page_order;
}
- DRM_DEBUG( "byte_count: %d\n", byte_count );
+ DRM_DEBUG("byte_count: %d\n", byte_count);
temp_buflist = realloc(dma->buflist,
(dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), M_DRM,
@@ -515,15 +515,15 @@ static int drm_do_addbufs_agp(struct drm_device *dev, struct drm_buf_desc *reque
}
dma->buflist = temp_buflist;
- for ( i = 0 ; i < entry->buf_count ; i++ ) {
+ for (i = 0; i < entry->buf_count; i++) {
dma->buflist[i + dma->buf_count] = &entry->buflist[i];
}
dma->buf_count += entry->buf_count;
dma->byte_count += byte_count;
- DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count );
- DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count );
+ DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
+ DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
request->count = entry->buf_count;
request->size = size;
@@ -555,11 +555,11 @@ static int drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *reque
order = drm_order(request->size);
size = 1 << order;
- DRM_DEBUG( "count=%d, size=%d (%d), order=%d\n",
- request->count, request->size, size, order );
+ DRM_DEBUG("count=%d, size=%d (%d), order=%d\n",
+ request->count, request->size, size, order);
alignment = (request->flags & _DRM_PAGE_ALIGN)
- ? round_page(size) : size;
+ ? round_page(size) : size;
page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
total = PAGE_SIZE << page_order;
@@ -582,19 +582,19 @@ static int drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *reque
free(entry->seglist, M_DRM);
return ENOMEM;
}
-
+
memcpy(temp_pagelist, dma->pagelist, dma->page_count *
sizeof(*dma->pagelist));
- DRM_DEBUG( "pagelist: %d entries\n",
- dma->page_count + (count << page_order) );
+ DRM_DEBUG("pagelist: %d entries\n",
+ dma->page_count + (count << page_order));
entry->buf_size = size;
entry->page_order = page_order;
byte_count = 0;
page_count = 0;
- while ( entry->buf_count < count ) {
+ while (entry->buf_count < count) {
drm_dma_handle_t *dmah = drm_pci_alloc(dev, size, alignment,
0xfffffffful);
if (dmah == NULL) {
@@ -607,16 +607,16 @@ static int drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *reque
}
entry->seglist[entry->seg_count++] = dmah;
- for ( i = 0 ; i < (1 << page_order) ; i++ ) {
- DRM_DEBUG( "page %d @ %p\n",
- dma->page_count + page_count,
- (char *)dmah->vaddr + PAGE_SIZE * i );
+ for (i = 0; i < (1 << page_order); i++) {
+ DRM_DEBUG("page %d @ %p\n",
+ dma->page_count + page_count,
+ (char *)dmah->vaddr + PAGE_SIZE * i);
temp_pagelist[dma->page_count + page_count++] =
(long)dmah->vaddr + PAGE_SIZE * i;
}
- for ( offset = 0 ;
- offset + size <= total && entry->buf_count < count ;
- offset += alignment, ++entry->buf_count ) {
+ for (offset = 0;
+ offset + size <= total && entry->buf_count < count;
+ offset += alignment, ++entry->buf_count) {
buf = &entry->buflist[entry->buf_count];
buf->idx = dma->buf_count + entry->buf_count;
buf->total = alignment;
@@ -641,8 +641,8 @@ static int drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *reque
return ENOMEM;
}
- DRM_DEBUG( "buffer %d @ %p\n",
- entry->buf_count, buf->address );
+ DRM_DEBUG("buffer %d @ %p\n",
+ entry->buf_count, buf->address);
}
byte_count += PAGE_SIZE << page_order;
}
@@ -658,7 +658,7 @@ static int drm_do_addbufs_pci(struct drm_device *dev, struct drm_buf_desc *reque
}
dma->buflist = temp_buflist;
- for ( i = 0 ; i < entry->buf_count ; i++ ) {
+ for (i = 0; i < entry->buf_count; i++) {
dma->buflist[i + dma->buf_count] = &entry->buflist[i];
}
@@ -702,20 +702,20 @@ static int drm_do_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *reques
size = 1 << order;
alignment = (request->flags & _DRM_PAGE_ALIGN)
- ? round_page(size) : size;
+ ? round_page(size) : size;
page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
total = PAGE_SIZE << page_order;
byte_count = 0;
agp_offset = request->agp_start;
- DRM_DEBUG( "count: %d\n", count );
- DRM_DEBUG( "order: %d\n", order );
- DRM_DEBUG( "size: %d\n", size );
- DRM_DEBUG( "agp_offset: %ld\n", agp_offset );
- DRM_DEBUG( "alignment: %d\n", alignment );
- DRM_DEBUG( "page_order: %d\n", page_order );
- DRM_DEBUG( "total: %d\n", total );
+ DRM_DEBUG("count: %d\n", count);
+ DRM_DEBUG("order: %d\n", order);
+ DRM_DEBUG("size: %d\n", size);
+ DRM_DEBUG("agp_offset: %ld\n", agp_offset);
+ DRM_DEBUG("alignment: %d\n", alignment);
+ DRM_DEBUG("page_order: %d\n", page_order);
+ DRM_DEBUG("total: %d\n", total);
entry = &dma->bufs[order];
@@ -729,7 +729,7 @@ static int drm_do_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *reques
offset = 0;
- while ( entry->buf_count < count ) {
+ while (entry->buf_count < count) {
buf = &entry->buflist[entry->buf_count];
buf->idx = dma->buf_count + entry->buf_count;
buf->total = alignment;
@@ -753,15 +753,15 @@ static int drm_do_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *reques
return ENOMEM;
}
- DRM_DEBUG( "buffer %d @ %p\n",
- entry->buf_count, buf->address );
+ DRM_DEBUG("buffer %d @ %p\n",
+ entry->buf_count, buf->address);
offset += alignment;
entry->buf_count++;
byte_count += PAGE_SIZE << page_order;
}
- DRM_DEBUG( "byte_count: %d\n", byte_count );
+ DRM_DEBUG("byte_count: %d\n", byte_count);
temp_buflist = realloc(dma->buflist,
(dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), M_DRM,
@@ -773,15 +773,15 @@ static int drm_do_addbufs_sg(struct drm_device *dev, struct drm_buf_desc *reques
}
dma->buflist = temp_buflist;
- for ( i = 0 ; i < entry->buf_count ; i++ ) {
+ for (i = 0; i < entry->buf_count; i++) {
dma->buflist[i + dma->buf_count] = &entry->buflist[i];
}
dma->buf_count += entry->buf_count;
dma->byte_count += byte_count;
- DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count );
- DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count );
+ DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
+ DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
request->count = entry->buf_count;
request->size = size;
@@ -918,15 +918,16 @@ int drm_infobufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
++dev->buf_use; /* Can't allocate more after this call */
DRM_SPINUNLOCK(&dev->dma_lock);
- for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) {
- if ( dma->bufs[i].buf_count ) ++count;
+ for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
+ if (dma->bufs[i].buf_count)
+ ++count;
}
- DRM_DEBUG( "count = %d\n", count );
+ DRM_DEBUG("count = %d\n", count);
- if ( request->count >= count ) {
- for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) {
- if ( dma->bufs[i].buf_count ) {
+ if (request->count >= count) {
+ for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
+ if (dma->bufs[i].buf_count) {
struct drm_buf_desc from;
from.count = dma->bufs[i].buf_count;
@@ -940,12 +941,11 @@ int drm_infobufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
break;
}
- DRM_DEBUG( "%d %d %d %d %d\n",
- i,
- dma->bufs[i].buf_count,
- dma->bufs[i].buf_size,
- dma->bufs[i].freelist.low_mark,
- dma->bufs[i].freelist.high_mark );
+ DRM_DEBUG("%d %d %d %d %d\n",
+ i, dma->bufs[i].buf_count,
+ dma->bufs[i].buf_size,
+ dma->bufs[i].freelist.low_mark,
+ dma->bufs[i].freelist.high_mark);
++count;
}
}
@@ -961,8 +961,8 @@ int drm_markbufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
struct drm_buf_desc *request = data;
int order;
- DRM_DEBUG( "%d, %d, %d\n",
- request->size, request->low_mark, request->high_mark );
+ DRM_DEBUG("%d, %d, %d\n",
+ request->size, request->low_mark, request->high_mark);
order = drm_order(request->size);
@@ -994,24 +994,24 @@ int drm_freebufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
drm_buf_t *buf;
int retcode = 0;
- DRM_DEBUG( "%d\n", request->count );
+ DRM_DEBUG("%d\n", request->count);
DRM_SPINLOCK(&dev->dma_lock);
- for ( i = 0 ; i < request->count ; i++ ) {
+ for (i = 0; i < request->count; i++) {
if (DRM_COPY_FROM_USER(&idx, &request->list[i], sizeof(idx))) {
retcode = EFAULT;
break;
}
- if ( idx < 0 || idx >= dma->buf_count ) {
- DRM_ERROR( "Index %d (of %d max)\n",
- idx, dma->buf_count - 1 );
+ if (idx < 0 || idx >= dma->buf_count) {
+ DRM_ERROR("Index %d (of %d max)\n",
+ idx, dma->buf_count - 1);
retcode = EINVAL;
break;
}
buf = dma->buflist[idx];
- if ( buf->file_priv != file_priv ) {
+ if (buf->file_priv != file_priv) {
DRM_ERROR("Process %d freeing buffer not owned\n",
- DRM_CURRENTPID);
+ DRM_CURRENTPID);
retcode = EINVAL;
break;
}
@@ -1098,7 +1098,7 @@ int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
request->virtual = (void *)vaddr;
- for ( i = 0 ; i < dma->buf_count ; i++ ) {
+ for (i = 0; i < dma->buf_count; i++) {
if (DRM_COPY_TO_USER(&request->list[i].idx,
&dma->buflist[i]->idx, sizeof(request->list[0].idx))) {
retcode = EFAULT;
@@ -1125,7 +1125,7 @@ int drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv)
done:
request->count = dma->buf_count;
- DRM_DEBUG( "%d buffers, retcode = %d\n", request->count, retcode );
+ DRM_DEBUG("%d buffers, retcode = %d\n", request->count, retcode);
return retcode;
}
diff --git a/bsd-core/drm_context.c b/bsd-core/drm_context.c
index b85922e1..24f34fdd 100644
--- a/bsd-core/drm_context.c
+++ b/bsd-core/drm_context.c
@@ -62,7 +62,7 @@ int drm_ctxbitmap_next(struct drm_device *dev)
return -1;
DRM_LOCK();
- bit = find_first_zero_bit( dev->ctx_bitmap, DRM_MAX_CTXBITMAP );
+ bit = find_first_zero_bit(dev->ctx_bitmap, DRM_MAX_CTXBITMAP);
if (bit >= DRM_MAX_CTXBITMAP) {
DRM_UNLOCK();
return -1;
@@ -116,9 +116,9 @@ int drm_ctxbitmap_init(struct drm_device *dev)
dev->max_context = -1;
DRM_UNLOCK();
- for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) {
+ for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
temp = drm_ctxbitmap_next(dev);
- DRM_DEBUG( "drm_ctxbitmap_init : %d\n", temp );
+ DRM_DEBUG("drm_ctxbitmap_init : %d\n", temp);
}
return 0;
@@ -188,33 +188,33 @@ bad:
int drm_context_switch(struct drm_device *dev, int old, int new)
{
- if ( test_and_set_bit( 0, &dev->context_flag ) ) {
- DRM_ERROR( "Reentering -- FIXME\n" );
- return EBUSY;
- }
+ if (test_and_set_bit(0, &dev->context_flag)) {
+ DRM_ERROR("Reentering -- FIXME\n");
+ return EBUSY;
+ }
- DRM_DEBUG( "Context switch from %d to %d\n", old, new );
+ DRM_DEBUG("Context switch from %d to %d\n", old, new);
- if ( new == dev->last_context ) {
- clear_bit( 0, &dev->context_flag );
- return 0;
- }
+ if (new == dev->last_context) {
+ clear_bit(0, &dev->context_flag);
+ return 0;
+ }
- return 0;
+ return 0;
}
int drm_context_switch_complete(struct drm_device *dev, int new)
{
- dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
+ dev->last_context = new; /* PRE/POST: This is the _only_ writer. */
- if ( !_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) ) {
- DRM_ERROR( "Lock isn't held after context switch\n" );
- }
+ if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
+ DRM_ERROR("Lock isn't held after context switch\n");
+ }
- /* If a context switch is ever initiated
- when the kernel holds the lock, release
- that lock here. */
- clear_bit( 0, &dev->context_flag );
+ /* If a context switch is ever initiated
+ when the kernel holds the lock, release
+ that lock here. */
+ clear_bit(0, &dev->context_flag);
return 0;
}
@@ -225,12 +225,12 @@ int drm_resctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
struct drm_ctx ctx;
int i;
- if ( res->count >= DRM_RESERVED_CONTEXTS ) {
+ if (res->count >= DRM_RESERVED_CONTEXTS) {
bzero(&ctx, sizeof(ctx));
- for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) {
+ for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) {
ctx.handle = i;
- if ( DRM_COPY_TO_USER( &res->contexts[i],
- &ctx, sizeof(ctx) ) )
+ if (DRM_COPY_TO_USER( &res->contexts[i],
+ &ctx, sizeof(ctx)))
return EFAULT;
}
}
@@ -244,14 +244,14 @@ int drm_addctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
struct drm_ctx *ctx = data;
ctx->handle = drm_ctxbitmap_next(dev);
- if ( ctx->handle == DRM_KERNEL_CONTEXT ) {
- /* Skip kernel's context and get a new one. */
+ if (ctx->handle == DRM_KERNEL_CONTEXT) {
+ /* Skip kernel's context and get a new one. */
ctx->handle = drm_ctxbitmap_next(dev);
}
- DRM_DEBUG( "%d\n", ctx->handle );
- if ( ctx->handle == -1 ) {
- DRM_DEBUG( "Not enough free contexts.\n" );
- /* Should this return -EBUSY instead? */
+ DRM_DEBUG("%d\n", ctx->handle);
+ if (ctx->handle == -1) {
+ DRM_DEBUG("Not enough free contexts.\n");
+ /* Should this return -EBUSY instead? */
return ENOMEM;
}
@@ -285,7 +285,7 @@ int drm_switchctx(struct drm_device *dev, void *data,
{
struct drm_ctx *ctx = data;
- DRM_DEBUG( "%d\n", ctx->handle );
+ DRM_DEBUG("%d\n", ctx->handle);
return drm_context_switch(dev, dev->last_context, ctx->handle);
}
@@ -293,7 +293,7 @@ int drm_newctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
struct drm_ctx *ctx = data;
- DRM_DEBUG( "%d\n", ctx->handle );
+ DRM_DEBUG("%d\n", ctx->handle);
drm_context_switch_complete(dev, ctx->handle);
return 0;
@@ -303,8 +303,8 @@ int drm_rmctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
struct drm_ctx *ctx = data;
- DRM_DEBUG( "%d\n", ctx->handle );
- if ( ctx->handle != DRM_KERNEL_CONTEXT ) {
+ DRM_DEBUG("%d\n", ctx->handle);
+ if (ctx->handle != DRM_KERNEL_CONTEXT) {
if (dev->driver->context_dtor) {
DRM_LOCK();
dev->driver->context_dtor(dev, ctx->handle);
diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c
index cdfb986c..51f60683 100644
--- a/bsd-core/drm_dma.c
+++ b/bsd-core/drm_dma.c
@@ -58,14 +58,12 @@ void drm_dma_takedown(struct drm_device *dev)
if (dma == NULL)
return;
- /* Clear dma buffers */
+ /* Clear dma buffers */
for (i = 0; i <= DRM_MAX_ORDER; i++) {
if (dma->bufs[i].seg_count) {
DRM_DEBUG("order %d: buf_count = %d,"
- " seg_count = %d\n",
- i,
- dma->bufs[i].buf_count,
- dma->bufs[i].seg_count);
+ " seg_count = %d\n", i, dma->bufs[i].buf_count,
+ dma->bufs[i].seg_count);
for (j = 0; j < dma->bufs[i].seg_count; j++) {
drm_pci_free(dev, dma->bufs[i].seglist[j]);
}
@@ -91,7 +89,8 @@ void drm_dma_takedown(struct drm_device *dev)
void drm_free_buffer(struct drm_device *dev, drm_buf_t *buf)
{
- if (!buf) return;
+ if (!buf)
+ return;
buf->pending = 0;
buf->file_priv= NULL;
@@ -103,7 +102,9 @@ void drm_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv)
drm_device_dma_t *dma = dev->dma;
int i;
- if (!dma) return;
+ if (!dma)
+ return;
+
for (i = 0; i < dma->buf_count; i++) {
if (dma->buflist[i]->file_priv == file_priv) {
switch (dma->buflist[i]->list) {
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index e5762cc4..9056c76c 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -393,7 +393,7 @@ static int drm_firstopen(struct drm_device *dev)
/* prebuild the SAREA */
i = drm_addmap(dev, 0, SAREA_MAX, _DRM_SHM,
- _DRM_CONTAINS_LOCK, &map);
+ _DRM_CONTAINS_LOCK, &map);
if (i != 0)
return i;
@@ -425,7 +425,7 @@ static int drm_firstopen(struct drm_device *dev)
dev->buf_pgid = 0;
#endif
- DRM_DEBUG( "\n" );
+ DRM_DEBUG("\n");
return 0;
}
@@ -438,7 +438,7 @@ static int drm_lastclose(struct drm_device *dev)
DRM_SPINLOCK_ASSERT(&dev->dev_lock);
- DRM_DEBUG( "\n" );
+ DRM_DEBUG("\n");
if (dev->driver->lastclose != NULL)
dev->driver->lastclose(dev);
@@ -446,14 +446,14 @@ static int drm_lastclose(struct drm_device *dev)
if (dev->irq_enabled)
drm_irq_uninstall(dev);
- if ( dev->unique ) {
+ if (dev->unique) {
free(dev->unique, M_DRM);
dev->unique = NULL;
dev->unique_len = 0;
}
/* Clear pid list */
- for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) {
- for ( pt = dev->magiclist[i].head ; pt ; pt = next ) {
+ for (i = 0; i < DRM_HASH_SIZE; i++) {
+ for (pt = dev->magiclist[i].head; pt; pt = next) {
next = pt->next;
free(pt, M_DRM);
}
@@ -464,15 +464,15 @@ static int drm_lastclose(struct drm_device *dev)
drm_drawable_free_all(dev);
DRM_LOCK();
- /* Clear AGP information */
- if ( dev->agp ) {
+ /* Clear AGP information */
+ if (dev->agp) {
drm_agp_mem_t *entry;
drm_agp_mem_t *nexte;
/* Remove AGP resources, but leave dev->agp intact until
* drm_unload is called.
*/
- for ( entry = dev->agp->memory ; entry ; entry = nexte ) {
+ for (entry = dev->agp->memory; entry; entry = nexte) {
nexte = entry->next;
if ( entry->bound )
drm_agp_unbind_memory(entry->handle);
@@ -498,7 +498,7 @@ static int drm_lastclose(struct drm_device *dev)
}
drm_dma_takedown(dev);
- if ( dev->lock.hw_lock ) {
+ if (dev->lock.hw_lock) {
dev->lock.hw_lock = NULL; /* SHM removed */
dev->lock.file_priv = NULL;
DRM_WAKEUP_INT((void *)&dev->lock.lock_queue);
@@ -511,7 +511,7 @@ static int drm_load(struct drm_device *dev)
{
int i, retcode;
- DRM_DEBUG( "\n" );
+ DRM_DEBUG("\n");
dev->irq = pci_get_irq(dev->device);
#if defined(__FreeBSD__) && __FreeBSD_version >= 700053
@@ -542,7 +542,7 @@ static int drm_load(struct drm_device *dev)
dev->types[4] = _DRM_STAT_LOCKS;
dev->types[5] = _DRM_STAT_UNLOCKS;
- for ( i = 0 ; i < DRM_ARRAY_SIZE(dev->counts) ; i++ )
+ for (i = 0; i < DRM_ARRAY_SIZE(dev->counts); i++)
atomic_set( &dev->counts[i], 0 );
if (dev->driver->load != NULL) {
@@ -587,11 +587,11 @@ static int drm_load(struct drm_device *dev)
}
DRM_INFO("Initialized %s %d.%d.%d %s\n",
- dev->driver->name,
- dev->driver->major,
- dev->driver->minor,
- dev->driver->patchlevel,
- dev->driver->date);
+ dev->driver->name,
+ dev->driver->major,
+ dev->driver->minor,
+ dev->driver->patchlevel,
+ dev->driver->date);
return 0;
@@ -619,7 +619,7 @@ static void drm_unload(struct drm_device *dev)
{
int i;
- DRM_DEBUG( "\n" );
+ DRM_DEBUG("\n");
#ifdef __FreeBSD__
drm_sysctl_cleanup(dev);
@@ -653,7 +653,7 @@ static void drm_unload(struct drm_device *dev)
dev->pcir[i] = NULL;
}
- if ( dev->agp ) {
+ if (dev->agp) {
free(dev->agp, M_DRM);
dev->agp = NULL;
}
@@ -713,17 +713,17 @@ int drm_open(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
dev = DRIVER_SOFTC(minor(kdev));
- DRM_DEBUG( "open_count = %d\n", dev->open_count );
+ DRM_DEBUG("open_count = %d\n", dev->open_count);
retcode = drm_open_helper(kdev, flags, fmt, p, dev);
- if ( !retcode ) {
+ if (!retcode) {
atomic_inc( &dev->counts[_DRM_STAT_OPENS] );
DRM_LOCK();
#ifdef __FreeBSD__
device_busy(dev->device);
#endif
- if ( !dev->open_count++ )
+ if (!dev->open_count++)
retcode = drm_firstopen(dev);
DRM_UNLOCK();
}
@@ -737,7 +737,7 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
drm_file_t *file_priv;
int retcode = 0;
- DRM_DEBUG( "open_count = %d\n", dev->open_count );
+ DRM_DEBUG("open_count = %d\n", dev->open_count);
DRM_LOCK();
@@ -759,11 +759,11 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
*/
#ifdef __FreeBSD__
- DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n",
- DRM_CURRENTPID, (long)dev->device, dev->open_count );
+ DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
+ DRM_CURRENTPID, (long)dev->device, dev->open_count);
#elif defined(__NetBSD__) || defined(__OpenBSD__)
- DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n",
- DRM_CURRENTPID, (long)&dev->device, dev->open_count);
+ DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
+ DRM_CURRENTPID, (long)&dev->device, dev->open_count);
#endif
if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)
@@ -785,7 +785,7 @@ int drm_close(struct cdev *kdev, int flags, int fmt, DRM_STRUCTPROC *p)
dev->lock.hw_lock != NULL) {
/* The lock is required to reclaim buffers */
for (;;) {
- if ( !dev->lock.hw_lock ) {
+ if (!dev->lock.hw_lock) {
/* Device has been unregistered */
retcode = EINTR;
break;
@@ -875,13 +875,13 @@ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
++file_priv->ioctl_count;
#ifdef __FreeBSD__
- DRM_DEBUG( "pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n",
+ DRM_DEBUG("pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n",
DRM_CURRENTPID, cmd, nr, (long)dev->device,
- file_priv->authenticated );
+ file_priv->authenticated);
#elif defined(__NetBSD__) || defined(__OpenBSD__)
- DRM_DEBUG( "pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n",
+ DRM_DEBUG("pid=%d, cmd=0x%02lx, nr=0x%02x, dev 0x%lx, auth=%d\n",
DRM_CURRENTPID, cmd, nr, (long)&dev->device,
- file_priv->authenticated );
+ file_priv->authenticated);
#endif
switch (cmd) {
@@ -933,7 +933,7 @@ int drm_ioctl(struct cdev *kdev, u_long cmd, caddr_t data, int flags,
func = ioctl->func;
if (func == NULL) {
- DRM_DEBUG( "no function\n" );
+ DRM_DEBUG("no function\n");
return EINVAL;
}
diff --git a/bsd-core/drm_ioctl.c b/bsd-core/drm_ioctl.c
index 26919982..0e996618 100644
--- a/bsd-core/drm_ioctl.c
+++ b/bsd-core/drm_ioctl.c
@@ -155,7 +155,7 @@ int drm_getmap(struct drm_device *dev, void *data, struct drm_file *file_priv)
}
TAILQ_FOREACH(mapinlist, &dev->maplist, link) {
- if (i==idx) {
+ if (i == idx) {
map->offset = mapinlist->offset;
map->size = mapinlist->size;
map->type = mapinlist->type;
@@ -186,8 +186,7 @@ int drm_getclient(struct drm_device *dev, void *data,
idx = client->idx;
DRM_LOCK();
TAILQ_FOREACH(pt, &dev->files, link) {
- if (i==idx)
- {
+ if (i == idx) {
client->auth = pt->authenticated;
client->pid = pt->pid;
client->uid = pt->uid;
diff --git a/bsd-core/drm_irq.c b/bsd-core/drm_irq.c
index 92861036..241908c7 100644
--- a/bsd-core/drm_irq.c
+++ b/bsd-core/drm_irq.c
@@ -49,7 +49,7 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
irq->irq = dev->irq;
DRM_DEBUG("%d:%d:%d => IRQ %d\n",
- irq->busnum, irq->devnum, irq->funcnum, irq->irq);
+ irq->busnum, irq->devnum, irq->funcnum, irq->irq);
return 0;
}
@@ -161,7 +161,7 @@ int drm_irq_install(struct drm_device *dev)
if (dev->irq == 0 || dev->dev_private == NULL)
return EINVAL;
- DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq );
+ DRM_DEBUG("irq=%d\n", dev->irq);
DRM_LOCK();
if (dev->irq_enabled) {
@@ -172,11 +172,11 @@ int drm_irq_install(struct drm_device *dev)
dev->context_flag = 0;
- /* Before installing handler */
+ /* Before installing handler */
dev->driver->irq_preinstall(dev);
DRM_UNLOCK();
- /* Install handler */
+ /* Install handler */
#ifdef __FreeBSD__
dev->irqrid = 0;
dev->irqr = bus_alloc_resource_any(dev->device, SYS_RES_IRQ,
@@ -209,7 +209,7 @@ int drm_irq_install(struct drm_device *dev)
}
#endif
- /* After installing handler */
+ /* After installing handler */
DRM_LOCK();
dev->driver->irq_postinstall(dev);
DRM_UNLOCK();
@@ -245,7 +245,7 @@ int drm_irq_uninstall(struct drm_device *dev)
dev->irqrid = 0;
#endif
- DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, dev->irq );
+ DRM_DEBUG("irq=%d\n", dev->irq);
dev->driver->irq_uninstall(dev);
@@ -267,7 +267,7 @@ int drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv)
struct drm_control *ctl = data;
int err;
- switch ( ctl->func ) {
+ switch (ctl->func) {
case DRM_INST_HANDLER:
/* Handle drivers whose DRM used to require IRQ setup but the
* no longer does.
@@ -367,7 +367,7 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,
DRM_DEBUG("num_crtcs=%d\n", dev->num_crtcs);
/* If drm_vblank_init() hasn't been called yet, just no-op */
if (!dev->num_crtcs)
- goto out;
+ goto out;
crtc = modeset->crtc;
DRM_DEBUG("crtc=%d\n", crtc);
@@ -435,7 +435,7 @@ int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_pr
ret = drm_vblank_get(dev, crtc);
if (ret)
- return ret;
+ return ret;
seq = drm_vblank_count(dev, crtc);
switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) {
@@ -512,7 +512,7 @@ void drm_vbl_send_signals(struct drm_device *dev, int crtc )
while (vbl_sig != NULL) {
drm_vbl_sig_t *next = TAILQ_NEXT(vbl_sig, link);
- if ( ( vbl_seq - vbl_sig->sequence ) <= (1<<23) ) {
+ if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) {
p = pfind(vbl_sig->pid);
if (p != NULL)
psignal(p, vbl_sig->signo);
diff --git a/bsd-core/drm_lock.c b/bsd-core/drm_lock.c
index 870874bb..523d0409 100644
--- a/bsd-core/drm_lock.c
+++ b/bsd-core/drm_lock.c
@@ -55,21 +55,23 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
do {
old = *lock;
- if (old & _DRM_LOCK_HELD) new = old | _DRM_LOCK_CONT;
- else new = context | _DRM_LOCK_HELD;
+ if (old & _DRM_LOCK_HELD)
+ new = old | _DRM_LOCK_CONT;
+ else
+ new = context | _DRM_LOCK_HELD;
} while (!atomic_cmpset_int(lock, old, new));
if (_DRM_LOCKING_CONTEXT(old) == context) {
if (old & _DRM_LOCK_HELD) {
if (context != DRM_KERNEL_CONTEXT) {
DRM_ERROR("%d holds heavyweight lock\n",
- context);
+ context);
}
return 0;
}
}
if (new == (context | _DRM_LOCK_HELD)) {
- /* Have lock */
+ /* Have lock */
return 1;
}
return 0;
@@ -84,8 +86,8 @@ int drm_lock_transfer(struct drm_device *dev,
dev->lock.file_priv = NULL;
do {
- old = *lock;
- new = context | _DRM_LOCK_HELD;
+ old = *lock;
+ new = context | _DRM_LOCK_HELD;
} while (!atomic_cmpset_int(lock, old, new));
return 1;
@@ -98,8 +100,8 @@ int drm_lock_free(struct drm_device *dev,
dev->lock.file_priv = NULL;
do {
- old = *lock;
- new = 0;
+ old = *lock;
+ new = 0;
} while (!atomic_cmpset_int(lock, old, new));
if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) {
@@ -113,22 +115,22 @@ int drm_lock_free(struct drm_device *dev,
int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
- struct drm_lock *lock = data;
- int ret = 0;
+ struct drm_lock *lock = data;
+ int ret = 0;
- if (lock->context == DRM_KERNEL_CONTEXT) {
- DRM_ERROR("Process %d using kernel context %d\n",
+ if (lock->context == DRM_KERNEL_CONTEXT) {
+ DRM_ERROR("Process %d using kernel context %d\n",
DRM_CURRENTPID, lock->context);
- return EINVAL;
- }
+ return EINVAL;
+ }
- DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
+ DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
lock->context, DRM_CURRENTPID, dev->lock.hw_lock->lock,
lock->flags);
if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) &&
lock->context < 0)
- return EINVAL;
+ return EINVAL;
DRM_LOCK();
for (;;) {
diff --git a/bsd-core/drm_scatter.c b/bsd-core/drm_scatter.c
index e26befc1..60d098c1 100644
--- a/bsd-core/drm_scatter.c
+++ b/bsd-core/drm_scatter.c
@@ -51,21 +51,21 @@ int drm_sg_alloc(struct drm_device * dev, struct drm_scatter_gather * request)
unsigned long pages;
int i;
- if ( dev->sg )
+ if (dev->sg)
return EINVAL;
entry = malloc(sizeof(*entry), M_DRM, M_WAITOK | M_ZERO);
- if ( !entry )
+ if (!entry)
return ENOMEM;
pages = round_page(request->size) / PAGE_SIZE;
- DRM_DEBUG( "sg size=%ld pages=%ld\n", request->size, pages );
+ DRM_DEBUG("sg size=%ld pages=%ld\n", request->size, pages);
entry->pages = pages;
entry->busaddr = malloc(pages * sizeof(*entry->busaddr), M_DRM,
M_WAITOK | M_ZERO);
- if ( !entry->busaddr ) {
+ if (!entry->busaddr) {
drm_sg_cleanup(entry);
return ENOMEM;
}
@@ -81,7 +81,7 @@ int drm_sg_alloc(struct drm_device * dev, struct drm_scatter_gather * request)
entry->busaddr[i] = vtophys(entry->handle + i * PAGE_SIZE);
}
- DRM_DEBUG( "sg alloc handle = %08lx\n", entry->handle );
+ DRM_DEBUG("sg alloc handle = %08lx\n", entry->handle);
entry->virtual = (void *)entry->handle;
request->handle = entry->handle;
@@ -104,7 +104,7 @@ int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
struct drm_scatter_gather *request = data;
int ret;
- DRM_DEBUG( "%s\n", __FUNCTION__ );
+ DRM_DEBUG("%s\n", __FUNCTION__);
ret = drm_sg_alloc(dev, request);
return ret;
@@ -120,10 +120,10 @@ int drm_sg_free(struct drm_device *dev, void *data, struct drm_file *file_priv)
dev->sg = NULL;
DRM_UNLOCK();
- if ( !entry || entry->handle != request->handle )
+ if (!entry || entry->handle != request->handle)
return EINVAL;
- DRM_DEBUG( "sg free virtual = 0x%lx\n", entry->handle );
+ DRM_DEBUG("sg free virtual = 0x%lx\n", entry->handle);
drm_sg_cleanup(entry);