pass: hal: Add helper functions for the min/max number of online CPUs 40/114540/1
authorWook Song <wook16.song@samsung.com>
Tue, 14 Feb 2017 02:10:37 +0000 (11:10 +0900)
committerWook Song <wook16.song@samsung.com>
Tue, 14 Feb 2017 02:10:37 +0000 (11:10 +0900)
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 <wook16.song@samsung.com>
src/pass/pass-hal.c
src/pass/pass-hal.h

index bd7438a409d6a55736d66e9cbe6a85b9b0c1f326..18629cf26c4ef48fc20767a6e43a0e366ea872c5 100644 (file)
@@ -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)
 {
index 3c45ff5c3060d0f070ed3d4ecbbef0db1244225a..77f53268ab8b79751debf33b7f9b93594667894a 100644 (file)
@@ -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);