hal: Add new argument of resource name to close and open function 98/127098/2 accepted/tizen/unified/20170426.200227 submit/tizen/20170426.080126 tizen_4.0.m1_release
authorChanwoo Choi <cw00.choi@samsung.com>
Wed, 26 Apr 2017 07:09:44 +0000 (16:09 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Wed, 26 Apr 2017 07:44:12 +0000 (16:44 +0900)
The open and close functions in the struct pass_resource_info
are used to get/put the h/w resource. And the open and close
functions in the hal implementation save/restore the h/w
resource state. In this case, these functions need the unique
resource name in order to identify the h/w resource.

Change-Id: Icd7977619ed1f09186756a7cacf2c801c4284f1a
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/hal/hal.h
src/pass/pass-hal.c

index 3972b7fe57ad3176664a129533cf85251f2afc90..895e74b2074d9dbe61f437ab6d9896ff850ba457 100644 (file)
@@ -90,9 +90,9 @@ struct pass_resource_info {
        void *dso;
        uint32_t reserved[8];
 
-       int (*open)(struct pass_resource_info *info,
+       int (*open)(char *res_name, struct pass_resource_info *info,
                        struct pass_resource_common **common);
-       int (*close)(struct pass_resource_common *common);
+       int (*close)(char *res_name, struct pass_resource_common *common);
 };
 
 struct pass_resource_common {
index 8b1f3b14d5dbc4779ee32447da94687f88f4a83d..74a28117a7d268b2ed7f861f5ab5d1f0d9bde35c 100644 (file)
@@ -473,6 +473,7 @@ int pass_get_resource(struct pass *pass)
                struct pass_resource *pass_res = &pass->res[i];
                struct pass_conf_data *cdata = &pass_res->cdata;
                int res_type = cdata->res_type;
+               char *res_name = cdata->res_name;
                char name[10];
 
                switch (res_type) {
@@ -509,25 +510,27 @@ int pass_get_resource(struct pass *pass)
 
                switch (res_type) {
                case PASS_RESOURCE_CPU_ID:
-                       ret = info->open(info,
+                       ret = info->open(res_name, info,
                                (struct pass_resource_common**)&pass_res->hal.cpu);
                        break;
                case PASS_RESOURCE_BUS_ID:
-                       ret = info->open(info,
+                       ret = info->open(res_name, info,
                                (struct pass_resource_common**)&pass_res->hal.bus);
                        break;
                case PASS_RESOURCE_GPU_ID:
-                       ret = info->open(info,
+                       ret = info->open(res_name, info,
                                (struct pass_resource_common**)&pass_res->hal.gpu);
                        break;
                };
 
                if (ret < 0) {
-                       _E("Failed to open %s h/w resource\n", name);
+                       _E("Failed to open %s h/w resource (%s)\n",
+                                               name, res_name);
                        return -EINVAL;
                }
 
-               _D("Complete the loading for %s h/w resource\n", name);
+               _D("Complete the loading for %s h/w resource (%s)\n",
+                                               name, res_name);
        }
 
        return 0;
@@ -542,34 +545,37 @@ int pass_put_resource(struct pass *pass)
        for (i = 0; i < pass->num_resources; i++) {
                struct pass_resource *pass_res = &pass->res[i];
                struct pass_conf_data *cdata = &pass_res->cdata;
+               char *res_name = cdata->res_name;
                int res_type = cdata->res_type;
 
                switch (res_type) {
                case PASS_RESOURCE_CPU_ID:
                        common = (struct pass_resource_common*)pass_res->hal.cpu;
                        info = pass_res->hal.cpu->common.info;
-                       ret = info->close(common);
+                       ret = info->close(res_name, common);
                        break;
                case PASS_RESOURCE_BUS_ID:
                        common = (struct pass_resource_common*)pass_res->hal.bus;
                        info = pass_res->hal.bus->common.info;
-                       ret = info->close(common);
+                       ret = info->close(res_name, common);
                        break;
                case PASS_RESOURCE_GPU_ID:
                        common = (struct pass_resource_common*)pass_res->hal.gpu;
                        info = pass_res->hal.gpu->common.info;
-                       ret = info->close(common);
+                       ret = info->close(res_name, common);
                        break;
                default:
                        return -EINVAL;
                };
 
                if (ret < 0) {
-                       _E("Failed to close %s h/w resource\n", info->name);
+                       _E("Failed to close %s h/w resource (%s)\n",
+                                               info->name, res_name);
                        return -EINVAL;
                }
 
-               _D("Complete the closing for %s h/w resource\n", info->name);
+               _D("Complete the closing for %s h/w resource (%s)\n",
+                                               info->name, res_name);
        }
 
        return 0;