From patchwork Sun Jan 18 20:37:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1591 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=1768768775; bh=/NKbpqD+B1ME/MoFOzB0cF/TwkOKZi0nZ5bAvNSbbNQ=; 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=REvZJRmivd8mhz+Qio4qJx9Ae90o7b55rHp8RPKN1ot4r8TLeAdTFfnrzxZ+iSFCO Ga7by7X1Z3VIYQ1xL5oFqZ9TM8HrmvBufckShcW6uTfToXZJqIK5AW0qirlKRG6znW zoI56Dp8NXJ4Wq+5MHepIKqgsX+8ME7I2dyZju1aeQCP1/tjXxKNvb+TLnSAot7uJf xh8ACvn595Qa1pH9WmEg6zwZp0Hrzagp4eJ3jluEFwnwg3eFd0be5+sTv7RkxakO3n J0POb5lJvouMrCJ/eKtlOFyCi23lqNNZE2iHBAv+16n+9EMdcyTLVEI22MAPMTdL+9 TROrzl5R90o6w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 34DA269497 for ; Sun, 18 Jan 2026 13:39:35 -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 PN7ZFD9DW2WT for ; Sun, 18 Jan 2026 13:39:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768775; bh=/NKbpqD+B1ME/MoFOzB0cF/TwkOKZi0nZ5bAvNSbbNQ=; 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=REvZJRmivd8mhz+Qio4qJx9Ae90o7b55rHp8RPKN1ot4r8TLeAdTFfnrzxZ+iSFCO Ga7by7X1Z3VIYQ1xL5oFqZ9TM8HrmvBufckShcW6uTfToXZJqIK5AW0qirlKRG6znW zoI56Dp8NXJ4Wq+5MHepIKqgsX+8ME7I2dyZju1aeQCP1/tjXxKNvb+TLnSAot7uJf xh8ACvn595Qa1pH9WmEg6zwZp0Hrzagp4eJ3jluEFwnwg3eFd0be5+sTv7RkxakO3n J0POb5lJvouMrCJ/eKtlOFyCi23lqNNZE2iHBAv+16n+9EMdcyTLVEI22MAPMTdL+9 TROrzl5R90o6w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0ABF9693A2 for ; Sun, 18 Jan 2026 13:39:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768772; bh=n1Xl+qo3vPt0aA0QVWu98OwozQwfUNCDnfaBftfmVyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DJvcS3wHg4X94XXTtSaKMpAxoJVnSS423B7K0CLTQ8EE1bQz0B+gOIAl6SKbKBwbT lKAX3KKElq+d5CRvHM3WkRqNQpwqnHR9fwwmqq+S9MfmFAGoclw5ZIl26hBh26RnPm pEZWocbmy7vTv2vxSs6RooGRLABkK4GCHLmc22Rk2G81Hoxqjr0BaHP771umIkzV3d WL1A7+/DS2AOvUw7ICk/tytogDoadrIIl+xGVgKJEDdIYoxav+d6ilxtc+r3Cv4+ML CWE7fqQQAfFO5AMDhnZjMPNcTqgcICm/t49fG6aD13MDDhexkaH55IClIA+NscJntA 8mJtXlKTsu8vQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 548CE693A2; Sun, 18 Jan 2026 13:39:32 -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 ihmbWzjgHwgt; Sun, 18 Jan 2026 13:39:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768768768; bh=WBI2jWR1tbQZ9TWcJoLCb7FXFrmv4zOfNsf2q2BgpCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aADd2HbT/52MmErSDrW0OYao8mLnxZ989+bl5bRV0dmayKRM0dpYoLnYg9oSXNag8 DLNC6Uag3AwNUABimT+Fd1CX8BL2NjmrHt9MzPICHY6QN5C3cxQiLIv3lpIlYYc/VG RXIhr43ylU6W5b0HqzMCCIdIb3uo1QfmHngcmhWqtPnSFNM7JBooWZB12FH0Pofcg9 3PCo58XXKVY/wXmRZL5zDVlTN6IZu1X+SPJ0Q45BJZ/zP4EayaIYPqibrBUNPb5Yjx AR9UHSnlKU1nNgpoXoI0BxSRDLRa7b3YCc4Oa7gB8y+WuehWYaFq+WePaMkq6ERf8D kgNWjFWZFTGBQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C9F0969382; Sun, 18 Jan 2026 13:39:27 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 18 Jan 2026 13:37:34 -0700 Message-ID: <20260118203739.1974323-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260118203739.1974323-1-sjg@u-boot.org> References: <20260118203739.1974323-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: IVSM7KGMA2LLJ2LUVOPSBEISXTTJTEZE X-Message-ID-Hash: IVSM7KGMA2LLJ2LUVOPSBEISXTTJTEZE 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 12/12] linux: Add blockgroup_lock.h and delayed_call.h 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 Create linux/blockgroup_lock.h with blockgroup_lock structure and lock operation stubs. Create linux/delayed_call.h with delayed_call structure and set_delayed_call() macro for deferred function calls. Update ext4_uboot.h to use these headers instead of duplicating the definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 25 ++++----------- include/linux/blockgroup_lock.h | 25 +++++++++++++++ include/linux/delayed_call.h | 56 +++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 19 deletions(-) create mode 100644 include/linux/blockgroup_lock.h create mode 100644 include/linux/delayed_call.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index b861079bf48..3c6b3ca5507 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -305,8 +305,7 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, /* atomic_add_unless is now in asm-generic/atomic.h */ -/* Block group lock - stub */ -#define bgl_lock_ptr(lock, group) NULL +/* bgl_lock_ptr is now in linux/blockgroup_lock.h */ /* RCU stubs - use linux/rcupdate.h */ #include @@ -1107,17 +1106,8 @@ struct file_operations { int (*release)(struct inode *, struct file *); }; -/* delayed_call - for delayed freeing of symlink data */ -typedef void (*delayed_call_func_t)(const void *); -struct delayed_call { - delayed_call_func_t fn; - const void *arg; -}; - -#define set_delayed_call(dc, func, data) do { \ - (dc)->fn = (func); \ - (dc)->arg = (data); \ -} while (0) +/* delayed_call - use linux/delayed_call.h */ +#include #define kfree_link kfree @@ -1335,10 +1325,8 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate); /* Max file size for large files */ #define MAX_LFS_FILESIZE ((loff_t)LLONG_MAX) -/* blockgroup_lock for per-group locking */ -struct blockgroup_lock { - int num_locks; /* U-Boot doesn't need real locking */ -}; +/* blockgroup_lock - use linux/blockgroup_lock.h */ +#include /* Buffer submission stubs - declarations for stub.c implementations */ int submit_bh(int op_flags, struct buffer_head *bh); @@ -1444,8 +1432,7 @@ int generic_check_addressable(unsigned int blocksize_bits, u64 num_blocks); u64 sb_bdev_nr_blocks(struct super_block *sb); unsigned int bdev_max_discard_sectors(struct block_device *bdev); -/* Blockgroup lock init - stub */ -#define bgl_lock_init(lock) do { } while (0) +/* bgl_lock_init is now in linux/blockgroup_lock.h */ /* Task I/O priority - declaration for stub.c */ void set_task_ioprio(void *task, int ioprio); diff --git a/include/linux/blockgroup_lock.h b/include/linux/blockgroup_lock.h new file mode 100644 index 00000000000..13b51ba0e57 --- /dev/null +++ b/include/linux/blockgroup_lock.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Block group lock definitions for U-Boot + * + * Based on Linux blockgroup_lock.h - per-block-group locking. + * U-Boot stub - locking not needed in single-threaded environment. + */ +#ifndef _LINUX_BLOCKGROUP_LOCK_H +#define _LINUX_BLOCKGROUP_LOCK_H + +/** + * struct blockgroup_lock - per-block-group lock + * @num_locks: number of locks (unused in U-Boot) + * + * U-Boot stub - real locking not needed. + */ +struct blockgroup_lock { + int num_locks; +}; + +/* Block group lock operations - all no-ops */ +#define bgl_lock_init(lock) do { } while (0) +#define bgl_lock_ptr(lock, group) ((spinlock_t *)NULL) + +#endif /* _LINUX_BLOCKGROUP_LOCK_H */ diff --git a/include/linux/delayed_call.h b/include/linux/delayed_call.h new file mode 100644 index 00000000000..d4248dce742 --- /dev/null +++ b/include/linux/delayed_call.h @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Delayed call definitions for U-Boot + * + * Based on Linux delayed_call.h - deferred function calls. + */ +#ifndef _LINUX_DELAYED_CALL_H +#define _LINUX_DELAYED_CALL_H + +/** + * typedef delayed_call_func_t - delayed call function type + */ +typedef void (*delayed_call_func_t)(const void *); + +/** + * struct delayed_call - delayed function call + * @fn: function to call + * @arg: argument to pass to function + */ +struct delayed_call { + delayed_call_func_t fn; + const void *arg; +}; + +/** + * set_delayed_call() - set up a delayed call + * @dc: delayed call structure + * @func: function to call + * @data: data to pass to function + */ +#define set_delayed_call(dc, func, data) do { \ + (dc)->fn = (func); \ + (dc)->arg = (data); \ +} while (0) + +/** + * do_delayed_call() - execute a delayed call + * @dc: delayed call structure + */ +static inline void do_delayed_call(struct delayed_call *dc) +{ + if (dc->fn) + dc->fn(dc->arg); +} + +/** + * clear_delayed_call() - clear a delayed call + * @dc: delayed call structure + */ +static inline void clear_delayed_call(struct delayed_call *dc) +{ + dc->fn = NULL; + dc->arg = NULL; +} + +#endif /* _LINUX_DELAYED_CALL_H */