mirror of https://github.com/torvalds/linux.git
selftests: centralise maybe-unused definition in kselftest.h
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>
This commit is contained in:
parent
940b1be225
commit
a7498388b0
|
|
@ -92,6 +92,10 @@
|
||||||
#endif
|
#endif
|
||||||
#define __printf(a, b) __attribute__((format(printf, a, b)))
|
#define __printf(a, b) __attribute__((format(printf, a, b)))
|
||||||
|
|
||||||
|
#ifndef __maybe_unused
|
||||||
|
#define __maybe_unused __attribute__((__unused__))
|
||||||
|
#endif
|
||||||
|
|
||||||
/* counters */
|
/* counters */
|
||||||
struct ksft_count {
|
struct ksft_count {
|
||||||
unsigned int ksft_pass;
|
unsigned int ksft_pass;
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,12 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "../kselftest.h"
|
||||||
|
|
||||||
#ifndef ARRAY_SIZE
|
#ifndef ARRAY_SIZE
|
||||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __maybe_unused
|
|
||||||
#define __maybe_unused __attribute__((__unused__))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define REGEX_LANDLOCK_PREFIX "^audit([0-9.:]\\+): domain=\\([0-9a-f]\\+\\)"
|
#define REGEX_LANDLOCK_PREFIX "^audit([0-9.:]\\+): domain=\\([0-9a-f]\\+\\)"
|
||||||
|
|
||||||
struct audit_filter {
|
struct audit_filter {
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,6 @@
|
||||||
|
|
||||||
#define TMP_DIR "tmp"
|
#define TMP_DIR "tmp"
|
||||||
|
|
||||||
#ifndef __maybe_unused
|
|
||||||
#define __maybe_unused __attribute__((__unused__))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* TEST_F_FORK() should not be used for new tests. */
|
/* TEST_F_FORK() should not be used for new tests. */
|
||||||
#define TEST_F_FORK(fixture_name, test_name) TEST_F(fixture_name, test_name)
|
#define TEST_F_FORK(fixture_name, test_name) TEST_F(fixture_name, test_name)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,9 +84,6 @@ extern void abort_hooks(void);
|
||||||
#ifndef noinline
|
#ifndef noinline
|
||||||
# define noinline __attribute__((noinline))
|
# define noinline __attribute__((noinline))
|
||||||
#endif
|
#endif
|
||||||
#ifndef __maybe_unused
|
|
||||||
# define __maybe_unused __attribute__((__unused__))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int sys_pkey_alloc(unsigned long flags, unsigned long init_val);
|
int sys_pkey_alloc(unsigned long flags, unsigned long init_val);
|
||||||
int sys_pkey_free(unsigned long pkey);
|
int sys_pkey_free(unsigned long pkey);
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,6 @@
|
||||||
|
|
||||||
#define PORT_BASE 8000
|
#define PORT_BASE 8000
|
||||||
|
|
||||||
#ifndef __maybe_unused
|
|
||||||
# define __maybe_unused __attribute__ ((__unused__))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static __maybe_unused void pair_udp_setfilter(int fd)
|
static __maybe_unused void pair_udp_setfilter(int fd)
|
||||||
{
|
{
|
||||||
/* the filter below checks for all of the following conditions that
|
/* the filter below checks for all of the following conditions that
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@
|
||||||
|
|
||||||
#include "../kselftest_harness.h"
|
#include "../kselftest_harness.h"
|
||||||
|
|
||||||
#define __maybe_unused __attribute__((__unused__))
|
|
||||||
|
|
||||||
static int sigio_count;
|
static int sigio_count;
|
||||||
|
|
||||||
static void handle_sigio(int signum __maybe_unused,
|
static void handle_sigio(int signum __maybe_unused,
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
#ifndef KUBLK_UTILS_H
|
#ifndef KUBLK_UTILS_H
|
||||||
#define KUBLK_UTILS_H
|
#define KUBLK_UTILS_H
|
||||||
|
|
||||||
#define __maybe_unused __attribute__((unused))
|
|
||||||
|
|
||||||
#ifndef min
|
#ifndef min
|
||||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue