From: Simon Glass <simon.glass@canonical.com> Create include/linux/kthread.h with stub definitions for kernel thread support. U-Boot doesn't have multi-threading. Includes: - kthread_create(), kthread_run(), kthread_stop() - kthread_should_stop(), kthread_should_park() - wake_up_process(), set_current_state() - task_pid_nr() Update compat.h to include kthread.h and remove duplicate definitions. Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- include/linux/compat.h | 7 +------ include/linux/kthread.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 include/linux/kthread.h diff --git a/include/linux/compat.h b/include/linux/compat.h index fc0bfc31e5f..e9db2120de6 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -15,6 +15,7 @@ #include <linux/freezer.h> #include <linux/init.h> #include <linux/kernel.h> +#include <linux/kthread.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/uaccess.h> @@ -160,9 +161,6 @@ typedef unsigned long blkcnt_t; #define wake_up_interruptible(...) do { } while (0) #define dump_stack(...) do { } while (0) -#define task_pid_nr(x) 0 -#define set_current_state(...) do { } while (0) -#define kthread_should_stop(...) 0 #define setup_timer(timer, func, data) do {} while (0) #define del_timer_sync(timer) do {} while (0) @@ -197,9 +195,6 @@ typedef int wait_queue_head_t; #define yield() do { } while (0) -#define kthread_create(...) __builtin_return_address(0) -#define kthread_stop(...) do { } while (0) -#define wake_up_process(...) do { } while (0) struct rw_semaphore { int i; }; #define down_write(...) do { } while (0) diff --git a/include/linux/kthread.h b/include/linux/kthread.h new file mode 100644 index 00000000000..ba35274e9a4 --- /dev/null +++ b/include/linux/kthread.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Simple interface for creating and stopping kernel threads without mess. + * + * Stub definitions for Linux kernel thread support. + * U-Boot doesn't have multi-threading. + */ +#ifndef _LINUX_KTHREAD_H +#define _LINUX_KTHREAD_H + +struct task_struct; + +#define kthread_create(fn, data, fmt, ...) \ + ((struct task_struct *)__builtin_return_address(0)) +#define kthread_run(fn, data, fmt, ...) \ + ((struct task_struct *)__builtin_return_address(0)) +#define kthread_stop(task) do { } while (0) +#define kthread_should_stop() 0 +#define kthread_should_park() 0 +#define kthread_park(task) 0 +#define kthread_unpark(task) do { } while (0) +#define kthread_parkme() do { } while (0) + +#define wake_up_process(task) do { } while (0) +#define set_current_state(state) do { } while (0) + +#define task_pid_nr(task) 0 + +#endif /* _LINUX_KTHREAD_H */ -- 2.43.0