pass: hal: Use 'res_thermal_name' as the first argument for TMU HAL 32/137632/6
authorWook Song <wook16.song@samsung.com>
Fri, 7 Jul 2017 02:03:37 +0000 (11:03 +0900)
committerWook Song <wook16.song@samsung.com>
Fri, 7 Jul 2017 05:55:33 +0000 (14:55 +0900)
This patch makes the TMU HAL functions use 'res_thermal_name' as the
first argument, which is previously 'res_name'. This change will allow
the TMU HAL function bodies to be implemented without any hard-coded
sysfs node names.

Change-Id: I702d28bfab3b110a7bdba9c3bb7601bf0e250a23
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
src/hal/hal.h
src/pass/pass-hal.c

index 864cedde8d2e4dbc2152420d7971536068849c5b..7f3abc95484ad69c69cd5b1a8d20faff6171459a 100644 (file)
@@ -148,10 +148,10 @@ struct pass_resource_hotplug_ops {
 
 struct pass_resource_tmu_ops {
        /* Get the current temperature of resoruce. */
-       int (*get_temp)(char *res_name);
+       int (*get_temp)(char *res_thremal_name);
 
        /* Get the policy of thermal management unit. */
-       int (*get_policy)(char *res_name, char *policy);
+       int (*get_policy)(char *res_thermal_name, char *policy);
 };
 
 /*
index d1d3c935de306600c9316a6e52b472501800714a..c10032c9b9c7151b49891c0f3852afc15e3a6cdd 100644 (file)
@@ -422,45 +422,55 @@ int pass_set_online_max_num(struct pass_resource *res, int num)
 int pass_get_temp(struct pass_resource *res)
 {
        struct pass_resource_tmu_ops *tmu;
-       char *res_name;
+       char *res_thermal_name;
        int id;
 
        if (!res)
                return -EINVAL;
 
-       res_name = res->cdata.res_name;
+       /*
+        * In the case of the HAL TMU ops,
+        * res_thermal_name is used as the first argument,
+        * instead of res_name.
+        */
+       res_thermal_name = res->cdata.res_thermal_name;
        id = res->cdata.res_type;
 
        tmu = get_tmu(res, id);
        if (!tmu)
                return -EINVAL;
 
-       if (!tmu->get_temp || !res_name)
+       if (!tmu->get_temp || !res_thermal_name)
                return -EINVAL;
 
-       return tmu->get_temp(res_name);
+       return tmu->get_temp(res_thermal_name);
 }
 
 int pass_get_policy(struct pass_resource *res, char *policy)
 {
        struct pass_resource_tmu_ops *tmu;
-       char *res_name;
+       char *res_thermal_name;
        int id;
 
        if (!res)
                return -EINVAL;
 
-       res_name = res->cdata.res_name;
+       /*
+        * In the case of the HAL TMU ops,
+        * res_thermal_name is used as the first argument,
+        * instead of res_name.
+        */
+       res_thermal_name = res->cdata.res_thermal_name;
        id = res->cdata.res_type;
 
        tmu = get_tmu(res, id);
        if (!tmu)
                return -EINVAL;
 
-       if (!tmu->get_policy || !res_name)
+       if (!tmu->get_policy || !res_thermal_name)
                return -EINVAL;
 
-       return tmu->get_policy(res_name, policy);
+       return tmu->get_policy(res_thermal_name, policy);
 }
 
 int pass_set_pmqos_data(struct pass_resource *res, void *data)