[Bugfix][T108][bug-view-1534]Fix the issue of multi-threaded API call errors

Only Configure: No
Affected branch: GSW_V1453
Affected module: system
Is it affected on IC: only ASR
Self-test: yes
Doc Update: no

Change-Id: I89b0fc98b13b5586e1aebd9c14ff69deaed28d04
diff --git a/mbtk/libgsw_lib/gsw_pm_interface.c b/mbtk/libgsw_lib/gsw_pm_interface.c
index 25acf7a..886a512 100755
--- a/mbtk/libgsw_lib/gsw_pm_interface.c
+++ b/mbtk/libgsw_lib/gsw_pm_interface.c
@@ -127,7 +127,7 @@
 static mbtk_lock_name_s lock_name[LOCK_MAX_SIZE]={0};

 

 static mbtk_log fun_ptr_log = NULL;

-void *dlHandle_sleep = NULL;

+static void *dlHandle_sleep = NULL;

 char *lynqLib_sleep = "/lib/libmbtk_lib.so";

 

 

@@ -161,12 +161,8 @@
     if(ret < 0)

     {

         LOGE("mbtk_autosuspend_enable FAIL.\n");

-        dlclose(dlHandle_sleep);

-        dlHandle_sleep = NULL;

         return GSW_HAL_NORMAL_FAIL;

     }

-    dlclose(dlHandle_sleep);

-    dlHandle_sleep = NULL;

     return GSW_HAL_SUCCESS;

 }

 

@@ -185,12 +181,8 @@
     if(ret < 0)

     {

         LOGE("mbtk_autosuspend_enable FAIL.\n");

-        dlclose(dlHandle_sleep);

-        dlHandle_sleep = NULL;

         return GSW_HAL_NORMAL_FAIL;

     }

-    dlclose(dlHandle_sleep);

-    dlHandle_sleep = NULL;

     return GSW_HAL_SUCCESS;

 }

 

@@ -209,8 +201,6 @@
     if(ret < 0)

     {

         LOGE("mbtk_lpm_init FAIL.\n");

-        dlclose(dlHandle_sleep);

-        dlHandle_sleep = NULL;

         return GSW_HAL_NORMAL_FAIL;

     }

     return GSW_HAL_SUCCESS;

@@ -248,8 +238,6 @@
     if(ret < 0)

     {

         LOGE("mbtk_wakelock_unlock FAIL.\n");

-        dlclose(dlHandle_sleep);

-        dlHandle_sleep = NULL;

         return GSW_HAL_NORMAL_FAIL;

     }

 

@@ -258,8 +246,6 @@
     if(ret < 0)

     {

         LOGE("mbtk_wakelock_destroy FAIL.\n");

-        dlclose(dlHandle_sleep);

-        dlHandle_sleep = NULL;

         return GSW_HAL_NORMAL_FAIL;

     }

     if (lock_name[i].name != NULL)

@@ -268,9 +254,6 @@
         lock_name[i].name = NULL;

         lock_name[i].fd = -1;

     }

-    

-    dlclose(dlHandle_sleep);

-    dlHandle_sleep = NULL;

     return GSW_HAL_SUCCESS;

 }

 

@@ -326,8 +309,6 @@
     lock_name[i].fd = lock_fd;

     ret = GSW_HAL_SUCCESS;

 end:

-    dlclose(dlHandle_sleep);

-    dlHandle_sleep = NULL;

     return ret;

 }