From f70575805708cabdedea7498aaa3f710fde4d920 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Wed, 31 Jan 2024 03:29:01 +0000
Subject: [PATCH] add lvds1024*800

---
 kernel/drivers/gpu/arm/bifrost/ipa/mali_kbase_ipa_simple.c |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/kernel/drivers/gpu/arm/bifrost/ipa/mali_kbase_ipa_simple.c b/kernel/drivers/gpu/arm/bifrost/ipa/mali_kbase_ipa_simple.c
index c90894e..8557fe8 100644
--- a/kernel/drivers/gpu/arm/bifrost/ipa/mali_kbase_ipa_simple.c
+++ b/kernel/drivers/gpu/arm/bifrost/ipa/mali_kbase_ipa_simple.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
 /*
  *
- * (C) COPYRIGHT 2016-2018, 2020-2021 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2016-2018, 2020-2022 ARM Limited. All rights reserved.
  *
  * This program is free software and is provided to you under the terms of the
  * GNU General Public License version 2 as published by the Free Software
@@ -34,6 +34,8 @@
 #include "mali_kbase_ipa_simple.h"
 #include "mali_kbase_ipa_debugfs.h"
 
+#if MALI_USE_CSF
+
 /* This is used if the dynamic power for top-level is estimated separately
  * through the counter model. To roughly match the contribution of top-level
  * power in the total dynamic power, when calculated through counter model,
@@ -43,6 +45,8 @@
  * core power and then averaging it across all samples.
  */
 #define TOP_LEVEL_DYN_COEFF_SCALER (3)
+
+#endif /* MALI_USE_CSF */
 
 #if MALI_UNIT_TEST
 
@@ -232,14 +236,12 @@
 			(struct kbase_ipa_model_simple_data *)model->model_data;
 
 	err = kbase_ipa_model_add_param_s32(model, "static-coefficient",
-					    &model_data->static_coefficient,
-					    1, true);
+					    (s32 *)&model_data->static_coefficient, 1, true);
 	if (err)
 		goto end;
 
 	err = kbase_ipa_model_add_param_s32(model, "dynamic-coefficient",
-					    &model_data->dynamic_coefficient,
-					    1, true);
+					    (s32 *)&model_data->dynamic_coefficient, 1, true);
 	if (err)
 		goto end;
 
@@ -307,8 +309,12 @@
 		model_data->gpu_tz = NULL;
 	} else {
 		char tz_name[THERMAL_NAME_LENGTH];
+		u32 string_len = strscpy(tz_name, model_data->tz_name, sizeof(tz_name));
 
-		strlcpy(tz_name, model_data->tz_name, sizeof(tz_name));
+		string_len += sizeof(char);
+		/* Make sure that the source string fit into the buffer. */
+		KBASE_DEBUG_ASSERT(string_len <= sizeof(tz_name));
+		CSTD_UNUSED(string_len);
 
 		/* Release ipa.lock so that thermal_list_lock is not acquired
 		 * with ipa.lock held, thereby avoid lock ordering violation
@@ -322,8 +328,9 @@
 		mutex_lock(&model->kbdev->ipa.lock);
 
 		if (IS_ERR_OR_NULL(tz)) {
-			pr_warn_ratelimited("Error %ld getting thermal zone \'%s\', not yet ready?\n",
-					    PTR_ERR(tz), tz_name);
+			pr_warn_ratelimited(
+				"Error %d getting thermal zone \'%s\', not yet ready?\n",
+				PTR_ERR_OR_ZERO(tz), tz_name);
 			return -EPROBE_DEFER;
 		}
 

--
Gitblit v1.6.2