pass: thermal: Change local variable name for readability 19/224719/7
authorChanwoo Choi <cw00.choi@samsung.com>
Wed, 12 Feb 2020 08:59:54 +0000 (17:59 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Wed, 26 Feb 2020 10:22:19 +0000 (19:22 +0900)
Change local variable name for readability as following
without any behavior changes:
- curr_temp      -> new_temp which is the measured temperature
- timer_interval -> new_timer_interval of new thermal scenario
- scenario       -> new_scenario which is instance of new thermal scenario
- scenario_idx   -> new_scenario_idx which is index of new thernal scenario
- timer_interval_of_scenario is removed due to unneeded

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

index 366c03e8b0da60138c8971dd9baa04a024c9e46a..fc3b088c36a1f192549cbe235fe4ac0e5e232fed 100644 (file)
@@ -39,10 +39,10 @@ static int thermal_update(struct pass_resource *res,
                        struct resmon_result_src_thermal *thermal_result)
 {
        struct pass_thermal *thermal = &res->thermal;;
-       struct pass_scenario *scenario;
-       int timer_interval_of_scenario, timer_interval;
-       int curr_temp, prev_temp, temp;
-       int i, scenario_idx;
+       struct pass_scenario *new_scenario;
+       int new_timer_interval;
+       int new_temp, prev_temp;
+       int i, new_scenario_idx;
        int ret;
 
        if (!res || !thermal_result) {
@@ -51,22 +51,22 @@ static int thermal_update(struct pass_resource *res,
        }
 
        prev_temp = thermal->curr_temp;
-       curr_temp = thermal_result->temp;
+       new_temp = thermal_result->temp;
 
-       if (prev_temp == curr_temp)
+       if (prev_temp == new_temp)
                return 0;
 
-       scenario_idx = -1;
+       new_scenario_idx = -1;
        for (i = 0; i < thermal->num_scenarios; i++) {
-               temp = thermal->scenarios[i].thermal.temperature;
+               int temp = thermal->scenarios[i].thermal.temperature;
 
                if (thermal->scenarios[i].state != PASS_ON)
                        continue;
 
-               if (scenario_idx < 0 && curr_temp < temp)
-                       scenario_idx = i;
-               else if (temp <= curr_temp)
-                       scenario_idx = i;
+               if (new_scenario_idx < 0 && new_temp < temp)
+                       new_scenario_idx = i;
+               else if (temp <= new_temp)
+                       new_scenario_idx = i;
        }
 
        /*
@@ -74,22 +74,20 @@ static int thermal_update(struct pass_resource *res,
         * or if there are no scenario with 'support=yes',
         * just return without notification.
         */
-       if (scenario_idx < 0)
+       if (new_scenario_idx < 0)
                return 0;
 
-       if (thermal->curr_scenario_idx == scenario_idx)
+       if (thermal->curr_scenario_idx == new_scenario_idx)
                return 0;
-       scenario = &thermal->scenarios[scenario_idx];
+       new_scenario = &thermal->scenarios[new_scenario_idx];
 
        /* Get the new timer interval of each scenario */
-       timer_interval_of_scenario = scenario->thermal.timer_interval;
-       if (timer_interval_of_scenario > 0)
-               timer_interval = timer_interval_of_scenario;
-       else
-               timer_interval = res->thermal.timer_interval;
+       new_timer_interval = new_scenario->thermal.timer_interval;
+       if (new_timer_interval < 0)
+               new_timer_interval = res->thermal.timer_interval;
 
        ret = pass_resmon_update_timer_interval(res, RESMON_SRC_THERMAL,
-                               timer_interval);
+                               new_timer_interval);
        if (ret < 0) {
                _W("failed to update interval of timer-based monitor " \
                        "(res_name:%s, src_type: 0x%x)\n",
@@ -97,16 +95,16 @@ static int thermal_update(struct pass_resource *res,
        }
 
        /* Update thermal information of each h/w resource */
-       thermal->curr_temp = curr_temp;
+       thermal->curr_temp = new_temp;
        thermal->prev_scenario_idx = thermal->curr_scenario_idx;
-       thermal->curr_scenario_idx = scenario_idx;
+       thermal->curr_scenario_idx = new_scenario_idx;
 
        /* Set ScenarioLevel for current scenario */
-       ret = pass_rescon_set_scenario_level(res, scenario->level);
+       ret = pass_rescon_set_scenario_level(res, new_scenario->level);
        if (ret < 0) {
                _W("failed to set ScenarioLevel%d " \
                        "(res_name:%s, src_type: 0x%x)\n",
-                       scenario->level,
+                       new_scenario->level,
                        res->config_data.res_name, RESMON_SRC_THERMAL);
        }
 
@@ -131,9 +129,9 @@ static int thermal_update(struct pass_resource *res,
        }
 
        _I("Monitor '%-12s' of '%s' resource ('%3d' degrees,'%5d' ms)\n",
-                               scenario->name,
+                               new_scenario->name,
                                res->config_data.res_name,
-                               curr_temp, timer_interval);
+                               new_temp, new_timer_interval);
 
        return 0;
 }