mirror_ubuntu-kernels/tools/include/linux/init.h
Wei Yang e2ae9cf39f tools/testing: abstract two init.h into common include directory
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>
2024-08-06 08:17:50 +03:00

41 lines
906 B
C

/* 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_ */