display: Remove genlock usage

genlock is no-op from Android 4.2 onwards since the sync framework
is used for explicit synchronization.

Change-Id: Idd1df589516534a683e0fa1ef0cfbb7f0e411f67
diff --git a/libgenlock/genlock.cpp b/libgenlock/genlock.cpp
index 6f4ec6c..c606ecc 100644
--- a/libgenlock/genlock.cpp
+++ b/libgenlock/genlock.cpp
@@ -43,6 +43,7 @@
     int get_kernel_lock_type(genlock_lock_type lockType)
     {
         int kLockType = 0;
+#ifdef USE_GENLOCK
         // If the user sets both a read and write lock, higher preference is
         // given to the write lock.
         if (lockType & GENLOCK_WRITE_LOCK) {
@@ -54,6 +55,7 @@
                   __FUNCTION__, lockType);
             return -1;
         }
+#endif
         return kLockType;
     }
 
@@ -62,6 +64,7 @@
                                                    int lockType, int timeout,
                                                    int flags)
     {
+#ifdef USE_GENLOCK
         if (private_handle_t::validate(buffer_handle)) {
             ALOGE("%s: handle is invalid", __FUNCTION__);
             return GENLOCK_FAILURE;
@@ -104,6 +107,7 @@
             }
 #endif
         }
+#endif
         return GENLOCK_NO_ERROR;
     }
 
@@ -120,7 +124,6 @@
             handle = -1;
         }
     }
-
 }
 /*
  * Create a genlock lock. The genlock lock file descriptor and the lock
@@ -132,13 +135,13 @@
 genlock_status_t genlock_create_lock(native_handle_t *buffer_handle)
 {
     genlock_status_t ret = GENLOCK_NO_ERROR;
+#ifdef USE_GENLOCK
     if (private_handle_t::validate(buffer_handle)) {
         ALOGE("%s: handle is invalid", __FUNCTION__);
         return GENLOCK_FAILURE;
     }
 
     private_handle_t *hnd = reinterpret_cast<private_handle_t*>(buffer_handle);
-#ifdef USE_GENLOCK
     if ((hnd->flags & private_handle_t::PRIV_FLAGS_UNSYNCHRONIZED) == 0) {
         // Open the genlock device
         int fd = open(GENLOCK_DEVICE, O_RDWR);
@@ -173,8 +176,6 @@
     } else {
         hnd->genlockHandle = 0;
     }
-#else
-    hnd->genlockHandle = 0;
 #endif
     return ret;
 }