]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
tools/testing: abstract two init.h into common include directory
authorWei Yang <richard.weiyang@gmail.com>
Fri, 12 Jul 2024 03:51:38 +0000 (03:51 +0000)
committerMike Rapoport (Microsoft) <rppt@kernel.org>
Tue, 6 Aug 2024 05:17:50 +0000 (08:17 +0300)
Currently we have two test suits define its own init.h. This is a little
redundant.

Let's create a init.h in common include directory and merge these two
into it.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Mike Rapoport <rppt@kernel.org>
CC: Liam R. Howlett <Liam.Howlett@oracle.com>
Link: https://lore.kernel.org/r/20240712035138.24674-3-richard.weiyang@gmail.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
tools/include/linux/compiler.h
tools/include/linux/init.h [new file with mode: 0644]
tools/testing/memblock/linux/init.h [deleted file]
tools/testing/radix-tree/linux/init.h [deleted file]
tools/testing/radix-tree/maple.c

index 6f7f22ac9da596f01549d098b2834829daf343aa..4b5a45919ff80d12ca763df778cae7096e15ef2e 100644 (file)
 # define unlikely(x)           __builtin_expect(!!(x), 0)
 #endif
 
-#ifndef __init
-# define __init
-#endif
-
 #include <linux/types.h>
 
 /*
diff --git a/tools/include/linux/init.h b/tools/include/linux/init.h
new file mode 100644 (file)
index 0000000..7ed4079
--- /dev/null
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _TOOLS_LINUX_INIT_H_
+#define _TOOLS_LINUX_INIT_H_
+
+#include <linux/compiler.h>
+
+#ifndef __init
+# define __init
+#endif
+
+#ifndef __exit
+# define __exit
+#endif
+
+#define __section(section)              __attribute__((__section__(section)))
+
+#define __initconst
+#define __meminit
+#define __meminitdata
+#define __refdata
+#define __initdata
+
+struct obs_kernel_param {
+       const char *str;
+       int (*setup_func)(char *st);
+       int early;
+};
+
+#define __setup_param(str, unique_id, fn, early)                       \
+       static const char __setup_str_##unique_id[] __initconst         \
+               __aligned(1) = str;                                     \
+       static struct obs_kernel_param __setup_##unique_id              \
+               __used __section(".init.setup")                         \
+               __aligned(__alignof__(struct obs_kernel_param)) =       \
+               { __setup_str_##unique_id, fn, early }
+
+#define early_param(str, fn)                                           \
+       __setup_param(str, fn, fn, 1)
+
+#endif /*  _TOOLS_LINUX_INIT_H_ */
diff --git a/tools/testing/memblock/linux/init.h b/tools/testing/memblock/linux/init.h
deleted file mode 100644 (file)
index bd74abc..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _LINUX_INIT_H
-#define _LINUX_INIT_H
-
-#include <linux/compiler.h>
-
-#define __section(section)              __attribute__((__section__(section)))
-
-#define __initconst
-#define __meminit
-#define __meminitdata
-#define __refdata
-#define __initdata
-
-struct obs_kernel_param {
-       const char *str;
-       int (*setup_func)(char *st);
-       int early;
-};
-
-#define __setup_param(str, unique_id, fn, early)                       \
-       static const char __setup_str_##unique_id[] __initconst         \
-               __aligned(1) = str;                                     \
-       static struct obs_kernel_param __setup_##unique_id              \
-               __used __section(".init.setup")                         \
-               __aligned(__alignof__(struct obs_kernel_param)) =       \
-               { __setup_str_##unique_id, fn, early }
-
-#define early_param(str, fn)                                           \
-       __setup_param(str, fn, fn, 1)
-
-#endif
diff --git a/tools/testing/radix-tree/linux/init.h b/tools/testing/radix-tree/linux/init.h
deleted file mode 100644 (file)
index 81563c3..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#define __init
-#define __exit
index cd1cf05503b4b4c93a5dedd282583e0c79be91ce..3437292babff990bdc09abb8b209750def6bd5bd 100644 (file)
@@ -14,7 +14,7 @@
 #include "test.h"
 #include <stdlib.h>
 #include <time.h>
-#include "linux/init.h"
+#include <linux/init.h>
 
 #define module_init(x)
 #define module_exit(x)