]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
selftests: centralise maybe-unused definition in kselftest.h
authorBala-Vignesh-Reddy <reddybalavignesh9979@gmail.com>
Thu, 21 Aug 2025 10:11:59 +0000 (15:41 +0530)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:25:16 +0000 (17:25 -0700)
Several selftests subdirectories duplicated the define __maybe_unused,
leading to redundant code.  Move to kselftest.h header and remove other
definitions.

This addresses the duplication noted in the proc-pid-vm warning fix

Link: https://lkml.kernel.org/r/20250821101159.2238-1-reddybalavignesh9979@gmail.com
Signed-off-by: Bala-Vignesh-Reddy <reddybalavignesh9979@gmail.com>
Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Link:https://lore.kernel.org/lkml/20250820143954.33d95635e504e94df01930d0@linux-foundation.org/
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Acked-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Acked-by: Mickal Salan <mic@digikod.net> [landlock]
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/kselftest.h
tools/testing/selftests/landlock/audit.h
tools/testing/selftests/landlock/common.h
tools/testing/selftests/mm/pkey-helpers.h
tools/testing/selftests/net/psock_lib.h
tools/testing/selftests/perf_events/watermark_signal.c
tools/testing/selftests/ublk/utils.h

index c3b6d2604b1e486af5a224a11386f75fe0a83495..661d31c4b558c1659d83385bf6bb37eaf8252ddc 100644 (file)
 #endif
 #define __printf(a, b)   __attribute__((format(printf, a, b)))
 
+#ifndef __maybe_unused
+#define __maybe_unused __attribute__((__unused__))
+#endif
+
 /* counters */
 struct ksft_count {
        unsigned int ksft_pass;
index b16986aa64427b5b1d11ed55bc91c8bdefc691f7..02fd1393947a7aaf0cdad0d5008542264ff2aaf1 100644 (file)
 #include <sys/time.h>
 #include <unistd.h>
 
+#include "../kselftest.h"
+
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 #endif
 
-#ifndef __maybe_unused
-#define __maybe_unused __attribute__((__unused__))
-#endif
-
 #define REGEX_LANDLOCK_PREFIX "^audit([0-9.:]\\+): domain=\\([0-9a-f]\\+\\)"
 
 struct audit_filter {
index 88a3c78f5d981f43ce77dd7ca2caa7b4bb74b109..9acecae36f51ba2651e958a85d069037b9ae6ffc 100644 (file)
 
 #define TMP_DIR "tmp"
 
-#ifndef __maybe_unused
-#define __maybe_unused __attribute__((__unused__))
-#endif
-
 /* TEST_F_FORK() should not be used for new tests. */
 #define TEST_F_FORK(fixture_name, test_name) TEST_F(fixture_name, test_name)
 
index ea404f80e6cb929c35beaa0dead26d9e9dc8abac..fa15f006fa68c8b45fc7888a8dc5deedd0097cc9 100644 (file)
@@ -84,9 +84,6 @@ extern void abort_hooks(void);
 #ifndef noinline
 # define noinline __attribute__((noinline))
 #endif
-#ifndef __maybe_unused
-# define __maybe_unused __attribute__((__unused__))
-#endif
 
 int sys_pkey_alloc(unsigned long flags, unsigned long init_val);
 int sys_pkey_free(unsigned long pkey);
index 6e4fef560873be09978b0da1f0a30bff13791c16..067265b0a554d0faba61f3c1922e9ca1fdde82a6 100644 (file)
 
 #define PORT_BASE                      8000
 
-#ifndef __maybe_unused
-# define __maybe_unused                __attribute__ ((__unused__))
-#endif
-
 static __maybe_unused void pair_udp_setfilter(int fd)
 {
        /* the filter below checks for all of the following conditions that
index e03fe1b9bba2f803cad086a609bb7b1d2eee851c..b3a72f0ac5221adb058c6804a196ad1adef6a3c5 100644 (file)
@@ -17,8 +17,6 @@
 
 #include "../kselftest_harness.h"
 
-#define __maybe_unused __attribute__((__unused__))
-
 static int sigio_count;
 
 static void handle_sigio(int signum __maybe_unused,
index 36545d1567f1f2b5209a2c99d15b78ec883a5d1c..a852e0b7153e2d2b59b5ac641363345f5b11a5b5 100644 (file)
@@ -2,8 +2,6 @@
 #ifndef KUBLK_UTILS_H
 #define KUBLK_UTILS_H
 
-#define __maybe_unused __attribute__((unused))
-
 #ifndef min
 #define min(a, b) ((a) < (b) ? (a) : (b))
 #endif