pass: gov: Fix bug for governor state of each h/w resource 18/164618/2 accepted/tizen/unified/20171221.071205 submit/tizen/20171220.053323
authorChanwoo Choi <cw00.choi@samsung.com>
Wed, 20 Dec 2017 04:47:22 +0000 (13:47 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Wed, 20 Dec 2017 05:13:49 +0000 (14:13 +0900)
The commit 6133e7040ab49 ("pass: gov: Move private structure
from pass.h to pass-gov.h") moved the 'gov_state' variable
from 'struct pass_policy' to 'struct pass_governor'. It was wrong
because each pass_policy should contain the their own state of governor.
So, this patch moves the 'gov_state' variable to the 'struct pass_policy'.

Change-Id: I840c3ccf727ede1fc94de489b13c1703dc0d5d57
Fixes: 6133e7040ab49 ("pass: gov: Move private structure from pass.h to pass-gov.h")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-gov.c
src/pass/pass-gov.h
src/pass/pass.h

index aa511a970ba1a589adad066e2357ecd621afb472..19febfdbfac3762845225d542c1ec447f2ec7151 100644 (file)
@@ -51,7 +51,7 @@ struct pass_governor {
  */
 static bool is_enabled(struct pass_policy *policy)
 {
-       if (policy->governor->gov_state != PASS_GOV_START)
+       if (policy->gov_state != PASS_GOV_START)
                return false;
 
        return true;
@@ -348,7 +348,7 @@ static void __pass_governor_start(struct pass_resource *res)
        pass_rescon_set_level(res, policy->init_level);
 
        /* Set PASS state as PASS_GOV_START */
-       policy->governor->gov_state = PASS_GOV_START;
+       policy->gov_state = PASS_GOV_START;
 
        _I("Start governor for '%s' resource", cdata->res_name);
 }
@@ -367,7 +367,7 @@ static void __pass_governor_stop(struct pass_resource *res)
                return;
        }
 
-       if (policy->governor->gov_state == PASS_GOV_STOP) {
+       if (policy->gov_state == PASS_GOV_STOP) {
                _E("PASS governor is already inactive state");
                return;
        }
@@ -380,7 +380,7 @@ static void __pass_governor_stop(struct pass_resource *res)
        }
 
        /* Set PASS state as PASS_GOV_STOP */
-       policy->governor->gov_state = PASS_GOV_STOP;
+       policy->gov_state = PASS_GOV_STOP;
 
        _I("Stop governor for '%s' resource", cdata->res_name);
 }
@@ -397,7 +397,7 @@ static int __pass_governor_init(struct pass_resource *res)
        }
 
        /* Set default PASS state */
-       policy->governor->gov_state = PASS_GOV_STOP;
+       policy->gov_state = PASS_GOV_STOP;
        ret = pass_notifier_init(res);
        if (ret < 0) {
                _E("cannot initialize notifier for the pmqos (%d)\n", ret);
index f91e67815f27d7f5b1449a4a680ce59a65e7e5bc..8221898355bac9980a047dccf890dec77c80903b 100644 (file)
 #ifndef __PASS_GOV__
 #define __PASS_GOV__
 
-enum pass_gov_state {
-       PASS_GOV_NONE = 0,
-       PASS_GOV_START,
-       PASS_GOV_STOP,
-};
-
 /* Init, exit and update the governor */
 int pass_governor_init(struct pass_resource *res);
 int pass_governor_exit(struct pass_resource *res);
index e16420b4fb6f7115b2563db0b21345abeecd8b11..c5959fd7b54accbfc6649a197c4cfa5c2d89740f 100644 (file)
@@ -70,6 +70,12 @@ enum pass_gov_type {
        PASS_GOV_END,
 };
 
+enum pass_gov_state {
+       PASS_GOV_NONE = 0,
+       PASS_GOV_START,
+       PASS_GOV_STOP,
+};
+
 /******************************************************
  *                   PASS basic data                  *
  ******************************************************/
@@ -225,6 +231,7 @@ struct pass_pmqos {
 struct pass_policy {
        enum pass_state state;
        enum pass_gov_type gov_type;
+       enum pass_gov_state gov_state;
        unsigned int pass_cpu_threshold;
        unsigned int up_threshold;
        unsigned int down_threshold;