pass-hal: tm1: Make nonstandard HAL work even if without TRM 43/145443/2
authorWook Song <wook16.song@samsung.com>
Tue, 22 Aug 2017 09:19:45 +0000 (18:19 +0900)
committerWook Song <wook16.song@samsung.com>
Wed, 23 Aug 2017 01:14:52 +0000 (10:14 +0900)
Since the nonstandard interfaces of HAL is designed under the assumption
that TRM is preliminarily installed and the unix domain socket file exists
to recieve the PMQoS scenario information, PASS does not work as
intended without TRM.

This patch fixes this problem by assigning a nop function to the
interface for setting PMQoS data when the file for recieving the
scenario information does not exist at the HAL open point.

Change-Id: I5d88e531ae1782d668df01054aca07c524b8af6e
Reported-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Wook Song <wook16.song@samsung.com>
src/nonstandard/nonstandard.c

index c5e2f0f53cf0c9a751693ea154c60d1e2002550b..c3cd165c0ee7365ef36f06eb83c0778ecc5292a7 100644 (file)
@@ -69,6 +69,19 @@ static int tm1_set_pmqos_data(char *res_name, void *data)
        return ret;
 }
 
+static int tm1_set_pmqos_data_nop(char *res_name, void *data)
+{
+       /*
+        * The tm1_set_pmqos_data function is required to send the PMQoS
+        * scenario information to the socket interface of the TRM and it
+        * is optional, which means that this HAL for nonstandard should work
+        * without TRM. For this reason, if there is no unix domain socket file
+        * for the PMQoS scenario, this nop function is assigned to the
+        * set_pmqos_data pointer rather than returning error.
+        */
+       return 0;
+}
+
 static int tm1_nonstandard_open(char *res_name, struct pass_resource_info *info,
                struct pass_resource_common **common)
 {
@@ -83,12 +96,13 @@ static int tm1_nonstandard_open(char *res_name, struct pass_resource_info *info,
        if (!nonstandard_res)
                return -ENOMEM;
 
-       ret = access(SCENARIO_INFO_SOCKET_PATH, F_OK);
-       if (ret)
-               return ret;
-
        nonstandard_res->common.info = info;
-       nonstandard_res->set_pmqos_data = tm1_set_pmqos_data;
+
+       ret = access(SCENARIO_INFO_SOCKET_PATH, F_OK);
+       if (!ret)
+               nonstandard_res->set_pmqos_data = tm1_set_pmqos_data;
+       else
+               nonstandard_res->set_pmqos_data = tm1_set_pmqos_data_nop;
 
        *common = (struct pass_resource_common *) nonstandard_res;