pass: Clean-up code to remove unneded prefix (pass_res -> res) 37/138637/1
authorChanwoo Choi <cw00.choi@samsung.com>
Thu, 13 Jul 2017 05:20:00 +0000 (14:20 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Thu, 13 Jul 2017 05:20:00 +0000 (14:20 +0900)
The pass core uses the 'pass_res' variable name to indicate the instance
of 'struct pass_resource'. 'pass_' prefix is not beneficial and not necessary.
This patch alters 'pass_res' to 'res' simply and use the 'res_type' name
insted of 'id' variable name in order to improve the understanding
what is meaning of variable.

Change-Id: Idf2a2a8ea1f48d1724d40dc50488097946113d57
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-gov.c
src/pass/pass-hal.c
src/pass/pass-hal.h
src/pass/pass-parser.c
src/pass/pass-pmqos.c
src/pass/pass.c

index fc5126a..c02e959 100644 (file)
@@ -101,7 +101,7 @@ static int pass_notifier_exit(struct pass_policy *policy)
 static void pass_hotplug_set_online(struct pass_policy *policy,
                                        unsigned int min_num)
 {
-       struct pass_resource *pass_res = to_pass_resource(policy);
+       struct pass_resource *res = to_pass_resource(policy);
        struct pass_hotplug *hotplug = policy->hotplug;
        int i;
 
@@ -111,14 +111,14 @@ static void pass_hotplug_set_online(struct pass_policy *policy,
        if (min_num > hotplug->num_cpus)
                min_num = hotplug->num_cpus;
 
-       pass_set_online_min_num(pass_res, min_num);
+       pass_set_online_min_num(res, min_num);
 
        for (i = 0 ; i < hotplug->num_cpus; i++) {
                if (i < min_num) {
-                       pass_set_online_state(pass_res, hotplug->sequence[i],
+                       pass_set_online_state(res, hotplug->sequence[i],
                                                PASS_CPU_UP);
                } else {
-                       pass_set_online_state(pass_res, hotplug->sequence[i],
+                       pass_set_online_state(res, hotplug->sequence[i],
                                                PASS_CPU_DOWN);
                }
        }
@@ -201,8 +201,8 @@ struct pass_hotplug* pass_get_hotplug(struct pass_policy *policy,
  */
 static int pass_governor_change_level(struct pass_policy *policy, int new_level)
 {
-       struct pass_resource *pass_res = to_pass_resource(policy);
-       struct pass_conf_data *cdata = &pass_res->cdata;
+       struct pass_resource *res = to_pass_resource(policy);
+       struct pass_conf_data *cdata = &res->cdata;
        struct pass_table *table = policy->pass_table;
        struct pass_hotplug *hotplug = policy->hotplug;
        int curr_level = policy->curr_level;
@@ -242,7 +242,7 @@ static int pass_governor_change_level(struct pass_policy *policy, int new_level)
 
        /* Set maximum frequency */
        if (limit_max_freq) {
-               ret = pass_set_max_freq(pass_res, limit_max_freq);
+               ret = pass_set_max_freq(res, limit_max_freq);
                if (ret < 0) {
                        _E("cannot set the maximum frequency of %s",
                                                cdata->res_name);
@@ -252,7 +252,7 @@ static int pass_governor_change_level(struct pass_policy *policy, int new_level)
 
        /* Set minimum frequency */
        if (limit_min_freq) {
-               ret = pass_set_min_freq(pass_res, limit_min_freq);
+               ret = pass_set_min_freq(res, limit_min_freq);
                if (ret < 0) {
                        _E("cannot set the minimum frequency of %s",
                                                cdata->res_name);
@@ -262,7 +262,7 @@ static int pass_governor_change_level(struct pass_policy *policy, int new_level)
 
        /*
        _I("[PASS %s] Level %4s '%d->%d' : 'max %d | min %d'Hz/'%d'Core\n",
-               pass_res->cdata.res_name,
+               res->cdata.res_name,
                (curr_level > new_level ? "DOWN" : "UP"),
                curr_level, new_level,
                limit_max_freq, limit_min_freq, limit_min_cpu);
index 87a6fdc..86c3fcb 100644 (file)
 
 #include "core/common.h"
 
-static struct pass_resource_dvfs_ops *get_dvfs(struct pass_resource *res, int id)
+static struct pass_resource_dvfs_ops *get_dvfs(struct pass_resource *res,
+                                               int res_type)
 {
        struct pass_resource_dvfs_ops *dvfs = NULL;
 
-       switch (id) {
+       switch (res_type) {
        case PASS_RESOURCE_CPU_ID:
                dvfs = &(res->hal.cpu->dvfs);
                break;
@@ -46,11 +47,12 @@ static struct pass_resource_dvfs_ops *get_dvfs(struct pass_resource *res, int id
        return dvfs;
 }
 
-static struct pass_resource_tmu_ops *get_tmu(struct pass_resource *res, int id)
+static struct pass_resource_tmu_ops *get_tmu(struct pass_resource *res,
+                                               int res_type)
 {
        struct pass_resource_tmu_ops *tmu = NULL;
 
-       switch (id) {
+       switch (res_type) {
        case PASS_RESOURCE_CPU_ID:
                tmu = &(res->hal.cpu->tmu);
                break;
@@ -66,11 +68,11 @@ static struct pass_resource_tmu_ops *get_tmu(struct pass_resource *res, int id)
 }
 
 static struct pass_resource_hotplug_ops *get_hotplug(struct pass_resource *res,
-                                               int id)
+                                               int res_type)
 {
        struct pass_resource_hotplug_ops *hotplug = NULL;
 
-       switch (id) {
+       switch (res_type) {
        case PASS_RESOURCE_CPU_ID:
                hotplug = &(res->hal.cpu->hotplug);
                break;
@@ -88,15 +90,15 @@ int pass_get_curr_governor(struct pass_resource *res, char *governor)
 {
        struct pass_resource_dvfs_ops *dvfs;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res || !governor)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       dvfs = get_dvfs(res, id);
+       dvfs = get_dvfs(res, res_type);
        if (!dvfs)
                return -EINVAL;
 
@@ -110,15 +112,15 @@ int pass_set_curr_governor(struct pass_resource *res, char *governor)
 {
        struct pass_resource_dvfs_ops *dvfs;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       dvfs = get_dvfs(res, id);
+       dvfs = get_dvfs(res, res_type);
        if (!dvfs)
                return -EINVAL;
 
@@ -133,15 +135,15 @@ int pass_get_curr_freq(struct pass_resource *res)
 {
        struct pass_resource_dvfs_ops *dvfs;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       dvfs = get_dvfs(res, id);
+       dvfs = get_dvfs(res, res_type);
        if (!dvfs)
                return -EINVAL;
 
@@ -156,15 +158,15 @@ int pass_get_min_freq(struct pass_resource *res)
 {
        struct pass_resource_dvfs_ops *dvfs;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       dvfs = get_dvfs(res, id);
+       dvfs = get_dvfs(res, res_type);
        if (!dvfs)
                return -EINVAL;
 
@@ -178,15 +180,15 @@ int pass_set_min_freq(struct pass_resource *res, int freq)
 {
        struct pass_resource_dvfs_ops *dvfs;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res || freq <= 0)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       dvfs = get_dvfs(res, id);
+       dvfs = get_dvfs(res, res_type);
        if (!dvfs)
                return -EINVAL;
 
@@ -200,15 +202,15 @@ int pass_get_max_freq(struct pass_resource *res)
 {
        struct pass_resource_dvfs_ops *dvfs;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       dvfs = get_dvfs(res, id);
+       dvfs = get_dvfs(res, res_type);
        if (!dvfs)
                return -EINVAL;
 
@@ -222,15 +224,15 @@ int pass_set_max_freq(struct pass_resource *res, int freq)
 {
        struct pass_resource_dvfs_ops *dvfs;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res || freq <= 0)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       dvfs = get_dvfs(res, id);
+       dvfs = get_dvfs(res, res_type);
        if (!dvfs)
                return -EINVAL;
 
@@ -245,15 +247,15 @@ int pass_get_up_threshold(struct pass_resource *res)
 {
        struct pass_resource_dvfs_ops *dvfs;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       dvfs = get_dvfs(res, id);
+       dvfs = get_dvfs(res, res_type);
        if (!dvfs)
                return -EINVAL;
 
@@ -267,15 +269,15 @@ int pass_set_up_threshold(struct pass_resource *res, int up_threshold)
 {
        struct pass_resource_dvfs_ops *dvfs;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res || up_threshold <= 0)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       dvfs = get_dvfs(res, id);
+       dvfs = get_dvfs(res, res_type);
        if (!dvfs)
                return -EINVAL;
 
@@ -290,15 +292,15 @@ int pass_get_online_state(struct pass_resource *res, int cpu)
 {
        struct pass_resource_hotplug_ops *hotplug;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       hotplug = get_hotplug(res, id);
+       hotplug = get_hotplug(res, res_type);
        if (!hotplug)
                return -EINVAL;
 
@@ -312,15 +314,15 @@ int pass_set_online_state(struct pass_resource *res, int cpu, int on)
 {
        struct pass_resource_hotplug_ops *hotplug;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res || on < 0)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       hotplug = get_hotplug(res, id);
+       hotplug = get_hotplug(res, res_type);
        if (!hotplug)
                return -EINVAL;
 
@@ -334,15 +336,15 @@ int pass_get_online_min_num(struct pass_resource *res)
 {
        struct pass_resource_hotplug_ops *hotplug;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       hotplug = get_hotplug(res, id);
+       hotplug = get_hotplug(res, res_type);
        if (!hotplug)
                return -EINVAL;
 
@@ -356,15 +358,15 @@ int pass_set_online_min_num(struct pass_resource *res, int num)
 {
        struct pass_resource_hotplug_ops *hotplug;
        char *res_name;
-       int id;
+       int res_type;
 
        if ((!res) || (num < 0))
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       hotplug = get_hotplug(res, id);
+       hotplug = get_hotplug(res, res_type);
        if (!hotplug)
                return -EINVAL;
 
@@ -378,15 +380,15 @@ int pass_get_online_max_num(struct pass_resource *res)
 {
        struct pass_resource_hotplug_ops *hotplug;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       hotplug = get_hotplug(res, id);
+       hotplug = get_hotplug(res, res_type);
        if (!hotplug)
                return -EINVAL;
 
@@ -400,15 +402,15 @@ int pass_set_online_max_num(struct pass_resource *res, int num)
 {
        struct pass_resource_hotplug_ops *hotplug;
        char *res_name;
-       int id;
+       int res_type;
 
        if ((!res) || (num < 0))
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       hotplug = get_hotplug(res, id);
+       hotplug = get_hotplug(res, res_type);
        if (!hotplug)
                return -EINVAL;
 
@@ -423,7 +425,7 @@ int pass_get_temp(struct pass_resource *res)
 {
        struct pass_resource_tmu_ops *tmu;
        char *res_thermal_name;
-       int id;
+       int res_type;
 
        if (!res)
                return -EINVAL;
@@ -434,9 +436,9 @@ int pass_get_temp(struct pass_resource *res)
         * instead of res_name.
         */
        res_thermal_name = res->cdata.res_thermal_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       tmu = get_tmu(res, id);
+       tmu = get_tmu(res, res_type);
        if (!tmu)
                return -EINVAL;
 
@@ -450,7 +452,7 @@ int pass_get_tmu_policy(struct pass_resource *res, char *policy)
 {
        struct pass_resource_tmu_ops *tmu;
        char *res_thermal_name;
-       int id;
+       int res_type;
 
        if (!res)
                return -EINVAL;
@@ -461,9 +463,9 @@ int pass_get_tmu_policy(struct pass_resource *res, char *policy)
         * instead of res_name.
         */
        res_thermal_name = res->cdata.res_thermal_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       tmu = get_tmu(res, id);
+       tmu = get_tmu(res, res_type);
        if (!tmu)
                return -EINVAL;
 
@@ -477,15 +479,15 @@ int pass_set_pmqos_data(struct pass_resource *res, void *data)
 {
        struct pass_resource_nonstandard *nonstandard = NULL;
        char *res_name;
-       int id;
+       int res_type;
 
        if (!res)
                return -EINVAL;
 
        res_name = res->cdata.res_name;
-       id = res->cdata.res_type;
+       res_type = res->cdata.res_type;
 
-       switch (id) {
+       switch (res_type) {
        case PASS_RESOURCE_NONSTANDARD_ID:
                nonstandard  = (res->hal.nonstandard);
                break;
@@ -499,9 +501,9 @@ int pass_set_pmqos_data(struct pass_resource *res, void *data)
        return nonstandard->set_pmqos_data(res_name, data);
 }
 
-int pass_get_resource(struct pass_resource *pass_res)
+int pass_get_resource(struct pass_resource *res)
 {
-       struct pass_conf_data *cdata = &pass_res->cdata;
+       struct pass_conf_data *cdata = &res->cdata;
        struct pass_resource_info *info;
        char *res_name = cdata->res_name;
        char name[BUFF_MAX];
@@ -550,19 +552,19 @@ int pass_get_resource(struct pass_resource *pass_res)
        switch (res_type) {
        case PASS_RESOURCE_CPU_ID:
                ret = info->open(res_name, info,
-                       (struct pass_resource_common**)&pass_res->hal.cpu);
+                       (struct pass_resource_common**)&res->hal.cpu);
                break;
        case PASS_RESOURCE_BUS_ID:
                ret = info->open(res_name, info,
-                       (struct pass_resource_common**)&pass_res->hal.bus);
+                       (struct pass_resource_common**)&res->hal.bus);
                break;
        case PASS_RESOURCE_GPU_ID:
                ret = info->open(res_name, info,
-                       (struct pass_resource_common**)&pass_res->hal.gpu);
+                       (struct pass_resource_common**)&res->hal.gpu);
                break;
        case PASS_RESOURCE_NONSTANDARD_ID:
                ret = info->open(res_name, info,
-                       (struct pass_resource_common**)&pass_res->hal.nonstandard);
+                       (struct pass_resource_common**)&res->hal.nonstandard);
                break;
        };
 
@@ -575,9 +577,9 @@ int pass_get_resource(struct pass_resource *pass_res)
        return 0;
 }
 
-int pass_put_resource(struct pass_resource *pass_res)
+int pass_put_resource(struct pass_resource *res)
 {
-       struct pass_conf_data *cdata = &pass_res->cdata;
+       struct pass_conf_data *cdata = &res->cdata;
        struct pass_resource_common *common;
        struct pass_resource_info *info;
        char *res_name = cdata->res_name;
@@ -586,23 +588,23 @@ int pass_put_resource(struct pass_resource *pass_res)
 
        switch (res_type) {
        case PASS_RESOURCE_CPU_ID:
-               common = (struct pass_resource_common*)pass_res->hal.cpu;
-               info = pass_res->hal.cpu->common.info;
+               common = (struct pass_resource_common*)res->hal.cpu;
+               info = res->hal.cpu->common.info;
                ret = info->close(res_name, common);
                break;
        case PASS_RESOURCE_BUS_ID:
-               common = (struct pass_resource_common*)pass_res->hal.bus;
-               info = pass_res->hal.bus->common.info;
+               common = (struct pass_resource_common*)res->hal.bus;
+               info = res->hal.bus->common.info;
                ret = info->close(res_name, common);
                break;
        case PASS_RESOURCE_GPU_ID:
-               common = (struct pass_resource_common*)pass_res->hal.gpu;
-               info = pass_res->hal.gpu->common.info;
+               common = (struct pass_resource_common*)res->hal.gpu;
+               info = res->hal.gpu->common.info;
                ret = info->close(res_name, common);
                break;
        case PASS_RESOURCE_NONSTANDARD_ID:
-               common = (struct pass_resource_common*)pass_res->hal.nonstandard;
-               info = pass_res->hal.nonstandard->common.info;
+               common = (struct pass_resource_common*)res->hal.nonstandard;
+               info = res->hal.nonstandard->common.info;
                ret = info->close(res_name, common);
        default:
                return -EINVAL;
@@ -628,7 +630,7 @@ int pass_put_resource(struct pass_resource *pass_res)
 int pass_get_cpu_stats(struct pass_policy *policy)
 {
        struct pass_cpu_stats *stats;
-       struct pass_resource *pass_res;
+       struct pass_resource *res;
        char str[BUFF_MAX];
        FILE *fp_stats = NULL;
        int i, j, ret;
@@ -637,14 +639,14 @@ int pass_get_cpu_stats(struct pass_policy *policy)
                return -EINVAL;
 
        stats = policy->pass_cpu_stats;
-       pass_res = to_pass_resource(policy);
+       res = to_pass_resource(policy);
 
        if (!stats) {
                _E("invalid parameter of structure pass_cpu_stats");
                return -EINVAL;
        }
 
-       fp_stats = fopen(pass_res->cdata.path_load_table, "r");
+       fp_stats = fopen(res->cdata.path_load_table, "r");
        if (fp_stats == NULL)
                return -EIO;
 
@@ -665,7 +667,7 @@ int pass_get_cpu_stats(struct pass_policy *policy)
                        return -EIO;
                }
 
-               for (j = 0; j < pass_res->cdata.num_cpus; j++) {
+               for (j = 0; j < res->cdata.num_cpus; j++) {
                        ret = fscanf(fp_stats, "%d", &stats[i].load[j]);
                        if (ret < 0) {
                                fclose(fp_stats);
index 746bc81..5366738 100644 (file)
@@ -26,8 +26,8 @@
  * Functions for all H/W resources
  */
 /* Get and put the h/w resource. */
-int pass_get_resource(struct pass_resource *pass_res);
-int pass_put_resource(struct pass_resource *pass_res);
+int pass_get_resource(struct pass_resource *res);
+int pass_put_resource(struct pass_resource *res);
 
 /***
  * Functions for CPU/BUS/GPU H/W resources
index 1221e90..0be37d9 100644 (file)
@@ -337,113 +337,113 @@ int pass_get_table(struct pass_policy *policy, char *pass_conf_path)
        }
 
        /*
-       struct pass_resource *pass_res = to_pass_resource(policy);
+       struct pass_resource *res = to_pass_resource(policy);
        int level;
 
        _I("%s| policy->state : %d\n",
-                       pass_res->cdata.res_name, policy->state);
+                       res->cdata.res_name, policy->state);
        _I("%s| policy->gov_type : %d\n",
-                       pass_res->cdata.res_name, policy->gov_type);
+                       res->cdata.res_name, policy->gov_type);
        _I("%s| policy->num_levels : %d\n",
-                       pass_res->cdata.res_name, policy->num_levels);
+                       res->cdata.res_name, policy->num_levels);
        _I("%s| policy->min_level : %d\n",
-                       pass_res->cdata.res_name, policy->min_level);
+                       res->cdata.res_name, policy->min_level);
        _I("%s| policy->max_level : %d\n",
-                       pass_res->cdata.res_name, policy->max_level);
+                       res->cdata.res_name, policy->max_level);
        _I("%s| policy->num_pass_cpu_stats : %d\n",
-                       pass_res->cdata.res_name, policy->num_pass_cpu_stats);
+                       res->cdata.res_name, policy->num_pass_cpu_stats);
        _I("%s| policy->pass_cpu_threshold : %d\n",
-                       pass_res->cdata.res_name, policy->pass_cpu_threshold);
+                       res->cdata.res_name, policy->pass_cpu_threshold);
        _I("%s| policy->up_threshold : %d\n",
-                       pass_res->cdata.res_name, policy->up_threshold);
+                       res->cdata.res_name, policy->up_threshold);
        _I("%s| policy->down_threshold : %d\n",
-                       pass_res->cdata.res_name, policy->down_threshold);
+                       res->cdata.res_name, policy->down_threshold);
        _I("%s| policy->init_level : %d\n",
-                       pass_res->cdata.res_name, policy->init_level);
+                       res->cdata.res_name, policy->init_level);
        _I("%s| policy->level_up_threshold : %d\n",
-                       pass_res->cdata.res_name, policy->level_up_threshold);
+                       res->cdata.res_name, policy->level_up_threshold);
        _I("%s| policy->gov_timeout : %f\n",
-                       pass_res->cdata.res_name, policy->gov_timeout);
+                       res->cdata.res_name, policy->gov_timeout);
 
        for (level = 0; level < policy->num_levels; level++) {
                _I("================================================\n");
                if (policy->pass_table[level].limit_max_freq)
                        _I("%s| policy->pass_table[%d].limit_max_freq : %d\n",
-                               pass_res->cdata.res_name, level,
+                               res->cdata.res_name, level,
                                policy->pass_table[level].limit_max_freq);
                if (policy->pass_table[level].limit_min_freq)
                        _I("%s| policy->pass_table[%d].limit_min_freq : %d\n",
-                               pass_res->cdata.res_name, level,
+                               res->cdata.res_name, level,
                                policy->pass_table[level].limit_min_freq);
                if (policy->pass_table[level].limit_min_cpu)
                        _I("%s| policy->pass_table[%d].limit_min_cpu : %d\n",
-                               pass_res->cdata.res_name, level,
+                               res->cdata.res_name, level,
                                policy->pass_table[level].limit_min_cpu);
                if (policy->pass_table[level].gov_timeout)
                        _I("%s| policy->pass_table[%d].gov_timeout : %f\n",
-                               pass_res->cdata.res_name, level,
+                               res->cdata.res_name, level,
                                policy->pass_table[level].gov_timeout);
 
                if (policy->pass_table[level].num_down_cond)
                        _I("%s| policy->pass_table[%d].num_down_cond : %d\n",
-                               pass_res->cdata.res_name, level,
+                               res->cdata.res_name, level,
                                policy->pass_table[level].num_down_cond);
                if (policy->pass_table[level].down_cond[0].freq)
                        _I("%s| policy->pass_table[%d].down_cond[0].freq : %d\n",
-                               pass_res->cdata.res_name, level,
+                               res->cdata.res_name, level,
                                policy->pass_table[level].down_cond[0].freq);
                if (policy->pass_table[level].down_cond[0].nr_running)
                        _I("%s| policy->pass_table[%d].down_cond[0].nr_running : %d\n",
-                               pass_res->cdata.res_name, level,
+                               res->cdata.res_name, level,
                                policy->pass_table[level].down_cond[0].nr_running);
                if (policy->pass_table[level].down_cond[0].busy_cpu)
                        _I("%s| policy->pass_table[%d].down_cond[0].busy_cpu : %d\n",
-                               pass_res->cdata.res_name, level,
+                               res->cdata.res_name, level,
                                policy->pass_table[level].down_cond[0].busy_cpu);
 
                if (policy->pass_table[level].num_up_cond)
                        _I("%s| policy->pass_table[%d].num_up_cond : %d\n",
-                               pass_res->cdata.res_name, level,
+                               res->cdata.res_name, level,
                                policy->pass_table[level].num_up_cond);
                if (policy->pass_table[level].up_cond[0].freq)
                        _I("%s| policy->pass_table[%d].up_cond[0].freq : %d\n",
-                               pass_res->cdata.res_name, level,
+                               res->cdata.res_name, level,
                                policy->pass_table[level].up_cond[0].freq);
                if (policy->pass_table[level].up_cond[0].nr_running)
                        _I("%s| policy->pass_table[%d].up_cond[0].nr_running : %d\n",
-                               pass_res->cdata.res_name, level,
+                               res->cdata.res_name, level,
                                policy->pass_table[level].up_cond[0].nr_running);
                if (policy->pass_table[level].up_cond[0].busy_cpu)
                        _I("%s| policy->pass_table[%d].up_cond[0].busy_cpu : %d\n",
-                               pass_res->cdata.res_name, level,
+                               res->cdata.res_name, level,
                                policy->pass_table[level].up_cond[0].busy_cpu);
 
                if (policy->pass_table[level].num_left_cond)
                        _I("%s| policy->pass_table[%d].num_left_cond : %d\n",
-                               pass_res->cdata.res_name, level,
+                               res->cdata.res_name, level,
                                policy->pass_table[level].num_left_cond);
                if (policy->pass_table[level].left_cond[0].freq)
                        _I("%s| policy->pass_table[%d].left_cond[0].freq : %d\n",
-                               pass_res->cdata.res_name, level, policy->pass_table[level].left_cond[0].freq);
+                               res->cdata.res_name, level, policy->pass_table[level].left_cond[0].freq);
                if (policy->pass_table[level].left_cond[0].nr_running)
                        _I("%s| policy->pass_table[%d].left_cond[0].nr_running : %d\n",
-                               pass_res->cdata.res_name, level, policy->pass_table[level].left_cond[0].nr_running);
+                               res->cdata.res_name, level, policy->pass_table[level].left_cond[0].nr_running);
                if (policy->pass_table[level].left_cond[0].busy_cpu)
                        _I("%s| policy->pass_table[%d].left_cond[0].busy_cpu : %d\n",
-                               pass_res->cdata.res_name, level, policy->pass_table[level].left_cond[0].busy_cpu);
+                               res->cdata.res_name, level, policy->pass_table[level].left_cond[0].busy_cpu);
 
                if (policy->pass_table[level].num_right_cond)
                        _I("%s| policy->pass_table[%d].num_right_cond : %d\n",
-                               pass_res->cdata.res_name, level, policy->pass_table[level].num_right_cond);
+                               res->cdata.res_name, level, policy->pass_table[level].num_right_cond);
                if (policy->pass_table[level].right_cond[0].freq)
                        _I("%s| policy->pass_table[%d].right_cond[0].freq : %d\n",
-                               pass_res->cdata.res_name, level, policy->pass_table[level].right_cond[0].freq);
+                               res->cdata.res_name, level, policy->pass_table[level].right_cond[0].freq);
                if (policy->pass_table[level].right_cond[0].nr_running)
                        _I("%s| policy->pass_table[%d].right_cond[0].nr_running : %d\n",
-                               pass_res->cdata.res_name, level, policy->pass_table[level].right_cond[0].nr_running);
+                               res->cdata.res_name, level, policy->pass_table[level].right_cond[0].nr_running);
                if (policy->pass_table[level].right_cond[0].busy_cpu)
                        _I("%s| policy->pass_table[%d].right_cond[0].busy_cpu : %d\n",
-                               pass_res->cdata.res_name, level, policy->pass_table[level].right_cond[0].busy_cpu);
+                               res->cdata.res_name, level, policy->pass_table[level].right_cond[0].busy_cpu);
        }
        */
 
@@ -503,9 +503,9 @@ static int  pass_parse_resource_data(struct parse_result *result,
        } else if (MATCH(result->name, "pass_path_load_table")) {
                snprintf(conf_data->path_load_table, PASS_NAME_LEN, "%s", result->value);
        } else if (MATCH(result->name, "pass_first_cpu")) {
-               int pass_res_type = conf_data->res_type;
+               int res_type = conf_data->res_type;
 
-               switch (pass_res_type) {
+               switch (res_type) {
                case PASS_RESOURCE_CPU_ID:
                        conf_data->cpu = atoi(result->value);
                        break;
@@ -513,9 +513,9 @@ static int  pass_parse_resource_data(struct parse_result *result,
                        return -EINVAL;
                };
        } else if (MATCH(result->name, "pass_num_cpus")) {
-               int pass_res_type = conf_data->res_type;
+               int res_type = conf_data->res_type;
 
-               switch (pass_res_type) {
+               switch (res_type) {
                case PASS_RESOURCE_CPU_ID:
                        conf_data->num_cpus = atoi(result->value);
                        break;
index ab80b3d..94ba989 100644 (file)
@@ -95,7 +95,7 @@ static int find_scenario_index(struct pass_scenario_policy *scenario,
 #define MAX(a,b)       (a > b ? a : b)
 int pass_notifier_pmqos_func(struct pass_policy *policy, void *data)
 {
-       struct pass_resource *pass_res;
+       struct pass_resource *res;
        struct pass_conf_data *cdata;
        struct pass_scenario_policy *scenario;
        struct pass_scenario *scn = NULL;
@@ -109,8 +109,8 @@ int pass_notifier_pmqos_func(struct pass_policy *policy, void *data)
        if (!is_pmqos_enabled(policy))
                return 0;
 
-       pass_res = to_pass_resource(policy);
-       cdata = &pass_res->cdata;
+       res = to_pass_resource(policy);
+       cdata = &res->cdata;
        scenario = &policy->scenario;
 
        /*
index de89a49..eb23b45 100644 (file)
@@ -94,9 +94,9 @@ static const struct edbus_method edbus_methods[] = {
  *                PASS interface (Init/Exit)          *
  ******************************************************/
 
-static int pass_init_resource(struct pass_resource *pass_res)
+static int pass_init_resource(struct pass_resource *res)
 {
-       struct pass_policy *policy = &pass_res->policy;
+       struct pass_policy *policy = &res->policy;
        int max_freq = 0;
        int ret;
        int i;
@@ -104,9 +104,9 @@ static int pass_init_resource(struct pass_resource *pass_res)
        /*
         * Initialize pass-table by parsing pass.conf
         */
-       ret = pass_get_table(policy, pass_res->cdata.path_conf_file);
+       ret = pass_get_table(policy, res->cdata.path_conf_file);
        if (ret < 0) {
-               _E("cannot parse %s\n", pass_res->cdata.path_conf_file);
+               _E("cannot parse %s\n", res->cdata.path_conf_file);
                return -1;
        }
 
@@ -160,11 +160,11 @@ static int pass_init_resource(struct pass_resource *pass_res)
 
        for (i = 0; i < policy->num_pass_cpu_stats; i++) {
                policy->pass_cpu_stats[i].load =
-                       calloc(pass_res->cdata.num_cpus, sizeof(unsigned int));
+                       calloc(res->cdata.num_cpus, sizeof(unsigned int));
                policy->pass_cpu_stats[i].nr_running =
-                       calloc(pass_res->cdata.num_cpus, sizeof(unsigned int));
+                       calloc(res->cdata.num_cpus, sizeof(unsigned int));
                policy->pass_cpu_stats[i].runnable_load =
-                       calloc(pass_res->cdata.num_cpus, sizeof(unsigned int));
+                       calloc(res->cdata.num_cpus, sizeof(unsigned int));
        }
 
        /* Get the instance of PASS governor */
@@ -177,12 +177,12 @@ static int pass_init_resource(struct pass_resource *pass_res)
        /* Get the instance of PASS hotplug */
        policy->hotplug = pass_get_hotplug(policy, policy->gov_type);
        if (policy->hotplug) {
-               policy->hotplug->sequence = calloc(pass_res->cdata.num_cpus,
+               policy->hotplug->sequence = calloc(res->cdata.num_cpus,
                                                sizeof(int));
-               for (i = 0; i < pass_res->cdata.num_cpus; i++)
-                       policy->hotplug->sequence[i] = i + pass_res->cdata.cpu;
+               for (i = 0; i < res->cdata.num_cpus; i++)
+                       policy->hotplug->sequence[i] = i + res->cdata.cpu;
 
-               policy->hotplug->num_cpus = pass_res->cdata.num_cpus;
+               policy->hotplug->num_cpus = res->cdata.num_cpus;
        }
 
        ret = pass_governor_init(policy);
@@ -194,9 +194,9 @@ static int pass_init_resource(struct pass_resource *pass_res)
        return 0;
 }
 
-static int pass_exit_resource(struct pass_resource *pass_res)
+static int pass_exit_resource(struct pass_resource *res)
 {
-       struct pass_policy *policy = &pass_res->policy;
+       struct pass_policy *policy = &res->policy;
        int ret;
 
        pass_put_table(policy);
@@ -237,22 +237,22 @@ static int pass_init_done(void *data, void *user_data)
 
        /* Initialize pass resources data based on parsed configuration */
        for (i = 0; i < g_pass.num_resources; i++) {
-               struct pass_resource *pass_res = &g_pass.res[i];
+               struct pass_resource *res = &g_pass.res[i];
                struct pass_conf_data *cdata = &g_pass.res[i].cdata;
 
-               ret = pass_get_resource(pass_res);
+               ret = pass_get_resource(res);
                if (ret < -1) {
                        _E("Cannot get the pass '%s' resource (%d)\n",
                                        cdata->res_name, ret);
                        continue;
                }
 
-               ret = pass_init_resource(pass_res);
+               ret = pass_init_resource(res);
                if (ret < 0) {
                        _E("Cannot initialize the pass '%s' resource (%d)\n",
                                        cdata->res_name, ret);
 
-                       ret = pass_put_resource(pass_res);
+                       ret = pass_put_resource(res);
                        if (ret < 0)
                                _E("Cannot put the pass '%s' resource (%d)\n",
                                        cdata->res_name, ret);
@@ -267,15 +267,15 @@ static int pass_exit_done(void)
        int i, ret = 0;
 
        for (i = 0; i < g_pass.num_resources; i++) {
-               struct pass_resource *pass_res = &g_pass.res[i];
+               struct pass_resource *res = &g_pass.res[i];
                struct pass_conf_data *cdata = &g_pass.res[i].cdata;
 
-               ret = pass_exit_resource(pass_res);
+               ret = pass_exit_resource(res);
                if (ret < 0)
                        _E("Cannot exit the pass '%s' resource (%d)\n",
                                        cdata->res_name, ret);
 
-               ret = pass_put_resource(pass_res);
+               ret = pass_put_resource(res);
                if (ret < 0) {
                        _E("Cannot put the pass '%s' resource (%d)\n",
                                        cdata->res_name, ret);