From: "pi-cheng.chen" pi-cheng.chen@linaro.org
move code snip getting deadline parameter to gather the settings of exec time, period time and deadline time in one place.
Signed-off-by: Vincent Guittot vincent.guittot@linaro.org Signed-off-by: pi-cheng.chen pi-cheng.chen@linaro.org --- src/rt-app_parse_config.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c index 85aa14f..3acc1c9 100644 --- a/src/rt-app_parse_config.c +++ b/src/rt-app_parse_config.c @@ -364,6 +364,18 @@ parse_thread_data(char *name, struct json_object *obj, int idx, data->min_et = usec_to_timespec(exec); data->max_et = usec_to_timespec(exec);
+ /* deadline */ + dline = get_int_value_from(obj, "deadline", TRUE, period); + if (dline < exec) { + log_critical(PIN2 "Deadline cannot be less than exec time"); + exit(EXIT_INV_CONFIG); + } + if (dline > period) { + log_critical(PIN2 "Deadline cannot be greater than period"); + exit(EXIT_INV_CONFIG); + } + data->deadline = usec_to_timespec(dline); + /* policy */ policy_to_string(opts->policy, def_policy); policy = get_string_value_from(obj, "policy", TRUE, def_policy); @@ -379,18 +391,6 @@ parse_thread_data(char *name, struct json_object *obj, int idx, data->sched_prio = get_int_value_from(obj, "priority", TRUE, DEFAULT_THREAD_PRIORITY);
- /* deadline */ - dline = get_int_value_from(obj, "deadline", TRUE, period); - if (dline < exec) { - log_critical(PIN2 "Deadline cannot be less than exec time"); - exit(EXIT_INV_CONFIG); - } - if (dline > period) { - log_critical(PIN2 "Deadline cannot be greater than period"); - exit(EXIT_INV_CONFIG); - } - data->deadline = usec_to_timespec(dline); - /* cpu set */ cpuset_obj = get_in_object(obj, "cpus", TRUE); if (cpuset_obj) {