From c956e76e2b0672138c942c964987b0176e995b51 Mon Sep 17 00:00:00 2001 From: Leandro Belli Date: Thu, 17 Feb 2022 21:26:59 +0000 Subject: [PATCH 1/2] traffic_cop: fix typo and suppress cppcheck This patch fixes a typo in Traffic Cop module header guard. After fixing this typo some cppcheck errors appear, those errors are suppressed. Signed-off-by: Leandro Belli Change-Id: I7e75eb61d215693f0c9461621af7af9cd98a2855 --- module/traffic_cop/include/mod_traffic_cop.h | 8 ++++---- module/traffic_cop/src/mod_traffic_cop.c | 2 +- tools/cppcheck_suppress_list.txt | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/module/traffic_cop/include/mod_traffic_cop.h b/module/traffic_cop/include/mod_traffic_cop.h index 26cbcdb10..7f2231c65 100644 --- a/module/traffic_cop/include/mod_traffic_cop.h +++ b/module/traffic_cop/include/mod_traffic_cop.h @@ -6,12 +6,12 @@ */ #ifndef MOD_TRAFFIC_COP_H -# define MOD_TRAFIC_COP_H +#define MOD_TRAFFIC_COP_H -# include +#include -# include -# include +#include +#include /*! * \ingroup GroupModules diff --git a/module/traffic_cop/src/mod_traffic_cop.c b/module/traffic_cop/src/mod_traffic_cop.c index f872551a2..f67fac5ad 100644 --- a/module/traffic_cop/src/mod_traffic_cop.c +++ b/module/traffic_cop/src/mod_traffic_cop.c @@ -95,7 +95,7 @@ static uint32_t tcop_evaluate_perf_limit(struct mod_tcop_domain_ctx *ctx) FWK_LOG_WARN( "[TRAFFIC_COP] No entry found in the PCT for %ld online cores", - ctx->num_cores_online); + (long)ctx->num_cores_online); return 0; } diff --git a/tools/cppcheck_suppress_list.txt b/tools/cppcheck_suppress_list.txt index 43ea80a4d..11c5dbef2 100755 --- a/tools/cppcheck_suppress_list.txt +++ b/tools/cppcheck_suppress_list.txt @@ -65,13 +65,16 @@ nullPointerRedundantCheck:*module/dmc500/src/mod_dmc500.c:65 nullPointerRedundantCheck:*module/mhu2/src/mod_mhu2.c:74 nullPointerRedundantCheck:*module/pl011/src/mod_pl011.c:139 nullPointerRedundantCheck:*module/pl011/src/mod_pl011.c:140 +nullPointerRedundantCheck:*module/ppu_v1/src/mod_ppu_v1.c:609 nullPointerRedundantCheck:*module/ppu_v1/src/mod_ppu_v1.c:620 +nullPointerRedundantCheck:*module/ppu_v1/src/mod_ppu_v1.c:642 nullPointerRedundantCheck:*module/ppu_v1/src/mod_ppu_v1.c:953 nullPointerRedundantCheck:*module/ppu_v1/src/mod_ppu_v1.c:954 nullPointerRedundantCheck:*module/reg_sensor/src/mod_reg_sensor.c:52 nullPointerRedundantCheck:*module/sds/src/mod_sds.c:273 nullPointerRedundantCheck:*module/sds/src/mod_sds.c:279 nullPointerRedundantCheck:*module/timer/src/mod_timer.c:541 +nullPointerRedundantCheck:*module/timer/src/mod_timer.c:551 nullPointerRedundantCheck:*module/timer/src/mod_timer.c:546 nullPointerRedundantCheck:*product/n1sdp/module/n1sdp_dmc620/src/mod_n1sdp_dmc620.c:1275 nullPointerRedundantCheck:*product/n1sdp/module/n1sdp_dmc620/src/mod_n1sdp_dmc620.c:1276 -- GitLab From 64086d8c9523f9070883b4772c27c9561299c86d Mon Sep 17 00:00:00 2001 From: Leandro Belli Date: Thu, 17 Feb 2022 19:21:11 +0000 Subject: [PATCH 2/2] thermal_mgmt: fix sensor reading implementation Sensor reading function was refactored and Thermal Management was not updated accordingly. This patch fixes this. Signed-off-by: Leandro Belli Change-Id: I2215f9d1664fdb3ca00212c8ed2ff262f5f7b408 --- module/thermal_mgmt/src/mod_thermal_mgmt.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/module/thermal_mgmt/src/mod_thermal_mgmt.c b/module/thermal_mgmt/src/mod_thermal_mgmt.c index 1b380fa26..8d2fd0421 100644 --- a/module/thermal_mgmt/src/mod_thermal_mgmt.c +++ b/module/thermal_mgmt/src/mod_thermal_mgmt.c @@ -98,6 +98,9 @@ struct mod_thermal_mgmt_ctx { /* Table of thermal actors */ struct mod_thermal_mgmt_dev_ctx *dev_ctx_table; + + /* Sensor data */ + struct mod_sensor_data sensor_data; }; #if THERMAL_HAS_ASYNC_SENSORS @@ -377,9 +380,10 @@ static int read_temperature(void) int status; uint64_t value; - status = mod_ctx.sensor_api->get_value(mod_ctx.config->sensor_id, &value); + status = mod_ctx.sensor_api->get_data( + mod_ctx.config->sensor_id, &mod_ctx.sensor_data); if (status == FWK_SUCCESS) { - mod_ctx.cur_temp = (uint32_t)value; + mod_ctx.cur_temp = (uint32_t)mod_ctx.sensor_data.value; mod_ctx.pi_control_needs_update = true; } @@ -573,23 +577,19 @@ static int thermal_mgmt_process_event( const struct fwk_event *event, struct fwk_event *resp_event) { - struct mod_sensor_event_params *params; - uint64_t value; int status; if (fwk_id_is_equal(event->id, mod_thermal_event_id_read_temp)) { /* Temperature-reading event */ - status = - mod_ctx.sensor_api->get_value(mod_ctx.config->sensor_id, &value); + status = mod_ctx.sensor_api->get_data( + mod_ctx.config->sensor_id, &mod_ctx.sensor_data); if (status == FWK_SUCCESS) { - mod_ctx.cur_temp = (uint32_t)value; + mod_ctx.cur_temp = (uint32_t)mod_ctx.sensor_data.value; } } else if (fwk_id_is_equal(event->id, mod_sensor_event_id_read_request)) { /* Response event from Sensor HAL */ - params = (struct mod_sensor_event_params *)event->params; - - if (params->status == FWK_SUCCESS) { - mod_ctx.cur_temp = (uint32_t)params->value; + if (mod_ctx.sensor_data.status == FWK_SUCCESS) { + mod_ctx.cur_temp = (uint32_t)mod_ctx.sensor_data.value; status = FWK_SUCCESS; } else { status = FWK_E_DEVICE; -- GitLab