[PATCH v2 1/2] lib/test_string.c: Make definition less dense

Björn Töpel bjorn at kernel.org
Tue Feb 28 10:42:44 PST 2023


From: Björn Töpel <bjorn at rivosinc.com>

Checkpatch seems to have trouble making sense of the situation when
struct definitions, variable definitions, and __initconst marking is
done in one go.

Let's be nicer to checkpatch, and move the struct definition out,
which removes the error.

Signed-off-by: Björn Töpel <bjorn at rivosinc.com>
---
 lib/test_string.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lib/test_string.c b/lib/test_string.c
index c5cb92fb710e..550229084c41 100644
--- a/lib/test_string.c
+++ b/lib/test_string.c
@@ -179,15 +179,17 @@ static __init int strnchr_selftest(void)
 	return 0;
 }
 
+struct strspn_test {
+	const char str[16];
+	const char accept[16];
+	const char reject[16];
+	unsigned int a;
+	unsigned int r;
+};
+
 static __init int strspn_selftest(void)
 {
-	static const struct strspn_test {
-		const char str[16];
-		const char accept[16];
-		const char reject[16];
-		unsigned a;
-		unsigned r;
-	} tests[] __initconst = {
+	static const struct strspn_test tests[] __initconst = {
 		{ "foobar", "", "", 0, 6 },
 		{ "abba", "abc", "ABBA", 4, 4 },
 		{ "abba", "a", "b", 1, 1 },

base-commit: ae3419fbac845b4d3f3a9fae4cc80c68d82cdf6e
-- 
2.37.2




More information about the linux-riscv mailing list