libgralloc: use proper types and type casts

- Use proper types for pointers
- Resolve compiler errors
- handle proper type casts
- remove unused variables

Change-Id: I628ebe174485d30abadea4ca40b67f9aab1a0652
This commit is contained in:
Arun Kumar K.R
2014-01-21 21:47:41 -08:00
parent 0bee628a02
commit 6c85f050b2
11 changed files with 99 additions and 83 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -114,16 +114,16 @@ int IonAlloc::alloc_buffer(alloc_data& data)
data.base = base;
data.fd = fd_data.fd;
ioctl(mIonFd, ION_IOC_FREE, &handle_data);
ALOGD_IF(DEBUG, "ion: Allocated buffer base:%p size:%d fd:%d",
ALOGD_IF(DEBUG, "ion: Allocated buffer base:%p size:%zu fd:%d",
data.base, ionAllocData.len, data.fd);
return 0;
}
int IonAlloc::free_buffer(void* base, size_t size, int offset, int fd)
int IonAlloc::free_buffer(void* base, size_t size, size_t offset, int fd)
{
Locker::Autolock _l(mLock);
ALOGD_IF(DEBUG, "ion: Freeing buffer base:%p size:%d fd:%d",
ALOGD_IF(DEBUG, "ion: Freeing buffer base:%p size:%zu fd:%d",
base, size, fd);
int err = 0;
err = open_device();
@@ -136,7 +136,7 @@ int IonAlloc::free_buffer(void* base, size_t size, int offset, int fd)
return err;
}
int IonAlloc::map_buffer(void **pBase, size_t size, int offset, int fd)
int IonAlloc::map_buffer(void **pBase, size_t size, size_t offset, int fd)
{
int err = 0;
void *base = 0;
@@ -154,15 +154,15 @@ int IonAlloc::map_buffer(void **pBase, size_t size, int offset, int fd)
ALOGE("ion: Failed to map memory in the client: %s",
strerror(errno));
} else {
ALOGD_IF(DEBUG, "ion: Mapped buffer base:%p size:%d offset:%d fd:%d",
ALOGD_IF(DEBUG, "ion: Mapped buffer base:%p size:%zu offset:%d fd:%d",
base, size, offset, fd);
}
return err;
}
int IonAlloc::unmap_buffer(void *base, size_t size, int offset)
int IonAlloc::unmap_buffer(void *base, size_t size, size_t /*offset*/)
{
ALOGD_IF(DEBUG, "ion: Unmapping buffer base:%p size:%d", base, size);
ALOGD_IF(DEBUG, "ion: Unmapping buffer base:%p size:%zu", base, size);
int err = 0;
if(munmap(base, size)) {
err = -errno;
@@ -172,12 +172,11 @@ int IonAlloc::unmap_buffer(void *base, size_t size, int offset)
return err;
}
int IonAlloc::clean_buffer(void *base, size_t size, int offset, int fd, int op)
int IonAlloc::clean_buffer(void *base, size_t size, size_t offset, int fd, int op)
{
struct ion_flush_data flush_data;
struct ion_fd_data fd_data;
struct ion_handle_data handle_data;
ion_user_handle_t handle;
int err = 0;
err = open_device();
@@ -195,8 +194,9 @@ int IonAlloc::clean_buffer(void *base, size_t size, int offset, int fd, int op)
handle_data.handle = fd_data.handle;
flush_data.handle = fd_data.handle;
flush_data.vaddr = base;
flush_data.offset = offset;
flush_data.length = size;
// offset and length are uint32_t
flush_data.offset = (uint32_t) offset;
flush_data.length = (uint32_t) size;
struct ion_custom_data d;
switch(op) {