linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/mm: centralize the __always_unused macro
@ 2025-09-12 12:51 Muhammad Usama Anjum
  2025-09-12 13:28 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: Muhammad Usama Anjum @ 2025-09-12 12:51 UTC (permalink / raw)
  To: Shuah Khan, Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Antonio Quartulli,
	Sabrina Dubroca, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman
  Cc: Muhammad Usama Anjum, kernel, linux-kselftest, linux-kernel,
	linux-mm, netdev

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.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 tools/testing/selftests/kselftest.h          | 4 ++++
 tools/testing/selftests/mm/protection_keys.c | 2 +-
 tools/testing/selftests/net/ovpn/ovpn-cli.c  | 3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index 661d31c4b558c..274480e3573ab 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -92,6 +92,10 @@
 #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
diff --git a/tools/testing/selftests/mm/protection_keys.c b/tools/testing/selftests/mm/protection_keys.c
index 6281d4c61b50e..2085982dba696 100644
--- a/tools/testing/selftests/mm/protection_keys.c
+++ b/tools/testing/selftests/mm/protection_keys.c
@@ -1302,7 +1302,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;
diff --git a/tools/testing/selftests/net/ovpn/ovpn-cli.c b/tools/testing/selftests/net/ovpn/ovpn-cli.c
index 9201f2905f2ce..688a5fa6fdacd 100644
--- a/tools/testing/selftests/net/ovpn/ovpn-cli.c
+++ b/tools/testing/selftests/net/ovpn/ovpn-cli.c
@@ -32,9 +32,10 @@
 
 #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
-- 
2.47.3



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests/mm: centralize the __always_unused macro
  2025-09-12 12:51 [PATCH] selftests/mm: centralize the __always_unused macro Muhammad Usama Anjum
@ 2025-09-12 13:28 ` David Hildenbrand
  0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand @ 2025-09-12 13:28 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Shuah Khan, Andrew Morton, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Antonio Quartulli,
	Sabrina Dubroca, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman
  Cc: kernel, linux-kselftest, linux-kernel, linux-mm, netdev

On 12.09.25 14:51, Muhammad Usama Anjum wrote:
> 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.
> 
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers

David / dhildenb



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-12 13:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-12 12:51 [PATCH] selftests/mm: centralize the __always_unused macro Muhammad Usama Anjum
2025-09-12 13:28 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox