pass: rescon: Move overriable property into pass_rescon struct 00/270600/3
authorChanwoo Choi <cw00.choi@samsung.com>
Sun, 6 Feb 2022 08:18:27 +0000 (17:18 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 7 Feb 2022 03:52:20 +0000 (12:52 +0900)
The 'overriable' property is used for only rescon module.
It means that be able to move 'overriable' property from struct pass_resource
to struct pass_rescon for more capsulation.

Change-Id: Icd63b1b25fb8dcb64fd1d9fd894d2b604f10ea22
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-parser.c
src/pass/pass-rescon.c
src/pass/pass.h

index 51ab817..e56821c 100644 (file)
@@ -874,8 +874,6 @@ static int parse_resource(struct pass *pass, json_object *obj)
 
                cur->init_data.memory.fault_around_bytes = -1;
 
-               cur->overridable = 1;
-
                ret = parse_resource_data(pass, i, resource_obj);
                if (ret < 0) {
                        _E("cannot parse of %dth resource in 'device_list' section\n", i);
@@ -965,6 +963,7 @@ int pass_parser_get_each_resource_config(struct pass_resource *res, char *path)
        res->rescon.min_level = INIT_VALUE;
        res->rescon.max_level = INIT_VALUE;
        res->rescon.init_scenario_level = INIT_VALUE;
+       res->rescon.overridable = 1;
 
        /* Initialize the CPUHP's data */
        cpuhp->pass_cpu_threshold = 0;
index c06c00d..35735d0 100644 (file)
@@ -149,7 +149,7 @@ static int rescon_update(struct pass_resource *res)
        int ret, i;
        int failed = 0;
 
-       if (!res->overridable)
+       if (!rescon->overridable)
                return 0;
 
        /*
@@ -349,7 +349,7 @@ static void rescon_set_scenario_level(struct pass_resource *res,
 {
        struct pass_rescon *rescon = &res->rescon;
 
-       if (scenario_level < 0 || !res->overridable)
+       if (scenario_level < 0 || !rescon->overridable)
                return;
 
        g_mutex_lock(&rescon->scenario_level_mutex);
@@ -364,7 +364,7 @@ static void rescon_unset_scenario_level(struct pass_resource *res,
 {
        struct pass_rescon *rescon = &res->rescon;
 
-       if (scenario_level < 0 || !res->overridable)
+       if (scenario_level < 0 || !rescon->overridable)
                return;
 
        g_mutex_lock(&rescon->scenario_level_mutex);
@@ -524,7 +524,7 @@ int pass_rescon_set_overridable(struct pass_resource *res, int overridable)
        if (!res)
                return -EINVAL;
 
-       res->overridable = overridable;
+       res->rescon.overridable = overridable;
 
        return 0;
 }
index 0b43ad6..dfb4c86 100644 (file)
@@ -287,6 +287,9 @@ struct pass_rescon {
        /** State of PASS_MODULE_RESCON */
        enum pass_state state;
 
+       /** Representing whether this resource can be overridden or not */
+       int overridable;
+
        /**
         * Initial level when initializing h/w resource by resource controller.
         * If value is -1, it is not initialized by parser.
@@ -637,9 +640,6 @@ struct pass_resource {
        struct pass_pmqos pmqos;
        /** Instance of PASS_MODULE_THERMAL module */
        struct pass_thermal thermal;
-
-       /** Representing whether this resource can be overridden or not */
-       int overridable;
 };
 
 /******************************************************