[Bugfix][T106BUG-220]qser_autosuspend_enable return is not 0

Only Configure: No
Affected branch: master
Affected module: autosuspend
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I0226550674289afd8e9e2ca2287a4848a0959979
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/include/lynq-qser-autosuspend.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/include/lynq-qser-autosuspend.h
index 54b663f..8ea9c01 100644
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/include/lynq-qser-autosuspend.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/include/lynq-qser-autosuspend.h
@@ -13,7 +13,9 @@
 
 #define E_READ -2
 #define E_WRITE -3
-#define E_INIT -4
+#define E_TABLE_FULL -4
+#define E_LOCK_EXIST -5
+#define E_INPUT_ERROR -6
 
 typedef enum 
 {
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp
index c037505..3ff2634 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-autosuspend/lynq-qser-autosuspend.cpp
@@ -6,11 +6,8 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <pthread.h>
-
 #include<unistd.h>
 
-
-
 #include <lynq_autosuspend.h>
 #include "lynq-qser-autosuspend.h"
 #include "liblog/lynq_deflog.h"
@@ -54,7 +51,7 @@
     {
         LYINFLOG("write fail\n");
         close(file_fd);
-        return -1;
+        return E_WRITE;
     }
     sync();
     close(file_fd);
@@ -75,7 +72,7 @@
         ret = lock_table_init();
         if(ret < 0)
         {
-            return -2;
+            return E_READ;
         }
     }
 
@@ -84,7 +81,7 @@
     {
         err = errno;
         LYINFLOG("Error open lock_table file:%s\n", strerror(errno));
-        return -2;
+        return E_READ;
     }
 
     memset(&lock_status, 0, sizeof(lock_status));
@@ -94,7 +91,7 @@
     if(ret <= 0)
     {
         close(file_fd);
-        return -2;
+        return E_READ;
     }
 
     for(i=0;i<MAX_LOCK_NUM;i++)
@@ -119,7 +116,7 @@
     {
         err = errno;
         LYINFLOG("Error open lock_table file:%s\n", strerror(errno));
-        return -3;
+        return E_WRITE;
     }
     LYINFLOG("write lock_name[0]: %s\n", lock_status.lock_name[0]);
     ret = write(file_fd, (unsigned char *)&lock_status, sizeof(lock_status));
@@ -128,7 +125,7 @@
     {
         LYINFLOG("write fail\n");
         close(file_fd);
-        return -3;
+        return E_WRITE;
     }
     sync();
     close(file_fd);
@@ -189,7 +186,7 @@
         }
         if(i == MAX_LOCK_NUM)
         {
-            return -1;
+            return E_TABLE_FULL;
         }
         else
         {
@@ -198,7 +195,7 @@
     }
     else
     {
-        num = check_flag;
+        return E_LOCK_EXIST;
     }
 
     LYINFLOG("num = %d\n", num);
@@ -255,6 +252,7 @@
     return 0;
 }
 
+
 int qser_autosuspend_enable(char enable)
 {
     int ret;
@@ -269,19 +267,24 @@
     }
     else
     {
-        ret = -1;
+        return E_INPUT_ERROR;
 
     }
+    if(ret >= 0)
+    {
+        ret = 0;
+    }
     return ret;
 
 }
 
+
 int qser_wakelock_create(const char *name, size_t len)
 {
     int ret;
     if(name == NULL)
     {
-        return -1;
+        return E_INPUT_ERROR;
     }
     LYINFLOG("%s\n", name);
     ret = add_lock(name);
@@ -294,7 +297,7 @@
     int ret;
     if(fd < 0 || fd >= MAX_LOCK_NUM)
     {
-        return -4;
+        return E_INPUT_ERROR;
     }
     ret = read_lock_table();
     ret = acquire_wake_lock( 0, lock_status.lock_name[fd]);
@@ -306,7 +309,7 @@
     int ret;
     if(fd < 0 || fd >= MAX_LOCK_NUM)
     {
-        return -4;
+        return E_INPUT_ERROR;
     }
     ret = read_lock_table();
     if(strlen(lock_status.lock_name[fd]) == 0)
@@ -323,7 +326,7 @@
     int ret;
     if(fd < 0 || fd >= MAX_LOCK_NUM)
     {
-        return -4;
+        return E_INPUT_ERROR;
     }
     ret = delete_lock(fd);
     return ret;