gralloc: Fixup r8p1 gralloc to build for hikey

Apply some changes to the r8p1 gralloc code
to get it building for hikey and silence warnings.

Change-Id: Iaf8dfc13f7922d7ca850acacf2856a9302ed3f09
Signed-off-by: John Stultz <john.stultz@linaro.org>
diff --git a/gralloc/Android.mk b/gralloc/Android.mk
index 61ff7ff..7f682fc 100644
--- a/gralloc/Android.mk
+++ b/gralloc/Android.mk
@@ -31,22 +31,9 @@
 
 MALI_DDK_TEST_PATH := hardware/arm/
 
-LOCAL_MODULE := gralloc.default
+LOCAL_MODULE := gralloc.hikey
 #LOCAL_MODULE_TAGS := optional
 
-# Which DDK are we building for?
-ifeq (,$(wildcard $(MALI_DDK_TEST_PATH)))
-# Mali-T6xx DDK
-MALI_DDK_PATH := vendor/arm/mali6xx
-LOCAL_SHARED_LIBRARIES := liblog libcutils libGLESv1_CM libGLES_mali libion
-
-# All include files are accessed from the DDK root
-DDK_PATH := $(LOCAL_PATH)/../../..
-UMP_HEADERS_PATH := $(DDK_PATH)/kernel/include
-LOCAL_C_INCLUDES := $(DDK_PATH) $(UMP_HEADERS_PATH)
-
-LOCAL_CFLAGS := -DLOG_TAG=\"gralloc\" -DSTANDARD_LINUX_SCREEN -DMALI_600
-else
 # Mali-200/300/400MP DDK
 MALI_DDK_PATH := hardware/arm/mali
 #SHARED_MEM_LIBS := libUMP
@@ -58,7 +45,6 @@
 LOCAL_C_INCLUDES += $(MALI_DDK_PATH)/src/ump/include
 
 LOCAL_CFLAGS := -DLOG_TAG=\"gralloc\" -DGRALLOC_32_BITS -DSTANDARD_LINUX_SCREEN -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
-endif
 
 LOCAL_SRC_FILES := \
 	gralloc_module.cpp \
diff --git a/gralloc/alloc_device.cpp b/gralloc/alloc_device.cpp
index 1bb712f..ddd4194 100644
--- a/gralloc/alloc_device.cpp
+++ b/gralloc/alloc_device.cpp
@@ -568,7 +568,7 @@
 	return 0;
 }
 
-static int alloc_device_free(alloc_device_t *dev, buffer_handle_t handle)
+static int alloc_device_free(alloc_device_t __unused *dev, buffer_handle_t handle)
 {
 	if (private_handle_t::validate(handle) < 0)
 	{
@@ -606,8 +606,6 @@
 	else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION)
 	{
 #if GRALLOC_ARM_DMA_BUF_MODULE
-		private_module_t *m = reinterpret_cast<private_module_t *>(dev->common.module);
-
 		/* Buffer might be unregistered so we need to check for invalid ump handle*/
 		if (0 != hnd->base)
 		{
diff --git a/gralloc/gralloc_module.cpp b/gralloc/gralloc_module.cpp
index 20f833d..8405473 100644
--- a/gralloc/gralloc_module.cpp
+++ b/gralloc/gralloc_module.cpp
@@ -18,7 +18,9 @@
 
 #include <errno.h>
 #include <pthread.h>
-#include <sync/sync.h>
+#include <string.h>
+//#include <sync/sync.h>
+#include <android/sync.h>
 
 #include <cutils/log.h>
 #include <cutils/atomic.h>
@@ -136,7 +138,6 @@
 	else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION)
 	{
 #if GRALLOC_ARM_DMA_BUF_MODULE
-		int ret;
 		unsigned char *mappedAddress;
 		size_t size = hnd->size;
 		hw_module_t *pmodule = NULL;