pass: gov: Don't create the timer if timeout is zero
authorChanwoo Choi <cw00.choi@samsung.com>
Thu, 2 Feb 2017 10:59:14 +0000 (19:59 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Thu, 2 Feb 2017 23:43:19 +0000 (08:43 +0900)
This patch doesn't create the timer if timeout is zero.
if timerout of timer is zero, it means that this governor
don't need to use the timer for monitoring the resource status.

Change-Id: Ie56c5330b3ac3089a254ca067cb22c940ae3b234
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-gov.c

index 2bb038b..2b62584 100644 (file)
@@ -451,14 +451,18 @@ static void __pass_governor_start(struct pass_policy *policy)
        }
 
        /* Create the core timer of PASS governor */
-       policy->governor->gov_timer_id = ecore_timer_add(
+       if (policy->governor->gov_timeout > 0) {
+               policy->governor->gov_timer_id = ecore_timer_add(
                                policy->governor->gov_timeout,
                                (Ecore_Task_Cb)pass_governor_core_timer,
                                (void *)policy);
-       if (!policy->governor->gov_timer_id) {
-               _E("cannot add core timer for governor");
-               pass_governor_update(policy, PASS_GOV_STOP);
-               return;
+               if (!policy->governor->gov_timer_id) {
+                       _E("cannot add core timer for governor");
+                       pass_governor_update(policy, PASS_GOV_STOP);
+                       return;
+               }
+       } else {
+               policy->governor->gov_timer_id = NULL;
        }
 
        /*