battery: fix usage of hal api 80/252780/1 accepted/tizen/unified/20210204.134646 submit/tizen/20210203.015309
authorYunmi Ha <yunmi.ha@samsung.com>
Tue, 2 Feb 2021 07:55:11 +0000 (16:55 +0900)
committerYunmi Ha <yunmi.ha@samsung.com>
Tue, 2 Feb 2021 07:55:11 +0000 (16:55 +0900)
Change-Id: I7492e3fc58ffe150450ff8ad70a0bd2b09783df4
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
src/battery.c

index 4e4add5..56d194a 100644 (file)
@@ -33,8 +33,6 @@
 
 #define BATTERY_FEATURE              "http://tizen.org/feature/battery"
 
-static bool hal_battery_loaded = false;
-
 static int is_battery_supported(void)
 {
        int ret;
@@ -165,14 +163,6 @@ int device_battery_get_info_direct(struct device_battery_info *info)
        if (!ret)
                return DEVICE_ERROR_NOT_SUPPORTED;
 
-       if (!hal_battery_loaded) {
-               ret = hal_device_battery_get_backend();
-               if (ret < 0)
-                       return DEVICE_ERROR_OPERATION_FAILED;
-
-               hal_battery_loaded = true;
-       }
-
        ret = hal_device_battery_get_current_state(battery_get_info, info);
        if (ret < 0) {
 //LCOV_EXCL_START System Error
@@ -342,5 +332,4 @@ int device_battery_get_status(device_battery_status_e *status)
 void __attribute__ ((destructor)) battery_finalize(void)
 {
        hal_device_battery_put_backend();
-       hal_battery_loaded = false;
 }