From: Wook Song Date: Tue, 14 Feb 2017 02:10:37 +0000 (+0900) Subject: pass: hal: Add helper functions for the min/max number of online CPUs X-Git-Tag: submit/tizen/20170328.004502~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ac34b2e116dab2d77c423a1bac584739d453524;p=platform%2Fcore%2Fsystem%2Fpass.git pass: hal: Add helper functions for the min/max number of online CPUs This patch adds new helper functions to handle the minimum and maximum number of the online CPUs. Change-Id: I209378b5366743ee45877a40f797a804e94fd4ff Signed-off-by: Wook Song --- diff --git a/src/pass/pass-hal.c b/src/pass/pass-hal.c index bd7438a..18629cf 100644 --- a/src/pass/pass-hal.c +++ b/src/pass/pass-hal.c @@ -330,6 +330,94 @@ int pass_set_online_state(struct pass_resource *res, int cpu, int on) return hotplug->set_online_state(res_name, cpu, on); } +int pass_get_online_min_num(struct pass_resource *res) +{ + struct pass_resource_hotplug_ops *hotplug; + char *res_name; + int id; + + if (!res) + return -EINVAL; + + res_name = res->cdata.res_name; + id = res->cdata.res_type; + + hotplug = get_hotplug(res, id); + if (!hotplug) + return -EINVAL; + + if ((!hotplug->get_online_min_num) || (!res_name)) + return -EINVAL; + + return hotplug->get_online_min_num(res_name); +} + +int pass_set_online_min_num(struct pass_resource *res, int num) +{ + struct pass_resource_hotplug_ops *hotplug; + char *res_name; + int id; + + if ((!res) || (num < 0)) + return -EINVAL; + + res_name = res->cdata.res_name; + id = res->cdata.res_type; + + hotplug = get_hotplug(res, id); + if (!hotplug) + return -EINVAL; + + if ((!hotplug->set_online_min_num) || (!res_name)) + return -EINVAL; + + return hotplug->set_online_min_num(res_name, num); +} + +int pass_get_online_max_num(struct pass_resource *res) +{ + struct pass_resource_hotplug_ops *hotplug; + char *res_name; + int id; + + if (!res) + return -EINVAL; + + res_name = res->cdata.res_name; + id = res->cdata.res_type; + + hotplug = get_hotplug(res, id); + if (!hotplug) + return -EINVAL; + + if ((!hotplug->get_online_max_num) || (!res_name)) + return -EINVAL; + + return hotplug->get_online_max_num(res_name); +} + +int pass_set_online_max_num(struct pass_resource *res, int num) +{ + struct pass_resource_hotplug_ops *hotplug; + char *res_name; + int id; + + if ((!res) || (num < 0)) + return -EINVAL; + + res_name = res->cdata.res_name; + id = res->cdata.res_type; + + hotplug = get_hotplug(res, id); + if (!hotplug) + return -EINVAL; + + if ((!hotplug->set_online_max_num) || (!res_name)) + return -EINVAL; + + return hotplug->set_online_max_num(res_name, num); +} + /* Get the temperature and thermal policy for Thermal resource. */ int pass_get_temp(struct pass_resource *res) { diff --git a/src/pass/pass-hal.h b/src/pass/pass-hal.h index 3c45ff5..77f5326 100644 --- a/src/pass/pass-hal.h +++ b/src/pass/pass-hal.h @@ -44,6 +44,12 @@ int pass_set_up_threshold(struct pass_resource *res, int up_threshold); /* Get and set online state of cpu. */ int pass_get_online_state(struct pass_resource *res, int cpu); int pass_set_online_state(struct pass_resource *res, int cpu, int on); +/* Get and set the minimum number of online CPUs */ +int pass_get_online_min_num(struct pass_resource *res); +int pass_set_online_min_num(struct pass_resource *res, int num); +/* Get and set the maximum number of online CPUs */ +int pass_get_online_max_num(struct pass_resource *res); +int pass_set_online_max_num(struct pass_resource *res, int num); /* Get the temperature and policy of thermal unit on specific h/w. */ int pass_get_temp(struct pass_resource *res);