From 287c297ca17561eab69c4722fb79c9a177cda8f4 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Mon, 2 Dec 2024 17:53:26 +0900 Subject: [PATCH] Remove unused set_pmqos_data() and not-supported PASS_RESOURCE_NONSTANDARD_ID Remove unused set_pmqos_data() and not-supported PASS_RESOURCE_NONSTANDARD_ID because it doesn't need to be used anymore. Change-Id: Ic6f0e98d644b21cfabee132e3b4b19de6ea225ad Signed-off-by: Chanwoo Choi --- packaging/pass.spec | 2 +- src/pass/pass-hal.c | 19 -------------- src/pass/pass-hal.h | 13 ---------- src/pass/pass-parser.c | 2 -- src/pass/pass-rescon.c | 17 ------------- src/pass/pass.c | 6 ----- src/pass/pass.h | 7 ------ tests/haltest/power-haltests.cpp | 16 ------------ tests/pass-unittests.cc | 16 ------------ .../hal-api-power-mock.cpp | 12 --------- .../hal-api-power-mock.hpp | 8 ------ .../pass-hal-and-parser-unittests.cc | 16 ------------ tests/unittest/pass-rescon/pass-hal-mock.cpp | 8 ------ tests/unittest/pass-rescon/pass-hal-mock.hpp | 25 ------------------- .../pass-rescon/pass-rescon-unittests.cc | 9 ------- tests/unittest/pass-resmon/pass-hal-mock.cpp | 8 ------ tests/unittest/pass-resmon/pass-hal-mock.hpp | 25 ------------------- .../pass-resmon/pass-resmon-unittests.cc | 9 ------- 18 files changed, 1 insertion(+), 217 deletions(-) diff --git a/packaging/pass.spec b/packaging/pass.spec index 0784256..4fb2a86 100644 --- a/packaging/pass.spec +++ b/packaging/pass.spec @@ -8,7 +8,7 @@ Name: %{daemon_name} Summary: Power Aware System Service -Version: 2.0.0 +Version: 2.0.1 Release: 1 Group: System/Kernel License: Apache-2.0 diff --git a/src/pass/pass-hal.c b/src/pass/pass-hal.c index fbbea84..7b3840a 100644 --- a/src/pass/pass-hal.c +++ b/src/pass/pass-hal.c @@ -583,23 +583,6 @@ int pass_hal_get_fault_around_bytes(struct pass_resource *res) res->config_data.res_name); } -/** - * @brief Deprecated - set pmqos_data for nonstandard h/w resource - * @param [in] res Instance of h/w resource - * @return @c 0 on success, otherwise error value - * @retval -22 Invalid argument (-EINVAL) - * @retval -1 Operation not permitted (-EPERM) - * @retval -19 Operation not supported (-ENOTSUP) - */ -int pass_hal_set_pmqos_data(struct pass_resource *res, void *data) -{ - if (!res || !data) - return -EINVAL; - - return hal_power_misc_set_pmqos_data(res->config_data.res_type, - res->config_data.res_name, data); -} - /** * @brief Save the initial state of DVFS(Dynamic Voltage and Frequency * Scaling) resource before PASS (Power Aware System Service) @@ -908,7 +891,6 @@ int pass_hal_save_initdata(struct pass_resource *res) } /* fall through */ case PASS_RESOURCE_BATTERY_ID: - case PASS_RESOURCE_NONSTANDARD_ID: ret = pass_hal_save_battery_initdata(res); if (ret < 0) { _E("Failed to save battery initdata for '%s' resource", @@ -972,7 +954,6 @@ int pass_hal_restore_initdata(struct pass_resource *res) } /* fall through */ case PASS_RESOURCE_BATTERY_ID: - case PASS_RESOURCE_NONSTANDARD_ID: ret = pass_hal_restore_battery_initdata(res); if (ret < 0) { _E("Failed to restore battery initdata for '%s' resource", diff --git a/src/pass/pass-hal.h b/src/pass/pass-hal.h index 459f04f..bcb00ef 100644 --- a/src/pass/pass-hal.h +++ b/src/pass/pass-hal.h @@ -109,17 +109,4 @@ int pass_hal_set_online_max_num(struct pass_resource *res, int num); int pass_hal_get_fault_around_bytes(struct pass_resource *res); int pass_hal_set_fault_around_bytes(struct pass_resource *res, int fault_around_bytes); - -/*** - * Functions for Nonstandard H/W resources - */ -/* - * NOTE: It is not propper method. But PASS must need to keep - * the backwards compatibility, set the PMQoS's data from - * platform to hal. So, It is not recommended to use it. - * - * This function will be removed after finding the proper method. - */ -int pass_hal_set_pmqos_data(struct pass_resource *res, void *data); - #endif /* __PASS_HAL__ */ diff --git a/src/pass/pass-parser.c b/src/pass/pass-parser.c index ae9fc90..d2542a4 100644 --- a/src/pass/pass-parser.c +++ b/src/pass/pass-parser.c @@ -711,8 +711,6 @@ static int parse_resource_data(struct pass *pass, int id, json_object *obj) config_data->res_type = PASS_RESOURCE_DISK_ID; else if (!strncmp(device_type, PASS_RESOURCE_NETWORK_NAME, strlen(device_type))) config_data->res_type = PASS_RESOURCE_NETWORK_ID; - else if (!strncmp(device_type, PASS_RESOURCE_NONSTANDARD_NAME, strlen(device_type))) - config_data->res_type = PASS_RESOURCE_NONSTANDARD_ID; else { _E("Unknown 'device_type' property value (%s)\n", device_type); return -EINVAL; diff --git a/src/pass/pass-rescon.c b/src/pass/pass-rescon.c index a42f421..3e57f59 100644 --- a/src/pass/pass-rescon.c +++ b/src/pass/pass-rescon.c @@ -244,7 +244,6 @@ static int rescon_update(struct pass_resource *res) limit_min_freq = adjusted_level.limit_min_freq; /* fall through */ case PASS_RESOURCE_BATTERY_ID: - case PASS_RESOURCE_NONSTANDARD_ID: cooling_device_state = adjusted_level.cooling_device_state; charging_status = adjusted_level.charging_status; charging_current_uA = adjusted_level.charging_current_uA; @@ -693,14 +692,6 @@ int pass_rescon_set_scenario_level_sync_with_data(struct pass_resource *res, if (!res) return -EINVAL; - /* - * FIXME: PMQoS core sends the raw data to the HAL in order to - * support the backwards compatibility. This function call will - * be removed after finding the proper method. - */ - if (data) - pass_hal_set_pmqos_data(res, data); - rescon_set_scenario_level(res, scenario_level); return rescon_update(res); @@ -720,14 +711,6 @@ int pass_rescon_unset_scenario_level_sync_with_data(struct pass_resource *res, if (!res) return -EINVAL; - /* - * FIXME: PMQoS core sends the raw data to the HAL in order to - * support the backwards compatibility. This function call will - * be removed after finding the proper method. - */ - if (data) - pass_hal_set_pmqos_data(res, data); - rescon_unset_scenario_level(res, scenario_level); return rescon_update(res); diff --git a/src/pass/pass.c b/src/pass/pass.c index fa6d2b4..aa4ca04 100644 --- a/src/pass/pass.c +++ b/src/pass/pass.c @@ -82,12 +82,6 @@ static uint64 supported_module[] = { | PASS_MODULE_RESMON | PASS_MODULE_PMQOS | PASS_MODULE_THERMAL, - - [PASS_RESOURCE_NONSTANDARD_ID] = PASS_MODULE_PARSER - | PASS_MODULE_RESCON - | PASS_MODULE_RESMON - | PASS_MODULE_PMQOS - | PASS_MODULE_THERMAL, }; extern int pass_cpuhp_init(struct pass_resource *res); diff --git a/src/pass/pass.h b/src/pass/pass.h index 1a1d5c2..2213e88 100644 --- a/src/pass/pass.h +++ b/src/pass/pass.h @@ -160,7 +160,6 @@ struct pass_level { * - PASS_RESOURCE_BUS_ID * - PASS_RESOURCE_GPU_ID * - PASS_RESOURCE_BATTERY_ID - * - PASS_RESOURCE_NONSTANDARD_ID */ int cooling_device_state; @@ -168,7 +167,6 @@ struct pass_level { * The current state of battery charging device * and this property is used for the following resources: * - PASS_RESOURCE_BATTERY_ID - * - PASS_RESOURCE_NONSTANDARD_ID */ int charging_status; int charging_current_uA; @@ -393,7 +391,6 @@ struct pass_resource_config_data { * - 2: PASS_RESOURCE_BUS_ID * - 3: PASS_RESOURCE_GPU_ID * - 4: PASS_RESOURCE_MEMORY_ID - * - 99: PASS_RESOURCE_NONSTANDARD_ID */ unsigned int res_type; /** @@ -554,8 +551,6 @@ struct pass_resource { * - If res_type of cdata is PASS_RESOURCE_GPU_ID, hal.gpu will be used. * - If res_type of cdata is PASS_RESOURCE_MEMORY_ID, * hal.memory will be used. - * - If res_type of cdata is PASS_RESOURCE_NONSTANDARD_ID, - * hal.nonstandard will be used. */ union { /** Instance for CPU h/w resource */ @@ -566,8 +561,6 @@ struct pass_resource { struct pass_resource_gpu *gpu; /** Instance for Memory h/w resource */ struct pass_resource_memory *memory; - /** Instance for Nonstandard h/w resource */ - struct pass_resource_nonstandard *nonstandard; } hal; /** Instance of PASS_MODULE_RESCON module */ diff --git a/tests/haltest/power-haltests.cpp b/tests/haltest/power-haltests.cpp index d336cf9..24fc6af 100644 --- a/tests/haltest/power-haltests.cpp +++ b/tests/haltest/power-haltests.cpp @@ -519,22 +519,6 @@ TEST_F(PowerHaltest, SetFaultAroundBytes_HandlesValidInput) } } -TEST_F(PowerHaltest, SetPmqosData_HandlesValidInput) -{ - int ret = 0; - unsigned int i; - char applaunch_scenario[] = "AppLaunch"; - - for (i = 0; i < g_pass.num_resources; i++) { - struct pass_resource *res = &g_pass.res[i]; - - ret = pass_hal_set_pmqos_data(res, applaunch_scenario); - if (haltest_is_failed(res, ret)) { - ASSERT_EQ(ret, 0) << "SetPmqosData Failed"; - } - } -} - TEST_F(PowerHaltest, PutResourceConfig_HandlesValidInput) { int ret = 0; diff --git a/tests/pass-unittests.cc b/tests/pass-unittests.cc index 0f982c7..8ded143 100644 --- a/tests/pass-unittests.cc +++ b/tests/pass-unittests.cc @@ -477,22 +477,6 @@ TEST_F(PassHalTest, pass_hal_set_fault_around_bytes) { EXPECT_NE(ret, 0); } -TEST_F(PassHalTest, pass_hal_set_pmqos_data) { - struct pass_resource res; - char buf[BUFF_MAX]; - int ret; - - EXPECT_CALL(*gHalApiPowerMock, hal_power_misc_set_pmqos_data(_, _, _)) - .WillRepeatedly(Return(0)); - - ret = pass_hal_set_pmqos_data(&res, (void *)buf); - EXPECT_EQ(ret, 0); - ret = pass_hal_set_pmqos_data(NULL, (void *)buf); - EXPECT_NE(ret, 0); - ret = pass_hal_set_pmqos_data(NULL, NULL); - EXPECT_NE(ret, 0); -} - /* Unittest of pass-parser module */ class PassParserTest : public testing::Test { public: diff --git a/tests/unittest/pass-hal-and-parser/hal-api-power-mock.cpp b/tests/unittest/pass-hal-and-parser/hal-api-power-mock.cpp index b9a550f..a0993b9 100644 --- a/tests/unittest/pass-hal-and-parser/hal-api-power-mock.cpp +++ b/tests/unittest/pass-hal-and-parser/hal-api-power-mock.cpp @@ -338,15 +338,3 @@ int hal_power_memory_set_fault_around_bytes(unsigned int res_type, char *res_nam return gHalApiPowerMock->hal_power_memory_set_fault_around_bytes( res_type, res_name, fault_around_bytes); } - -/** - * Miscellaneous Operation for CPU/BUS/GPU H/W - */ -int hal_power_misc_set_pmqos_data(unsigned int res_type, char *res_name, void *data) -{ - if (!gHalApiPowerMock) - return -ENOTSUP; - - return gHalApiPowerMock->hal_power_misc_set_pmqos_data( - res_type, res_name, data); -} diff --git a/tests/unittest/pass-hal-and-parser/hal-api-power-mock.hpp b/tests/unittest/pass-hal-and-parser/hal-api-power-mock.hpp index e03c2ba..2fdc88b 100644 --- a/tests/unittest/pass-hal-and-parser/hal-api-power-mock.hpp +++ b/tests/unittest/pass-hal-and-parser/hal-api-power-mock.hpp @@ -117,11 +117,6 @@ public: /* Get and set the /sys/kernel/debug/fault_around_bytes */ virtual int hal_power_memory_get_fault_around_bytes(unsigned int res_type, char *res_name) = 0; virtual int hal_power_memory_set_fault_around_bytes(unsigned int res_type, char *res_name, int fault_around_bytes) = 0; - - /** - * Miscellaneous Operation for CPU/BUS/GPU H/W - */ - virtual int hal_power_misc_set_pmqos_data(unsigned int res_type, char *res_name, void *data) = 0; }; class HalApiPowerMock:HalApiPowerMockInterface { @@ -175,9 +170,6 @@ public: MOCK_METHOD2(hal_power_memory_get_fault_around_bytes, int (unsigned int res_type, char *res_name)); MOCK_METHOD3(hal_power_memory_set_fault_around_bytes, int (unsigned int res_type, char *res_name, int fault_around_bytes)); - - MOCK_METHOD3(hal_power_misc_set_pmqos_data, int (unsigned int res_type, char *res_name, void *data)); - }; extern HalApiPowerMock *gHalApiPowerMock; diff --git a/tests/unittest/pass-hal-and-parser/pass-hal-and-parser-unittests.cc b/tests/unittest/pass-hal-and-parser/pass-hal-and-parser-unittests.cc index cda27aa..cfe3f0f 100644 --- a/tests/unittest/pass-hal-and-parser/pass-hal-and-parser-unittests.cc +++ b/tests/unittest/pass-hal-and-parser/pass-hal-and-parser-unittests.cc @@ -475,22 +475,6 @@ TEST_F(PassHalTest, pass_hal_set_fault_around_bytes) { EXPECT_NE(ret, 0); } -TEST_F(PassHalTest, pass_hal_set_pmqos_data) { - struct pass_resource res; - char buf[BUFF_MAX]; - int ret; - - EXPECT_CALL(*gHalApiPowerMock, hal_power_misc_set_pmqos_data(_, _, _)) - .WillRepeatedly(Return(0)); - - ret = pass_hal_set_pmqos_data(&res, (void *)buf); - EXPECT_EQ(ret, 0); - ret = pass_hal_set_pmqos_data(NULL, (void *)buf); - EXPECT_NE(ret, 0); - ret = pass_hal_set_pmqos_data(NULL, NULL); - EXPECT_NE(ret, 0); -} - /* Unittest of pass-parser module */ class PassParserTest : public testing::Test { public: diff --git a/tests/unittest/pass-rescon/pass-hal-mock.cpp b/tests/unittest/pass-rescon/pass-hal-mock.cpp index 5f3eb2f..d166ea1 100644 --- a/tests/unittest/pass-rescon/pass-hal-mock.cpp +++ b/tests/unittest/pass-rescon/pass-hal-mock.cpp @@ -261,14 +261,6 @@ int pass_hal_get_fault_around_bytes(struct pass_resource *res) return gPassHalMock->pass_hal_get_fault_around_bytes(res); } -int pass_hal_set_pmqos_data(struct pass_resource *res, void *data) -{ - if (!gPassHalMock) - return -ENOTSUP; - - return gPassHalMock->pass_hal_set_pmqos_data(res, data); -} - int pass_hal_save_initdata(struct pass_resource *res) { if (!gPassHalMock) diff --git a/tests/unittest/pass-rescon/pass-hal-mock.hpp b/tests/unittest/pass-rescon/pass-hal-mock.hpp index 6d93b8e..c95653a 100644 --- a/tests/unittest/pass-rescon/pass-hal-mock.hpp +++ b/tests/unittest/pass-rescon/pass-hal-mock.hpp @@ -108,18 +108,6 @@ public: /* Get and set the /sys/kernel/debug/fault_around_bytes */ virtual int pass_hal_get_fault_around_bytes(struct pass_resource *res) = 0; virtual int pass_hal_set_fault_around_bytes(struct pass_resource *res, int fault_around_bytes) = 0; - - /*** - * Functions for Nonstandard H/W resources - */ - /* - * NOTE: It is not propper method. But PASS must need to keep - * the backwards compatibility, set the PMQoS's data from - * platform to hal. So, It is not recommended to use it. - * - * This function will be removed after finding the proper method. - */ - virtual int pass_hal_set_pmqos_data(struct pass_resource *res, void *data) = 0; }; class PassHalMock:PassHalMockInterface { @@ -197,19 +185,6 @@ public: /* Get and set the /sys/kernel/debug/fault_around_bytes */ MOCK_METHOD1(pass_hal_get_fault_around_bytes, int (struct pass_resource *res)); MOCK_METHOD2(pass_hal_set_fault_around_bytes, int (struct pass_resource *res, int fault_around_bytes)); - - /*** - * Functions for Nonstandard H/W resources - */ - /* - * NOTE: It is not propper method. But PASS must need to keep - * the backwards compatibility, set the PMQoS's data from - * platform to hal. So, It is not recommended to use it. - * - * This function will be removed after finding the proper method. - */ - MOCK_METHOD2(pass_hal_set_pmqos_data, int (struct pass_resource *res, void *data)); - }; extern PassHalMock *gPassHalMock; diff --git a/tests/unittest/pass-rescon/pass-rescon-unittests.cc b/tests/unittest/pass-rescon/pass-rescon-unittests.cc index 315d4ef..cdea3c6 100644 --- a/tests/unittest/pass-rescon/pass-rescon-unittests.cc +++ b/tests/unittest/pass-rescon/pass-rescon-unittests.cc @@ -105,15 +105,6 @@ static void init_pass_hal(void) /* Get and set the /sys/kernel/debug/fault_around_bytes */ EXPECT_CALL(*gPassHalMock, pass_hal_get_fault_around_bytes(_)).WillRepeatedly(Return(0)); EXPECT_CALL(*gPassHalMock, pass_hal_set_fault_around_bytes(_, _)).WillRepeatedly(Return(0)); - - /* - * NOTE: It is not propper method. But PASS must need to keep - * the backwards compatibility, set the PMQoS's data from - * platform to hal. So, It is not recommended to use it. - * - * This function will be removed after finding the proper method. - */ - EXPECT_CALL(*gPassHalMock, pass_hal_set_pmqos_data(_, _)).WillRepeatedly(Return(0)); } static void exit_pass_hal(void) diff --git a/tests/unittest/pass-resmon/pass-hal-mock.cpp b/tests/unittest/pass-resmon/pass-hal-mock.cpp index 5f3eb2f..d166ea1 100644 --- a/tests/unittest/pass-resmon/pass-hal-mock.cpp +++ b/tests/unittest/pass-resmon/pass-hal-mock.cpp @@ -261,14 +261,6 @@ int pass_hal_get_fault_around_bytes(struct pass_resource *res) return gPassHalMock->pass_hal_get_fault_around_bytes(res); } -int pass_hal_set_pmqos_data(struct pass_resource *res, void *data) -{ - if (!gPassHalMock) - return -ENOTSUP; - - return gPassHalMock->pass_hal_set_pmqos_data(res, data); -} - int pass_hal_save_initdata(struct pass_resource *res) { if (!gPassHalMock) diff --git a/tests/unittest/pass-resmon/pass-hal-mock.hpp b/tests/unittest/pass-resmon/pass-hal-mock.hpp index 6d93b8e..c95653a 100644 --- a/tests/unittest/pass-resmon/pass-hal-mock.hpp +++ b/tests/unittest/pass-resmon/pass-hal-mock.hpp @@ -108,18 +108,6 @@ public: /* Get and set the /sys/kernel/debug/fault_around_bytes */ virtual int pass_hal_get_fault_around_bytes(struct pass_resource *res) = 0; virtual int pass_hal_set_fault_around_bytes(struct pass_resource *res, int fault_around_bytes) = 0; - - /*** - * Functions for Nonstandard H/W resources - */ - /* - * NOTE: It is not propper method. But PASS must need to keep - * the backwards compatibility, set the PMQoS's data from - * platform to hal. So, It is not recommended to use it. - * - * This function will be removed after finding the proper method. - */ - virtual int pass_hal_set_pmqos_data(struct pass_resource *res, void *data) = 0; }; class PassHalMock:PassHalMockInterface { @@ -197,19 +185,6 @@ public: /* Get and set the /sys/kernel/debug/fault_around_bytes */ MOCK_METHOD1(pass_hal_get_fault_around_bytes, int (struct pass_resource *res)); MOCK_METHOD2(pass_hal_set_fault_around_bytes, int (struct pass_resource *res, int fault_around_bytes)); - - /*** - * Functions for Nonstandard H/W resources - */ - /* - * NOTE: It is not propper method. But PASS must need to keep - * the backwards compatibility, set the PMQoS's data from - * platform to hal. So, It is not recommended to use it. - * - * This function will be removed after finding the proper method. - */ - MOCK_METHOD2(pass_hal_set_pmqos_data, int (struct pass_resource *res, void *data)); - }; extern PassHalMock *gPassHalMock; diff --git a/tests/unittest/pass-resmon/pass-resmon-unittests.cc b/tests/unittest/pass-resmon/pass-resmon-unittests.cc index 9740128..9c1be4e 100644 --- a/tests/unittest/pass-resmon/pass-resmon-unittests.cc +++ b/tests/unittest/pass-resmon/pass-resmon-unittests.cc @@ -106,15 +106,6 @@ static void init_pass_hal(void) /* Get and set the /sys/kernel/debug/fault_around_bytes */ EXPECT_CALL(*gPassHalMock, pass_hal_get_fault_around_bytes(_)).WillRepeatedly(Return(0)); EXPECT_CALL(*gPassHalMock, pass_hal_set_fault_around_bytes(_, _)).WillRepeatedly(Return(0)); - - /* - * NOTE: It is not propper method. But PASS must need to keep - * the backwards compatibility, set the PMQoS's data from - * platform to hal. So, It is not recommended to use it. - * - * This function will be removed after finding the proper method. - */ - EXPECT_CALL(*gPassHalMock, pass_hal_set_pmqos_data(_, _)).WillRepeatedly(Return(0)); } static void exit_pass_hal(void) -- 2.34.1