From patchwork Tue Dec 16 21:18:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 924 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919938; bh=fh0LRh2VjQF7ozuD9XdMDytbetwOLUQzwlWJyYLySik=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=txLsHLyc3ofBvWR8ca+nbro0k+C+siyHmLiQrDNK44jIhtN1AjklBUHbFWXfdHKBA Lfhgbnjjf+Tk2cqBOIBsar/E34SzTXTp8/T2tBlsyf0pm8iGa+0n2GRwuARUCLjzaN TjIv4qkOp+Wl4bGsKqKaGVZLbB/12SMnF/O2gAn/lo/hJxVg36VcN4lcuHBaaZvJZE hibQf751Wk3OM6Gk3negG3s645kVQe7bENeOd0XAZVkpffPTEOiB4W7UN2Flfygod7 biw7pIlubkzHI51gHnwLvtCWVjS05YRicztTW7/G5O4ZXX/SOBCPdqaJLg962BjI0M 5+MItFyFSaaFQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7081468BA3 for ; Tue, 16 Dec 2025 14:18:58 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id cJPHBP3KtMB2 for ; Tue, 16 Dec 2025 14:18:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919936; bh=fh0LRh2VjQF7ozuD9XdMDytbetwOLUQzwlWJyYLySik=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=VlFH1WUO5DAw+ApenQXuGKxu0lYtlweBSCEJ340X3spxjnr8u/icivoxc8Wpk0sYo clah7PqJHrpYaTF3JnKcgF1Oql1dY7MdD5LvjOH6QrPvx/eBxRGJOTBJYtPjWJgrXq /pYtlRN0RPDJ/19SlXWWy3SpZbm7sgJT3GIRh8gmeIPdGzUaWEdQrE0ZPAlYpXKMGw HvWoVvVp2DtS8Tuhfoiu5LaOQGL92pw7hg1wOPqV12zKfRPd73crGVHfS3GVGn1vza e3U8P18viyd6pa2LPPO4hULUiTGkunbLiesju/nVQVjFLxkKJHZGOknrQ5A8s25LPT BY+mj05mrvi6w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6515668AEE for ; Tue, 16 Dec 2025 14:18:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919935; bh=Ucp9TKk75xyc0BTnXKvacsDFpCO3URxdR4FrMb3E4Hw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IXPGkR+E0VqtRyr26XXgngLNn2wq401RVNs9YaXq/QbdFhp7pitXaY+b32mkpqDJz hz3suKQKbLlRMVY3IDWWGRi5MBpEdHfBtgjkazB6XecfcuefSNyt1zFvVXydda50PF tK7cQijR9dZtvX+lejRAQ7TcH1JkselLz5KXI1jv3Jkf8PXA6qzrI+G1ijJWFPj6Pt xu2hjLAup4dMVSgkq/Nl9oDWzNbIvsrA+tle/bSKX+W/cFIgtWwq/kLclFKNADX7fn Rq+npzukMlLYG6ewxFy9NBE0HNVBMDCGeWpSofiDpgY1CqldMmN0Dj+o3c0pJ2MhA1 dmWkGPeZe3CJg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2BCB868B8F; Tue, 16 Dec 2025 14:18:55 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id gOM-zFf1aTmR; Tue, 16 Dec 2025 14:18:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765919934; bh=iAJPxrWTC2M0FFozgE/R6e6aTlZQHF895jZKHeVAzXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JPIv5UmIGTd5fN26PnMM8/5lzDiNDqkw5TcWYnWO+ck80l/VOVoLDtMbxrZByAwJH FDDQnZVASC4MKbz4/C4HVR8wC8kEorNA7X+4JJo8zJQlC5zc+Q8ZL7Zv4hNXGhefL9 oUM8BXYKi3q6iQ6/E58TudIalbL2gwV4XLqJy+AC+hEzXwh+eqmA56Rk8LH405aVZz 3yl0lsnMRrnQeRpmZBgsgzafgvMhohMNoXjkL7djQkscNfV96nBIzHnDwWZoNsRsJG gU6inhNGecyFRCzuARcH06nlrTZFnqUNc1ISXbtKOBHFfwaUgoqfx3iGroraMga23Z 0rgGC58Aej1bA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 990BE68AF5; Tue, 16 Dec 2025 14:18:54 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 16 Dec 2025 14:18:10 -0700 Message-ID: <20251216211817.4131167-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251216211817.4131167-1-sjg@u-boot.org> References: <20251216211817.4131167-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QNHJMKBI2O3KKCVWQ4DSRUHCFSG4B6H5 X-Message-ID-Hash: QNHJMKBI2O3KKCVWQ4DSRUHCFSG4B6H5 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/11] ext4l: Extract kthread declarations into their own file List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass 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 Signed-off-by: Simon Glass --- 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 #include #include +#include #include #include #include @@ -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 */