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/tests/kutf/kutf_suite.c |   94 +++++++++++++++++++++-------------------------
 1 files changed, 43 insertions(+), 51 deletions(-)

diff --git a/kernel/drivers/gpu/arm/bifrost/tests/kutf/kutf_suite.c b/kernel/drivers/gpu/arm/bifrost/tests/kutf/kutf_suite.c
index 6745299..4468066 100644
--- a/kernel/drivers/gpu/arm/bifrost/tests/kutf/kutf_suite.c
+++ b/kernel/drivers/gpu/arm/bifrost/tests/kutf/kutf_suite.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
 /*
  *
- * (C) COPYRIGHT 2014, 2017-2021 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2017-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
@@ -106,22 +106,16 @@
 	enum kutf_result_status result;
 };
 
-struct kutf_convert_table kutf_convert[] = {
-#define ADD_UTF_RESULT(_name) \
-{ \
-	#_name, \
-	_name, \
-},
-ADD_UTF_RESULT(KUTF_RESULT_BENCHMARK)
-ADD_UTF_RESULT(KUTF_RESULT_SKIP)
-ADD_UTF_RESULT(KUTF_RESULT_UNKNOWN)
-ADD_UTF_RESULT(KUTF_RESULT_PASS)
-ADD_UTF_RESULT(KUTF_RESULT_DEBUG)
-ADD_UTF_RESULT(KUTF_RESULT_INFO)
-ADD_UTF_RESULT(KUTF_RESULT_WARN)
-ADD_UTF_RESULT(KUTF_RESULT_FAIL)
-ADD_UTF_RESULT(KUTF_RESULT_FATAL)
-ADD_UTF_RESULT(KUTF_RESULT_ABORT)
+static const struct kutf_convert_table kutf_convert[] = {
+#define ADD_UTF_RESULT(_name)                                                                      \
+	{                                                                                          \
+#_name, _name,                                                                     \
+	}
+	ADD_UTF_RESULT(KUTF_RESULT_BENCHMARK), ADD_UTF_RESULT(KUTF_RESULT_SKIP),
+	ADD_UTF_RESULT(KUTF_RESULT_UNKNOWN),   ADD_UTF_RESULT(KUTF_RESULT_PASS),
+	ADD_UTF_RESULT(KUTF_RESULT_DEBUG),     ADD_UTF_RESULT(KUTF_RESULT_INFO),
+	ADD_UTF_RESULT(KUTF_RESULT_WARN),      ADD_UTF_RESULT(KUTF_RESULT_FAIL),
+	ADD_UTF_RESULT(KUTF_RESULT_FATAL),     ADD_UTF_RESULT(KUTF_RESULT_ABORT),
 };
 
 #define UTF_CONVERT_SIZE (ARRAY_SIZE(kutf_convert))
@@ -191,8 +185,7 @@
  *
  * Return: 1 if test result was successfully converted to string, 0 otherwise
  */
-static int kutf_result_to_string(char **result_str,
-		enum kutf_result_status result)
+static int kutf_result_to_string(const char **result_str, enum kutf_result_status result)
 {
 	int i;
 	int ret = 0;
@@ -319,7 +312,8 @@
 }
 
 /**
- * kutf_debugfs_run_open() Debugfs open callback for the "run" entry.
+ * kutf_debugfs_run_open() - Debugfs open callback for the "run" entry.
+ *
  * @inode:	inode of the opened file
  * @file:	Opened file to read from
  *
@@ -381,7 +375,7 @@
 	struct kutf_result *res;
 	unsigned long bytes_not_copied;
 	ssize_t bytes_copied = 0;
-	char *kutf_str_ptr = NULL;
+	const char *kutf_str_ptr = NULL;
 	size_t kutf_str_len = 0;
 	size_t message_len = 0;
 	char separator = ':';
@@ -493,7 +487,7 @@
 }
 
 /**
- * kutf_debugfs_run_write() Debugfs write callback for the "run" entry.
+ * kutf_debugfs_run_write() - Debugfs write callback for the "run" entry.
  * @file:	Opened file to write to
  * @buf:	User buffer to read the data from
  * @len:	Amount of data to write
@@ -582,31 +576,27 @@
 
 	snprintf(name, sizeof(name), "%d", fixture_index);
 	test_fix->dir = debugfs_create_dir(name, test_func->dir);
-	if (!test_func->dir) {
+	if (IS_ERR_OR_NULL(test_func->dir)) {
 		pr_err("Failed to create debugfs directory when adding fixture\n");
 		/* Might not be the right error, we don't get it passed back to us */
 		err = -EEXIST;
 		goto fail_dir;
 	}
 
-	tmp = debugfs_create_file("type", S_IROTH, test_fix->dir, "fixture\n",
+	tmp = debugfs_create_file("type", 0004, test_fix->dir, "fixture\n",
 				  &kutf_debugfs_const_string_ops);
-	if (!tmp) {
+	if (IS_ERR_OR_NULL(tmp)) {
 		pr_err("Failed to create debugfs file \"type\" when adding fixture\n");
 		/* Might not be the right error, we don't get it passed back to us */
 		err = -EEXIST;
 		goto fail_file;
 	}
 
-#if KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE
 	tmp = debugfs_create_file_unsafe(
-#else
-	tmp = debugfs_create_file(
-#endif
 			"run", 0600, test_fix->dir,
 			test_fix,
 			&kutf_debugfs_run_ops);
-	if (!tmp) {
+	if (IS_ERR_OR_NULL(tmp)) {
 		pr_err("Failed to create debugfs file \"run\" when adding fixture\n");
 		/* Might not be the right error, we don't get it passed back to us */
 		err = -EEXIST;
@@ -666,39 +656,39 @@
 	INIT_LIST_HEAD(&test_func->variant_list);
 
 	test_func->dir = debugfs_create_dir(name, suite->dir);
-	if (!test_func->dir) {
+	if (IS_ERR_OR_NULL(test_func->dir)) {
 		pr_err("Failed to create debugfs directory when adding test %s\n", name);
 		goto fail_dir;
 	}
 
-	tmp = debugfs_create_file("type", S_IROTH, test_func->dir, "test\n",
+	tmp = debugfs_create_file("type", 0004, test_func->dir, "test\n",
 				  &kutf_debugfs_const_string_ops);
-	if (!tmp) {
+	if (IS_ERR_OR_NULL(tmp)) {
 		pr_err("Failed to create debugfs file \"type\" when adding test %s\n", name);
 		goto fail_file;
 	}
 
 	test_func->filters = filters;
 #if KERNEL_VERSION(5, 5, 0) <= LINUX_VERSION_CODE
-	tmp = debugfs_create_file_unsafe("filters", S_IROTH, test_func->dir,
+	tmp = debugfs_create_file_unsafe("filters", 0004, test_func->dir,
 					 &test_func->filters, &kutfp_fops_x32_ro);
 #else
-	tmp = debugfs_create_x32("filters", S_IROTH, test_func->dir,
+	tmp = debugfs_create_x32("filters", 0004, test_func->dir,
 				 &test_func->filters);
 #endif
-	if (!tmp) {
+	if (IS_ERR_OR_NULL(tmp)) {
 		pr_err("Failed to create debugfs file \"filters\" when adding test %s\n", name);
 		goto fail_file;
 	}
 
 	test_func->test_id = id;
 #if KERNEL_VERSION(5, 5, 0) <= LINUX_VERSION_CODE
-	debugfs_create_u32("test_id", S_IROTH, test_func->dir,
-                       &test_func->test_id);
+	debugfs_create_u32("test_id", 0004, test_func->dir,
+		&test_func->test_id);
 #else
-	tmp = debugfs_create_u32("test_id", S_IROTH, test_func->dir,
+	tmp = debugfs_create_u32("test_id", 0004, test_func->dir,
 				 &test_func->test_id);
-	if (!tmp) {
+	if (IS_ERR_OR_NULL(tmp)) {
 		pr_err("Failed to create debugfs file \"test_id\" when adding test %s\n", name);
 		goto fail_file;
 	}
@@ -766,7 +756,7 @@
 EXPORT_SYMBOL(kutf_add_test);
 
 /**
- * kutf_remove_test(): Remove a previously added test function.
+ * kutf_remove_test() - Remove a previously added test function.
  * @test_func: Test function
  */
 static void kutf_remove_test(struct kutf_test_function *test_func)
@@ -805,14 +795,14 @@
 	}
 
 	suite->dir = debugfs_create_dir(name, app->dir);
-	if (!suite->dir) {
+	if (IS_ERR_OR_NULL(suite->dir)) {
 		pr_err("Failed to create debugfs directory when adding test %s\n", name);
 		goto fail_debugfs;
 	}
 
-	tmp = debugfs_create_file("type", S_IROTH, suite->dir, "suite\n",
+	tmp = debugfs_create_file("type", 0004, suite->dir, "suite\n",
 				  &kutf_debugfs_const_string_ops);
-	if (!tmp) {
+	if (IS_ERR_OR_NULL(tmp)) {
 		pr_err("Failed to create debugfs file \"type\" when adding test %s\n", name);
 		goto fail_file;
 	}
@@ -913,14 +903,14 @@
 	}
 
 	app->dir = debugfs_create_dir(name, base_dir);
-	if (!app->dir) {
+	if (IS_ERR_OR_NULL(app->dir)) {
 		pr_err("Failed to create debugfs direcotry when creating application %s\n", name);
 		goto fail_debugfs;
 	}
 
-	tmp = debugfs_create_file("type", S_IROTH, app->dir, "application\n",
+	tmp = debugfs_create_file("type", 0004, app->dir, "application\n",
 				  &kutf_debugfs_const_string_ops);
-	if (!tmp) {
+	if (IS_ERR_OR_NULL(tmp)) {
 		pr_err("Failed to create debugfs file \"type\" when creating application %s\n", name);
 		goto fail_file;
 	}
@@ -1162,8 +1152,9 @@
 
 /**
  * init_kutf_core() - Module entry point.
- *
  * Create the base entry point in debugfs.
+ *
+ * Return: 0 on success, error code otherwise.
  */
 static int __init init_kutf_core(void)
 {
@@ -1172,7 +1163,7 @@
 		return -ENOMEM;
 
 	base_dir = debugfs_create_dir("kutf_tests", NULL);
-	if (!base_dir) {
+	if (IS_ERR_OR_NULL(base_dir)) {
 		destroy_workqueue(kutf_workq);
 		kutf_workq = NULL;
 		return -ENOMEM;
@@ -1197,9 +1188,10 @@
 #else	/* CONFIG_DEBUG_FS */
 
 /**
- * init_kutf_core() - Module entry point.
+ * init_kutf_core - Module entry point
+ * Stub for when build against a kernel without debugfs support.
  *
- * Stub for when build against a kernel without debugfs support
+ * Return: -ENODEV
  */
 static int __init init_kutf_core(void)
 {

--
Gitblit v1.6.2