diff options
author | Thierry Strudel <thierry.strudel@intel.com> | 2014-07-14 23:25:29 -0700 |
---|---|---|
committer | Patrick Tjin <pattjin@google.com> | 2014-07-21 22:01:46 -0700 |
commit | 3795b36d0c937666a5bddc352c781d5e0beec26b (patch) | |
tree | 91cb81dad326da584a4fcbab5f14fd994b1e95c7 | |
parent | 47d6391038ba17c88a9432de198585c65da6249b (diff) | |
download | libwsbm-3795b36d0c937666a5bddc352c781d5e0beec26b.tar.gz |
AOSP cleanup: remove warnings and build errors for AOSP/L
BZ: 209178
Change-Id: I35bf0b32b66c4dc24d2c6a83aa7b8c0dd6e96995
Signed-off-by: Thierry Strudel <thierry.strudel@intel.com>
Reviewed-on: https://android.intel.com/217900
Reviewed-by: Imberton, Guilhem <guilhem.imberton@intel.com>
Tested-by: Imberton, Guilhem <guilhem.imberton@intel.com>
-rw-r--r-- | src/config.h | 3 | ||||
-rw-r--r-- | src/wsbm_driver.c | 6 | ||||
-rw-r--r-- | src/wsbm_fencemgr.c | 2 | ||||
-rw-r--r-- | src/wsbm_mallocpool.c | 22 | ||||
-rw-r--r-- | src/wsbm_manager.c | 10 | ||||
-rw-r--r-- | src/wsbm_slabpool.c | 22 | ||||
-rw-r--r-- | src/wsbm_ttmpool.c | 17 | ||||
-rw-r--r-- | src/wsbm_userpool.c | 8 |
8 files changed, 50 insertions, 40 deletions
diff --git a/src/config.h b/src/config.h index db26fd7..68cf913 100644 --- a/src/config.h +++ b/src/config.h @@ -10,6 +10,9 @@ /* Define to 1 if you have the <memory.h> header file. */ #define HAVE_MEMORY_H 1 +#ifdef ANDROID +#undef HAVE_PTHREADS +#endif /* "os has pthreads" */ #define HAVE_PTHREADS 1 diff --git a/src/wsbm_driver.c b/src/wsbm_driver.c index 98f846d..bb18737 100644 --- a/src/wsbm_driver.c +++ b/src/wsbm_driver.c @@ -62,19 +62,19 @@ n_condInit(struct _WsbmCond *cond, struct _WsbmThreadFuncs *func) } static void -n_mutexNone(struct _WsbmMutex *mutex) +n_mutexNone(struct _WsbmMutex *mutex __attribute__ ((unused))) { ; } static void -n_condNone(struct _WsbmCond *cond) +n_condNone(struct _WsbmCond *cond __attribute__ ((unused))) { ; } static void -n_condWait(struct _WsbmCond *cond, struct _WsbmMutex *mutex) +n_condWait(struct _WsbmCond *cond __attribute__ ((unused)), struct _WsbmMutex *mutex __attribute__ ((unused))) { ; } diff --git a/src/wsbm_fencemgr.c b/src/wsbm_fencemgr.c index 4010ac9..b7b3c39 100644 --- a/src/wsbm_fencemgr.c +++ b/src/wsbm_fencemgr.c @@ -456,7 +456,7 @@ wsbmFenceCmdUnlock(struct _WsbmFenceMgr *mgr, uint32_t fence_class) void wsbmFenceMgrTTMTakedown(struct _WsbmFenceMgr *mgr) { - int i; + unsigned int i; if (!mgr) return; diff --git a/src/wsbm_mallocpool.c b/src/wsbm_mallocpool.c index b5252d6..2f3d77d 100644 --- a/src/wsbm_mallocpool.c +++ b/src/wsbm_mallocpool.c @@ -54,7 +54,7 @@ mallocBuf(struct _WsbmBufStorage *buf) static struct _WsbmBufStorage * pool_create(struct _WsbmBufferPool *pool, - unsigned long size, uint32_t placement, unsigned alignment) + unsigned long size, uint32_t placement, unsigned alignment __attribute__ ((unused))) { struct _WsbmMallocBuffer *mBuf = malloc(size + sizeof(*mBuf) + 16); @@ -78,38 +78,38 @@ pool_destroy(struct _WsbmBufStorage **buf) } static int -pool_waitIdle(struct _WsbmBufStorage *buf, int lazy) +pool_waitIdle(struct _WsbmBufStorage *buf __attribute__ ((unused)), int lazy __attribute__ ((unused))) { return 0; } static int -pool_map(struct _WsbmBufStorage *buf, unsigned mode, void **virtual) +pool_map(struct _WsbmBufStorage *buf, unsigned mode __attribute__ ((unused)), void **virtual __attribute__ ((unused))) { *virtual = mallocBuf(buf)->mem; return 0; } static void -pool_unmap(struct _WsbmBufStorage *buf) +pool_unmap(struct _WsbmBufStorage *buf __attribute__ ((unused))) { ; } static int -pool_syncforcpu(struct _WsbmBufStorage *buf, unsigned mode) +pool_syncforcpu(struct _WsbmBufStorage *buf __attribute__ ((unused)), unsigned mode __attribute__ ((unused))) { return 0; } static void -pool_releasefromcpu(struct _WsbmBufStorage *buf, unsigned mode) +pool_releasefromcpu(struct _WsbmBufStorage *buf __attribute__ ((unused)), unsigned mode __attribute__ ((unused))) { ; } static unsigned long -pool_offset(struct _WsbmBufStorage *buf) +pool_offset(struct _WsbmBufStorage *buf __attribute__ ((unused))) { /* * BUG @@ -119,7 +119,7 @@ pool_offset(struct _WsbmBufStorage *buf) } static unsigned long -pool_poolOffset(struct _WsbmBufStorage *buf) +pool_poolOffset(struct _WsbmBufStorage *buf __attribute__ ((unused))) { /* * BUG @@ -128,7 +128,7 @@ pool_poolOffset(struct _WsbmBufStorage *buf) } static uint32_t -pool_placement(struct _WsbmBufStorage *buf) +pool_placement(struct _WsbmBufStorage *buf __attribute__ ((unused))) { return WSBM_PL_FLAG_SYSTEM | WSBM_PL_FLAG_CACHED; } @@ -140,13 +140,13 @@ pool_size(struct _WsbmBufStorage *buf) } static void -pool_fence(struct _WsbmBufStorage *buf, struct _WsbmFenceObject *fence) +pool_fence(struct _WsbmBufStorage *buf __attribute__ ((unused)), struct _WsbmFenceObject *fence __attribute__ ((unused))) { abort(); } static struct _WsbmKernelBuf * -pool_kernel(struct _WsbmBufStorage *buf) +pool_kernel(struct _WsbmBufStorage *buf __attribute__ ((unused))) { abort(); return NULL; diff --git a/src/wsbm_manager.c b/src/wsbm_manager.c index e95309d..e7c8f5d 100644 --- a/src/wsbm_manager.c +++ b/src/wsbm_manager.c @@ -256,7 +256,7 @@ static inline int wsbmPot(unsigned int val) { unsigned int shift = 0; - while(val > (1 << shift)) + while(val > (unsigned int)(1 << shift)) shift++; return shift; @@ -267,7 +267,7 @@ wsbmPot(unsigned int val) static int validateCreateList(int numTarget, struct _ValidateList *list, int driverData) { - int i; + unsigned int i; unsigned int shift = wsbmPot(numTarget); int ret; @@ -729,7 +729,7 @@ wsbmBODataUB(struct _WsbmBufferObject *buf, curPool = storage->pool; if (data) { - memcpy(user_ptr, data, size); + memcpy((unsigned long *) user_ptr, data, size); } out: @@ -971,7 +971,7 @@ wsbmGenBuffers(struct _WsbmBufferPool *pool, unsigned alignment, uint32_t placement) { struct _WsbmBufferObject *buf; - int i; + unsigned int i; placement = (placement) ? placement : WSBM_PL_FLAG_SYSTEM | WSBM_PL_FLAG_CACHED; @@ -994,7 +994,7 @@ wsbmGenBuffers(struct _WsbmBufferPool *pool, void wsbmDeleteBuffers(unsigned n, struct _WsbmBufferObject *buffers[]) { - int i; + unsigned int i; for (i = 0; i < n; ++i) { wsbmBOUnreference(&buffers[i]); diff --git a/src/wsbm_slabpool.c b/src/wsbm_slabpool.c index 56f7d65..658c9ed 100644 --- a/src/wsbm_slabpool.c +++ b/src/wsbm_slabpool.c @@ -323,7 +323,7 @@ wsbmAllocKernelBO(struct _WsbmSlabSizeHeader *header) * to efficiently reuse slabs. */ - size = (size <= slabPool->maxSlabSize) ? size : slabPool->maxSlabSize; + size = (size <= (uint32_t) slabPool->maxSlabSize) ? size : (uint32_t) slabPool->maxSlabSize; if (size < header->bufSize) size = header->bufSize; size = (size + slabPool->pageSize - 1) & ~(slabPool->pageSize - 1); @@ -449,8 +449,8 @@ wsbmAllocSlab(struct _WsbmSlabSizeHeader *header) struct _WsbmSlab *slab; struct _WsbmSlabBuffer *sBuf; uint32_t numBuffers; - int ret; - int i; + uint32_t ret; + uint32_t i; slab = calloc(1, sizeof(*slab)); if (!slab) @@ -546,7 +546,7 @@ wsbmSlabFreeBufferLocked(struct _WsbmSlabBuffer *buf) struct _WsbmSlabCache *cache = header->slabPool->cache; WSBMLISTFOREACHSAFE(list, next, &header->freeSlabs) { - int i; + uint32_t i; struct _WsbmSlabBuffer *sBuf; slab = WSBMLISTENTRY(list, struct _WsbmSlab, head); @@ -576,7 +576,7 @@ wsbmSlabCheckFreeLocked(struct _WsbmSlabSizeHeader *header, int wait) struct _WsbmSlab *slab; int firstWasSignaled = 1; int signaled; - int i; + uint32_t i; int ret; /* @@ -696,7 +696,7 @@ pool_create(struct _WsbmBufferPool *pool, unsigned long size, struct _WsbmSlabPool *slabPool = slabPoolFromPool(pool); struct _WsbmSlabSizeHeader *header; struct _WsbmSlabBuffer *sBuf; - int i; + uint32_t i; int ret; /* @@ -885,7 +885,7 @@ pool_waitIdle(struct _WsbmBufStorage *buf, int lazy) } static int -pool_map(struct _WsbmBufStorage *buf, unsigned mode, void **virtual) +pool_map(struct _WsbmBufStorage *buf, unsigned mode __attribute__ ((unused)), void **virtual) { struct _WsbmSlabBuffer *sBuf = slabBuffer(buf); @@ -895,7 +895,7 @@ pool_map(struct _WsbmBufStorage *buf, unsigned mode, void **virtual) } static void -pool_releaseFromCpu(struct _WsbmBufStorage *buf, unsigned mode) +pool_releaseFromCpu(struct _WsbmBufStorage *buf, unsigned mode __attribute__ ((unused))) { struct _WsbmSlabBuffer *sBuf = slabBuffer(buf); @@ -941,7 +941,7 @@ pool_syncForCpu(struct _WsbmBufStorage *buf, unsigned mode) } static void -pool_unmap(struct _WsbmBufStorage *buf) +pool_unmap(struct _WsbmBufStorage *buf __attribute__ ((unused))) { ; } @@ -1001,7 +1001,7 @@ pool_fence(struct _WsbmBufStorage *buf, struct _WsbmFenceObject *fence) static int pool_validate(struct _WsbmBufStorage *buf, - uint64_t set_flags, uint64_t clr_flags) + uint64_t set_flags __attribute__ ((unused)), uint64_t clr_flags __attribute__ ((unused))) { struct _WsbmSlabBuffer *sBuf = slabBuffer(buf); @@ -1119,7 +1119,7 @@ static void pool_takedown(struct _WsbmBufferPool *pool) { struct _WsbmSlabPool *slabPool = slabPoolFromPool(pool); - int i; + unsigned int i; for (i = 0; i < slabPool->numBuckets; ++i) { wsbmFinishSizeHeader(&slabPool->headers[i]); diff --git a/src/wsbm_ttmpool.c b/src/wsbm_ttmpool.c index 969e072..b40cc00 100644 --- a/src/wsbm_ttmpool.c +++ b/src/wsbm_ttmpool.c @@ -335,14 +335,20 @@ pool_releasefromcpu(struct _WsbmBufStorage *buf, unsigned mode) } #ifdef ANDROID + +/* No header but syscall provided by bionic */ +void* __mmap2(void*, size_t, int, int, int, size_t); +#define MMAP2_SHIFT 12 // 2**12 == 4096 + static void* _temp_mmap(void *addr, size_t size, int prot, int flags, int fd, long long offset) { - return __mmap2(addr, size, prot, flags, fd, (unsigned long)(offset >> PAGE_SHIFT)); + return __mmap2(addr, size, prot, flags, fd, (unsigned long)(offset >> MMAP2_SHIFT)); } + #endif static int -pool_map(struct _WsbmBufStorage *buf, unsigned mode, void **virtual) +pool_map(struct _WsbmBufStorage *buf, unsigned mode __attribute__ ((unused)), void **virtual) { struct _TTMBuffer *dBuf = ttmBuffer(buf); void *virt; @@ -381,7 +387,7 @@ pool_map(struct _WsbmBufStorage *buf, unsigned mode, void **virtual) } static void -pool_unmap(struct _WsbmBufStorage *buf) +pool_unmap(struct _WsbmBufStorage *buf __attribute__ ((unused))) { ; } @@ -395,7 +401,7 @@ pool_offset(struct _WsbmBufStorage *buf) } static unsigned long -pool_poolOffset(struct _WsbmBufStorage *buf) +pool_poolOffset(struct _WsbmBufStorage *buf __attribute__ ((unused))) { return 0; } @@ -417,7 +423,8 @@ pool_size(struct _WsbmBufStorage *buf) } static void -pool_fence(struct _WsbmBufStorage *buf, struct _WsbmFenceObject *fence) +pool_fence(struct _WsbmBufStorage *buf __attribute__ ((unused)), + struct _WsbmFenceObject *fence __attribute__ ((unused))) { /* * Noop. The kernel handles all fencing. diff --git a/src/wsbm_userpool.c b/src/wsbm_userpool.c index 9c7b79a..a4505fb 100644 --- a/src/wsbm_userpool.c +++ b/src/wsbm_userpool.c @@ -448,7 +448,7 @@ pool_destroy(struct _WsbmBufStorage **buf) } static int -pool_map(struct _WsbmBufStorage *buf, unsigned mode, void **virtual) +pool_map(struct _WsbmBufStorage *buf, unsigned mode __attribute__ ((unused)), void **virtual) { struct _WsbmUserBuffer *vBuf = userBuf(buf); @@ -457,13 +457,13 @@ pool_map(struct _WsbmBufStorage *buf, unsigned mode, void **virtual) } static void -pool_unmap(struct _WsbmBufStorage *buf) +pool_unmap(struct _WsbmBufStorage *buf __attribute__ ((unused))) { ; } static void -pool_releaseFromCpu(struct _WsbmBufStorage *buf, unsigned mode) +pool_releaseFromCpu(struct _WsbmBufStorage *buf, unsigned mode __attribute__ ((unused))) { struct _WsbmUserBuffer *vBuf = userBuf(buf); @@ -510,7 +510,7 @@ pool_offset(struct _WsbmBufStorage *buf) } static unsigned long -pool_poolOffset(struct _WsbmBufStorage *buf) +pool_poolOffset(struct _WsbmBufStorage *buf __attribute__ ((unused))) { return 0UL; } |