}
static int pass_parse_level(struct parse_result *result,
- void *user_data, int level)
+ struct pass_level *level)
{
- struct pass_policy *policy = user_data;
-
- if (!result)
+ if (!result || !level)
return 0;
if (!result->section || !result->name || !result->value)
* - PASS_RESOURCE_GPU_ID
*/
if (MATCH(result->name, "limit_max_freq"))
- policy->levels[level].limit_max_freq = atoi(result->value);
+ level->limit_max_freq = atoi(result->value);
else if (MATCH(result->name, "limit_min_freq"))
- policy->levels[level].limit_min_freq = atoi(result->value);
+ level->limit_min_freq = atoi(result->value);
else if (MATCH(result->name, "limit_min_cpu"))
- policy->levels[level].limit_min_cpu = atoi(result->value);
+ level->limit_min_cpu = atoi(result->value);
/*
* Properties for the following h/w resources:
* - PASS_RESOURCE_CPU_ID
*/
else if (MATCH(result->name, "num_down_cond"))
- policy->levels[level].num_down_cond = atoi(result->value);
+ level->num_down_cond = atoi(result->value);
else if (MATCH(result->name, "num_down_cond_freq"))
- policy->levels[level].down_cond[0].freq = atoi(result->value);
+ level->down_cond[0].freq = atoi(result->value);
else if (MATCH(result->name, "num_down_cond_nr_running"))
- policy->levels[level].down_cond[0].nr_running = atoi(result->value);
+ level->down_cond[0].nr_running = atoi(result->value);
else if (MATCH(result->name, "num_down_cond_busy_cpu"))
- policy->levels[level].down_cond[0].busy_cpu = atoi(result->value);
+ level->down_cond[0].busy_cpu = atoi(result->value);
else if (MATCH(result->name, "num_up_cond"))
- policy->levels[level].num_up_cond = atoi(result->value);
+ level->num_up_cond = atoi(result->value);
else if (MATCH(result->name, "num_up_cond_freq"))
- policy->levels[level].up_cond[0].freq = atoi(result->value);
+ level->up_cond[0].freq = atoi(result->value);
else if (MATCH(result->name, "num_up_cond_nr_running"))
- policy->levels[level].up_cond[0].nr_running = atoi(result->value);
+ level->up_cond[0].nr_running = atoi(result->value);
else if (MATCH(result->name, "num_up_cond_busy_cpu"))
- policy->levels[level].up_cond[0].busy_cpu = atoi(result->value);
+ level->up_cond[0].busy_cpu = atoi(result->value);
else if (MATCH(result->name, "num_left_cond"))
- policy->levels[level].num_left_cond = atoi(result->value);
+ level->num_left_cond = atoi(result->value);
else if (MATCH(result->name, "num_left_cond_freq"))
- policy->levels[level].left_cond[0].freq = atoi(result->value);
+ level->left_cond[0].freq = atoi(result->value);
else if (MATCH(result->name, "num_left_cond_nr_running"))
- policy->levels[level].left_cond[0].nr_running = atoi(result->value);
+ level->left_cond[0].nr_running = atoi(result->value);
else if (MATCH(result->name, "num_left_cond_busy_cpu"))
- policy->levels[level].left_cond[0].busy_cpu = atoi(result->value);
+ level->left_cond[0].busy_cpu = atoi(result->value);
else if (MATCH(result->name, "num_right_cond"))
- policy->levels[level].num_right_cond = atoi(result->value);
+ level->num_right_cond = atoi(result->value);
else if (MATCH(result->name, "num_right_cond_freq"))
- policy->levels[level].right_cond[0].freq = atoi(result->value);
+ level->right_cond[0].freq = atoi(result->value);
else if (MATCH(result->name, "num_right_cond_nr_running"))
- policy->levels[level].right_cond[0].nr_running = atoi(result->value);
+ level->right_cond[0].nr_running = atoi(result->value);
else if (MATCH(result->name, "num_right_cond_busy_cpu"))
- policy->levels[level].right_cond[0].busy_cpu = atoi(result->value);
+ level->right_cond[0].busy_cpu = atoi(result->value);
else if (MATCH(result->name, "gov_timeout")) {
double gov_timeout = atof(result->value);
if (gov_timeout < MIN_TIMEOUT_SEC)
gov_timeout = MIN_TIMEOUT_SEC;
- policy->levels[level].gov_timeout = gov_timeout;
+ level->gov_timeout = gov_timeout;
}
/*
* - PASS_RESOURCE_MEMORY_ID
*/
else if (MATCH(result->name, "fault_around_bytes"))
- policy->levels[level].fault_around_bytes = atoi(result->value);
+ level->fault_around_bytes = atoi(result->value);
return 0;
}
goto out;
}
- /* Parsing 'Level' section to get pass-table */
+ /* Parsing 'Level' section */
for (level = 0; level < policy->num_levels; level++) {
ret = snprintf(section_name, BUFF_MAX, "Level%d", level);
if (MATCH(result->section, section_name)) {
- ret = pass_parse_level(result, user_data, level);
+ ret = pass_parse_level(result, &policy->levels[level]);
if (ret < 0) {
_E("cannot parse 'Level' section\n");
return ret;