pass-hal: tm1: Add resource name for open and close function 06/127106/2 accepted/tizen/unified/20170426.200228 submit/tizen/20170426.080126 tizen_4.0.m1_release
authorChanwoo Choi <cw00.choi@samsung.com>
Wed, 26 Apr 2017 07:42:52 +0000 (16:42 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Wed, 26 Apr 2017 07:49:53 +0000 (16:49 +0900)
This patch just adds the new argument of h/w resource name
when calling the open and close functions. The resource name
will be used to identify the h/w resource.

Change-Id: If919c848c89b94906bf5930216b2db678369c87c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/cpu/cpu.c

index a01b0317acef9a8a64c85a9609a9bc07cd32e1eb..3f4059f0a28e56181466e70e7388a4635c258698 100644 (file)
@@ -163,12 +163,12 @@ static struct pass_resource_tmu_ops tm1_cpu_tmu_ops = {
        .get_policy = NULL,
 };
 
-static int tm1_cpu_open(struct pass_resource_info *info,
+static int tm1_cpu_open(char *res_name, struct pass_resource_info *info,
                struct pass_resource_common **common)
 {
        struct pass_resource_cpu *cpu_res;
 
-       if (!info)
+       if (!res_name || !info)
                return -EINVAL;
 
        /* TODO: Possibility of a memory leak */
@@ -186,17 +186,15 @@ static int tm1_cpu_open(struct pass_resource_info *info,
        return 0;
 }
 
-static int tm1_cpu_close(struct pass_resource_common *common)
+static int tm1_cpu_close(char *res_name, struct pass_resource_common *common)
 {
        struct pass_resource_cpu *cpu_res;
-       char res_name[BUFF_MAX];
        int ret = 0;
 
-       if (!common)
+       if (!res_name || !common)
                return -EINVAL;
 
        cpu_res = (struct pass_resource_cpu *) common;
-       snprintf(res_name, BUFF_MAX, "%s%d", cpu_res->common.info->name, 0);
 
        ret = cpu_res->hotplug.set_online_max_num(res_name, 0);
        if (ret < 0)