]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
selftests/mm: centralize the __always_unused macro
authorMuhammad Usama Anjum <usama.anjum@collabora.com>
Fri, 12 Sep 2025 12:51:01 +0000 (17:51 +0500)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 21 Sep 2025 21:22:33 +0000 (14:22 -0700)
This macro gets used in different tests.  Add it to kselftest.h which is
central location and tests use this header.  Then use this new macro.

Link: https://lkml.kernel.org/r/20250912125102.1309796-1-usama.anjum@collabora.com
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Antonio Quartulli <antonio@openvpn.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kacinski <kuba@kernel.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: "Sabrina Dubroca" <sd@queasysnail.net>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Simon Horman <horms@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/kselftest.h
tools/testing/selftests/mm/protection_keys.c
tools/testing/selftests/net/ovpn/ovpn-cli.c

index 661d31c4b558c1659d83385bf6bb37eaf8252ddc..274480e3573ab4dfef930837503f29d10519ab7e 100644 (file)
 #endif
 #define __printf(a, b)   __attribute__((format(printf, a, b)))
 
+#ifndef __always_unused
+#define __always_unused __attribute__((__unused__))
+#endif
+
 #ifndef __maybe_unused
 #define __maybe_unused __attribute__((__unused__))
 #endif
index 23ebec367015fd195eb9feabe252d55009aa839a..c02fb204547e01dd1e28f3b49cca068ff4ef48f1 100644 (file)
@@ -1304,7 +1304,7 @@ static void test_mprotect_with_pkey_0(int *ptr, u16 pkey)
 
 static void test_ptrace_of_child(int *ptr, u16 pkey)
 {
-       __attribute__((__unused__)) int peek_result;
+       __always_unused int peek_result;
        pid_t child_pid;
        void *ignored = 0;
        long ret;
index 9201f2905f2ceeddf7640d82874ef04ffe182091..688a5fa6fdacdc2c49282d75bf9d4811692f986b 100644 (file)
 
 #include <sys/socket.h>
 
+#include "../../kselftest.h"
+
 /* defines to make checkpatch happy */
 #define strscpy strncpy
-#define __always_unused __attribute__((__unused__))
 
 /* libnl < 3.5.0 does not set the NLA_F_NESTED on its own, therefore we
  * have to explicitly do it to prevent the kernel from failing upon