pass: resmon: Remove dependnecy of resource type 75/269975/2
authorChanwoo Choi <cw00.choi@samsung.com>
Mon, 10 Jan 2022 08:52:08 +0000 (17:52 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 24 Jan 2022 09:23:58 +0000 (18:23 +0900)
Change-Id: I966c38bca2b52a40205b13f54db2bf5e4dc5ef49
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-resmon.c

index 7f04dee..fad1304 100644 (file)
@@ -59,49 +59,6 @@ static int g_udev_count = 0;
 
 extern struct resmon_ops *resmon_get_ops(enum resmon_src_type src_type);
 
-/**
- * @brief      Specify the supported sources of timer-based resource monitor
- *             according the type of h/w resource.
- */
-uint64 available_resmon_timer[] = {
-       [PASS_RESOURCE_UNKNOWN]         = 0,
-       [PASS_RESOURCE_CPU_ID]          = RESMON_SRC_THERMAL
-                                       | RESMON_SRC_CPUHP,
-       [PASS_RESOURCE_BUS_ID]          = 0,
-       [PASS_RESOURCE_GPU_ID]          = RESMON_SRC_THERMAL,
-       [PASS_RESOURCE_MEMORY_ID]       = 0,
-       [PASS_RESOURCE_BATTERY_ID]      = RESMON_SRC_THERMAL,
-       [PASS_RESOURCE_NONSTANDARD_ID]  = RESMON_SRC_THERMAL
-};
-
-/**
- * @brief      Specify the supported sources of uevent-based resource monitor
- *             according the type of h/w resource.
- */
-uint64 available_resmon_uevent[] = {
-       [PASS_RESOURCE_UNKNOWN]         = 0,
-       [PASS_RESOURCE_CPU_ID]          = RESMON_SRC_THERMAL,
-       [PASS_RESOURCE_BUS_ID]          = 0,
-       [PASS_RESOURCE_GPU_ID]          = RESMON_SRC_THERMAL,
-       [PASS_RESOURCE_MEMORY_ID]       = 0,
-       [PASS_RESOURCE_BATTERY_ID]      = RESMON_SRC_THERMAL,
-       [PASS_RESOURCE_NONSTANDARD_ID]  = RESMON_SRC_THERMAL
-};
-
-static bool resmon_is_supported(unsigned int res_type,
-                                       enum resmon_type type,
-                                       enum resmon_src_type src_type)
-{
-       switch (type) {
-       case RESMON_TIMER:
-               return !!(available_resmon_timer[res_type] & src_type);
-       case RESMON_UEVENT:
-               return !!(available_resmon_uevent[res_type] & src_type);
-       default:
-               return false;
-       }
-}
-
 static bool resmon_is_created(struct pass_resmon *resmon,
                                        enum resmon_type type,
                                        enum resmon_src_type src_type)
@@ -330,14 +287,7 @@ int pass_resmon_register_timer(struct pass_resource *res,
                return -EINVAL;
 
        resmon = &res->resmon;
-
-       /* Check whether the resource monitor is supported or not */
        res_type = res->config_data.res_type;
-       if (!resmon_is_supported(res_type, RESMON_TIMER, src_type)) {
-               _E("invalid value (res_type: %d, src_type: 0x%x)\n",
-                                               res_type, src_type);
-               return -EINVAL;
-       }
 
        /* Prevent the monitoring of already required type */
        if (resmon_is_created(resmon, RESMON_TIMER, src_type)) {
@@ -678,7 +628,6 @@ int pass_resmon_register_uevent(struct pass_resource *res,
 {
        struct pass_resmon *resmon;
        struct resmon *monitor;
-       int res_type;
        int ret;
 
        if (!res || src_type == 0 || user_func == NULL) {
@@ -688,14 +637,6 @@ int pass_resmon_register_uevent(struct pass_resource *res,
 
        resmon = &res->resmon;
 
-       /* Check whether the resource monitor is supported or not */
-       res_type = res->config_data.res_type;
-       if (!resmon_is_supported(res_type, RESMON_UEVENT, src_type)) {
-               _E("src_type is not supported (res_name: %s, src_type: 0x%x)\n",
-                                       res->config_data.res_name, src_type);
-               return -EINVAL;
-       }
-
        /* Prevent the monitoring of already required type */
        if (resmon_is_created(resmon, RESMON_UEVENT, src_type)) {
                _E("uevent-based resmon is already created "\