diff options
Diffstat (limited to 'src/wsbm_ttmpool.c')
-rw-r--r-- | src/wsbm_ttmpool.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/wsbm_ttmpool.c b/src/wsbm_ttmpool.c index ff132e0..5867428 100644 --- a/src/wsbm_ttmpool.c +++ b/src/wsbm_ttmpool.c @@ -217,16 +217,16 @@ pool_destroy(struct _WsbmBufStorage **buf) dBuf->virtual = NULL; } arg.handle = dBuf->kBuf.handle; - (void) drmCommandWrite(dBuf->buf.pool->fd, - ttmPool->devOffset + TTM_PL_UNREF, - &arg, sizeof(arg)); + (void)drmCommandWrite(dBuf->buf.pool->fd, + ttmPool->devOffset + TTM_PL_UNREF, + &arg, sizeof(arg)); WSBM_COND_FREE(&dBuf->event); wsbmBufStorageTakedown(&dBuf->buf); free(dBuf); } -static int +static int syncforcpu_locked(struct _WsbmBufStorage *buf, unsigned mode) { uint32_t kmode = 0; @@ -247,7 +247,7 @@ syncforcpu_locked(struct _WsbmBufStorage *buf, unsigned mode) if ((mode & WSBM_SYNCCPU_WRITE) && (++dBuf->writers == 1)) kmode |= TTM_PL_SYNCCPU_MODE_WRITE; - + if (kmode) { struct ttm_pl_synccpu_arg arg; @@ -256,7 +256,6 @@ syncforcpu_locked(struct _WsbmBufStorage *buf, unsigned mode) dBuf->syncInProgress = 1; - /* * This might be a lengthy wait, so * release the mutex. @@ -284,7 +283,7 @@ syncforcpu_locked(struct _WsbmBufStorage *buf, unsigned mode) return ret; } -static int +static int releasefromcpu_locked(struct _WsbmBufStorage *buf, unsigned mode) { uint32_t kmode = 0; @@ -300,7 +299,7 @@ releasefromcpu_locked(struct _WsbmBufStorage *buf, unsigned mode) if ((mode & WSBM_SYNCCPU_WRITE) && (--dBuf->writers == 0)) kmode |= TTM_PL_SYNCCPU_MODE_WRITE; - + if (kmode) { struct ttm_pl_synccpu_arg arg; @@ -311,7 +310,7 @@ releasefromcpu_locked(struct _WsbmBufStorage *buf, unsigned mode) DRMRESTARTCOMMANDWRITE(dBuf->buf.pool->fd, ttmPool->devOffset + TTM_PL_SYNCCPU, arg, ret); - } + } return ret; } @@ -320,22 +319,21 @@ static int pool_syncforcpu(struct _WsbmBufStorage *buf, unsigned mode) { int ret; - + WSBM_MUTEX_LOCK(&buf->mutex); ret = syncforcpu_locked(buf, mode); WSBM_MUTEX_UNLOCK(&buf->mutex); return ret; } - + static void -pool_releasefromcpu(struct _WsbmBufStorage *buf, unsigned mode) +pool_releasefromcpu(struct _WsbmBufStorage *buf, unsigned mode) { WSBM_MUTEX_LOCK(&buf->mutex); - (void) releasefromcpu_locked(buf, mode); + (void)releasefromcpu_locked(buf, mode); WSBM_MUTEX_UNLOCK(&buf->mutex); } - static int pool_map(struct _WsbmBufStorage *buf, unsigned mode, void **virtual) { @@ -343,7 +341,6 @@ pool_map(struct _WsbmBufStorage *buf, unsigned mode, void **virtual) void *virt; int ret = 0; - WSBM_MUTEX_LOCK(&buf->mutex); /* @@ -366,7 +363,7 @@ pool_map(struct _WsbmBufStorage *buf, unsigned mode, void **virtual) out_unlock: WSBM_MUTEX_UNLOCK(&buf->mutex); - + return ret; } |