From patchwork Wed Jan 21 22:08:41 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1754 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=1769033461; bh=TWQb57cqvUNHt2vpPsV2zwg0l0lNObUcVPtA6TAQLRA=; 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=QfaQzYw0J55nTlyCMeVCK6Byh3gd+o/nYYe9zUDn5GLuyoi3z3rM6Bm/NRmWaGgIv 9Yzv//pd4Wejjv2w267ufWYmzi89IQJTYF1l2BdHBfBA9aLCDI7cFmt5S8iOzTjbSk 0P4quSK/F5osYcOx/1lSAMv+Rbaz60/k9+WgvaPewm1XDILUtHgVVkhttmwx/8uLMs wOVCKCtTDoW/IQOoO5JDG5spgTRCIcFylqW4FP82us/wji360klJ0LBGvEWnCkbyXb XUtcaM+IHJDN+dr6BCMEIb3WsH5YiUWEOeWlaLwr+Unb35Q46li6gfUc3Nl33yI3GR 0rdI/mw6ZljXA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6DDE669605 for ; Wed, 21 Jan 2026 15:11:01 -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 HH-V3DLP6ZWH for ; Wed, 21 Jan 2026 15:11:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769033461; bh=TWQb57cqvUNHt2vpPsV2zwg0l0lNObUcVPtA6TAQLRA=; 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=QfaQzYw0J55nTlyCMeVCK6Byh3gd+o/nYYe9zUDn5GLuyoi3z3rM6Bm/NRmWaGgIv 9Yzv//pd4Wejjv2w267ufWYmzi89IQJTYF1l2BdHBfBA9aLCDI7cFmt5S8iOzTjbSk 0P4quSK/F5osYcOx/1lSAMv+Rbaz60/k9+WgvaPewm1XDILUtHgVVkhttmwx/8uLMs wOVCKCtTDoW/IQOoO5JDG5spgTRCIcFylqW4FP82us/wji360klJ0LBGvEWnCkbyXb XUtcaM+IHJDN+dr6BCMEIb3WsH5YiUWEOeWlaLwr+Unb35Q46li6gfUc3Nl33yI3GR 0rdI/mw6ZljXA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 59464695F7 for ; Wed, 21 Jan 2026 15:11:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769033458; bh=86dYRkVPnWLApHq7V+KZrJl/bwPq54GnbQNPR4lf1PA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EevHBrfwLOF2DOThdr3n0+jX7EqVLJeNEeglstAIS7yp9Hhn2sUVDUHm2skzGfmdu R02xT+00A1hkEqT+ayxSm5YREroJnvWAzJ64w/sVSJD0p9EhTomVa0pmmQhwpCx/Ou RrsCdPoiiEqj9ruQ2QfCB/Ovdx55uIE+pZgwfWdkqI/9SYsF+iHtmfmJNWykxJPPH7 tpc5/WLcNyRHDfTC3G/GIQiyw4kbJWtQ2LdK8Vevj/vwkZBEgDz5Ze0E32pp43ZY53 kKmTYZbWwhkPfHnBy9weSdfQPARbSPBxljsUkAlDZgji0eZc3vCSmhU5MKHzGk3BiK Ksx2GvfZq9zIg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9D2EB695F2; Wed, 21 Jan 2026 15:10: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 10026) with ESMTP id t3M_XeXw-KAe; Wed, 21 Jan 2026 15:10:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1769033454; bh=HMVycO8k3NnmcRbaguwI9qi25sTuzW+Hki8mW1lRwAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ob8oO5oC/TpKk/u5D/6WGoSM3+/ZZwzHn8ZmAmKQjHGGF3PmqdwUPS+yi9HAO5EO1 q7Oss4IXfJawTkXXX+88NQaaLCQVNMnHP4X/nbuO+z5XKr+vepQNFyZFBho5853bYN 6UXPjQRb+QcLBVCaDWrm+MahYfrXtx++y08RAjak6+5BhTtDizdjSPK0fL7PkyQlbA EIH00gmPoEsv7miDPERjh3yW6xvm3o0JEuf8KWBzOrDhV1QzTmmpK2UpxrNYVMLFQ2 QZYlNtOZkOkjeH1X7D1bzC0yiJSvpCvECgjRQGt91X3GfR1Sf1XhXWtTGVHXtdOVzJ GPr33jJLydwhA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 466E169621; Wed, 21 Jan 2026 15:10:54 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 21 Jan 2026 15:08:41 -0700 Message-ID: <20260121220857.2137568-29-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260121220857.2137568-1-sjg@u-boot.org> References: <20260121220857.2137568-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: K4HU7JEKO773Z3CCKEGVWSGFJZWHHPUM X-Message-ID-Hash: K4HU7JEKO773Z3CCKEGVWSGFJZWHHPUM 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 28/33] ext4l: Move more stubs to standard Linux headers 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 Move definitions to their canonical Linux kernel locations: - vfs_setpos(), FS_MGTIME, BLOCK_SIZE to linux/fs.h - vmf_fs_error() to linux/mm_types.h - down_write_nested() to linux/rwsem.h - pde_data() to linux/proc_fs.h - memalloc_retry_wait() to linux/sched/mm.h - raw_cpu_ptr() to linux/percpu.h - prefetchw() now via include of linux/prefetch.h Also fix linux/prefetch.h to use expression form ((void)0) instead of do-while(0) statement, as list.h uses prefetch() in comma expressions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 27 +-------------------------- include/linux/fs.h | 10 ++++++++++ include/linux/mm_types.h | 3 +++ include/linux/percpu.h | 1 + include/linux/prefetch.h | 4 ++-- include/linux/proc_fs.h | 1 + include/linux/rwsem.h | 2 ++ include/linux/sched/mm.h | 3 +++ 8 files changed, 23 insertions(+), 28 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 6f8c78bdeb0..5c6a8711a9f 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -156,13 +156,8 @@ struct path; /* QSTR_INIT and dotdot_name are now in linux/dcache.h */ -#define vfs_setpos(file, offset, maxsize) ({ (void)(file); (void)(maxsize); (offset); }) - #include -/* Memory retry wait */ -#define memalloc_retry_wait(g) do { } while (0) - /* indirect.c stubs */ /* ext4_sb_bread_nofail is stubbed in interface.c */ @@ -206,9 +201,6 @@ struct path; /* UID/GID bit helpers - use linux/highuid.h */ #include -/* File operations */ -#define vmf_fs_error(e) ((vm_fault_t)VM_FAULT_SIGBUS) - /* * Additional stubs for dir.c */ @@ -272,12 +264,6 @@ void ext4_unregister_li_request(struct super_block *sb); /* end_buffer_write_sync - implemented in support.c */ void end_buffer_write_sync(struct buffer_head *bh, int uptodate); -/* File system management time flag */ -#define FS_MGTIME 0 - -/* Block size */ -#define BLOCK_SIZE 1024 - #define EXT4_SUPER_MAGIC 0xEF53 /* blockgroup_lock - use linux/blockgroup_lock.h */ @@ -326,16 +312,10 @@ int sync_filesystem(void *sb); #include #include -/* pde_data - proc dir entry data (not supported in U-Boot) */ -#define pde_data(inode) ((void *)NULL) - /* DEFINE_RAW_FLEX - define a flexible array struct on the stack (stubbed to NULL) */ #define DEFINE_RAW_FLEX(type, name, member, count) \ type *name = NULL -/* raw_cpu_ptr - get pointer to per-CPU data for current CPU */ -#define raw_cpu_ptr(ptr) (ptr) - /* * Stubs for page-io.c - bio types are in linux/bio.h */ @@ -347,8 +327,7 @@ int sync_filesystem(void *sb); #include -/* prefetch operations */ -#define prefetchw(addr) do { (void)(addr); } while (0) +#include /* * Stubs for fast_commit.c @@ -396,10 +375,6 @@ struct disk_partition *ext4l_get_partition(void); * Stubs for move_extent.c */ -/* down_write_nested - nested write lock acquisition */ -#define down_write_nested(sem, subclass) \ - do { (void)(sem); (void)(subclass); } while (0) - /* PAGE_MASK - mask for page alignment */ #ifndef PAGE_MASK #define PAGE_MASK (~(PAGE_SIZE - 1)) diff --git a/include/linux/fs.h b/include/linux/fs.h index 5b865715d51..2fa12a40aa7 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -412,6 +412,16 @@ static inline void inode_init_once(struct inode *inode) #define SB_FREEZE_FS 3 #define SB_FREEZE_COMPLETE 4 +/* Filesystem management time flag */ +#define FS_MGTIME 0 + +/* Block size constant */ +#define BLOCK_SIZE 1024 + +/* VFS position helper */ +#define vfs_setpos(file, offset, maxsize) \ + ({ (void)(file); (void)(maxsize); (offset); }) + /* fallocate() flags */ #define FALLOC_FL_KEEP_SIZE 0x01 #define FALLOC_FL_PUNCH_HOLE 0x02 diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 57a52769b05..1d1a0fcd6c1 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -44,6 +44,9 @@ typedef unsigned int vm_fault_t; #define VM_FAULT_NOPAGE 0x0010 #define VM_FAULT_LOCKED 0x0200 +/* VM fault error helper */ +#define vmf_fs_error(e) ((vm_fault_t)VM_FAULT_SIGBUS) + /* Maximum order for page cache allocations */ #define MAX_PAGECACHE_ORDER 12 diff --git a/include/linux/percpu.h b/include/linux/percpu.h index 3aa71c1451f..969cf152a7c 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h @@ -17,6 +17,7 @@ #define DEFINE_PER_CPU(type, name) type name #define per_cpu(var, cpu) (var) #define per_cpu_ptr(ptr, cpu) (ptr) +#define raw_cpu_ptr(ptr) (ptr) #define this_cpu_inc(var) ((var)++) #define this_cpu_read(var) (var) diff --git a/include/linux/prefetch.h b/include/linux/prefetch.h index 4b9bbfbe7e9..c62da091eba 100644 --- a/include/linux/prefetch.h +++ b/include/linux/prefetch.h @@ -11,7 +11,7 @@ #ifndef _LINUX_PREFETCH_H #define _LINUX_PREFETCH_H -#define prefetch(x) do { } while (0) -#define prefetchw(x) do { } while (0) +#define prefetch(x) ((void)0) +#define prefetchw(x) ((void)0) #endif /* _LINUX_PREFETCH_H */ diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index ba674440c44..572ed2759bb 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -34,5 +34,6 @@ struct proc_ops { (struct proc_dir_entry *)NULL; }) #define remove_proc_entry(n, p) \ do { (void)(n); (void)(p); } while (0) +#define pde_data(inode) ((void *)NULL) #endif /* _LINUX_PROC_FS_H */ diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index 7beaf5062ed..e3480b276b4 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h @@ -22,6 +22,8 @@ struct rw_semaphore { #define up_read(sem) do { } while (0) #define down_write(sem) do { } while (0) #define down_write_trylock(sem) 1 +#define down_write_nested(sem, subclass) \ + do { (void)(sem); (void)(subclass); } while (0) #define up_write(sem) do { } while (0) #define downgrade_write(sem) do { } while (0) #define rwsem_is_locked(sem) (1) diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h index 7a105f768cb..956bbaf18a8 100644 --- a/include/linux/sched/mm.h +++ b/include/linux/sched/mm.h @@ -29,4 +29,7 @@ static inline void memalloc_nofs_restore(unsigned int flags) { } +/* Memory allocation retry wait - stub for U-Boot */ +#define memalloc_retry_wait(g) do { } while (0) + #endif /* _LINUX_SCHED_MM_H */