From patchwork Wed Jan 14 22:56:10 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1514 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=1768431499; bh=U/N47+3MXv+ZJLN1DN3WIi6w+zya2y3PgzlepbnSfEw=; 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=JQrnrghj8yQTIM8EefCbeR1uzPAFc97Y02II/tc+0v4TN/WRFfGgBNuE7F1B6B+Mh LPLts4v45tdBVg1K0IYXcDdAqrKUX7sE7QuAc3cRZmfurBKMO2X63FeSfgAb0yYHs4 zKTirwUgScHr0P2np/ZLKPUfjUiCaylc0mdqJZLjWjTAUDNjfLTa8ehRaCaPQ1DUg8 CRYUqF9vnMlidCy1iDl2Nc/dB+gx+mWEIo1S9ekJKbNfEri9gN9K+kQ8ZGtd2WMYXr 4kRjX8dkLDLc3KI1GH+CqDjRfCwfWWZiCBGB+y2S9yp+rmjk0j15Y3AZq+dFL9O4fU xEYeDBHM6gwcw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EB64B6935F for ; Wed, 14 Jan 2026 15:58:19 -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 XYLI7rzCydry for ; Wed, 14 Jan 2026 15:58:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768431499; bh=U/N47+3MXv+ZJLN1DN3WIi6w+zya2y3PgzlepbnSfEw=; 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=JQrnrghj8yQTIM8EefCbeR1uzPAFc97Y02II/tc+0v4TN/WRFfGgBNuE7F1B6B+Mh LPLts4v45tdBVg1K0IYXcDdAqrKUX7sE7QuAc3cRZmfurBKMO2X63FeSfgAb0yYHs4 zKTirwUgScHr0P2np/ZLKPUfjUiCaylc0mdqJZLjWjTAUDNjfLTa8ehRaCaPQ1DUg8 CRYUqF9vnMlidCy1iDl2Nc/dB+gx+mWEIo1S9ekJKbNfEri9gN9K+kQ8ZGtd2WMYXr 4kRjX8dkLDLc3KI1GH+CqDjRfCwfWWZiCBGB+y2S9yp+rmjk0j15Y3AZq+dFL9O4fU xEYeDBHM6gwcw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DA55C69345 for ; Wed, 14 Jan 2026 15:58:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768431498; bh=nvPghFj3zewUifgzJnSeRzVbnp41fOWWAB3p1Ckk29M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RiN6Lv/yOF+u7N/0HTYnNnnucu/x7W7UhZNt8WTiZRwvmTSW6w5ynYQz6nTozuFIp zFwcPO0FkUfMnG1UE6MtS29Tbo7lVxKgoxoy+v/C1Zp06B5Awp+SDhhg2wpmlqRg9j 9lzBK3WcbGGH9HU70vjUXstUwZduYORt34Ls/l+XP7O+rZ2vSZuCtit1Xoxuhs5KVH oGmmlVHvn0mDWFrMTduC8ABpQ+hwTSSEIAAaOO+TyTWNrbWGOh91IOOKwjREwxKqzj hM55sq4/K4eGNd6RK6FqlLNExSt8crBG3QNC3or16+Enk6oDdjMS0lg2ncxDQC9fg9 /w5TvPWxKElGw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7C36369345; Wed, 14 Jan 2026 15:58:18 -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 nqub_Xu5Ms3V; Wed, 14 Jan 2026 15:58:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768431492; bh=T6AI0CKpXCl2hwFK/xNe/QNxu5SEZF93QXGTrSTl4lM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sRMYdp1lf7qmkWyEDBXazvNf8fdh0HUT+U3q49+XAskWVAyBkRvJY1ajh/kWXLxSA 5OlT1UvNon+P9qLMqXzBRrOsNaZvHWVPm6VYgT87RCLunH2zhl1/XkbrmScbI8YjtY z0bKiTv+IPC1UZd67HdEnAyKRY84jfv0nQfx6ME70K87akyYcHy3GGUGo+KqC6yfCP kiOetIK+AFt6ZLLxuGlHwMUM7WhXP9iC9t607scpsyftDhcHXmGaFjH+2eHya1QwtJ mxfgPqDixdRJ75s93sgHG9lwggGHS+YC1NakBv3kpb1nK2nFCsWtxjcbZcuQshPhWD 0qBXC02RjZszg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 92211692EF; Wed, 14 Jan 2026 15:58:12 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 14 Jan 2026 15:56:10 -0700 Message-ID: <20260114225635.3407989-21-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260114225635.3407989-1-sjg@u-boot.org> References: <20260114225635.3407989-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BT4VUR7QIVUOC6EQDILEWDIPTZQXOEGF X-Message-ID-Hash: BT4VUR7QIVUOC6EQDILEWDIPTZQXOEGF 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 20/34] ext4l: Move jiffies definitions to linux/jiffies.h 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 The ext4l code defines HZ, jiffies, msecs_to_jiffies(), jiffies_to_msecs(), nsecs_to_jiffies(), and round_jiffies_up() locally instead of in the common jiffies header. Move these to linux/jiffies.h where they belong. Also remove the redundant NSEC_PER_SEC definition since it is already in linux/time.h Time comparison macros time_before() and time_after() are provided by include/time.h which has a better implementation with typecheck() Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 18 +++--------------- include/linux/jiffies.h | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 1c58f64ba2f..44f1d2fabc8 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1968,18 +1968,7 @@ struct fs_parse_result { /* crc16 - use U-Boot's implementation */ #include -/* Timer and timing stubs */ -#define HZ 1000 -#define jiffies 0UL -#ifndef time_before -#define time_before(a, b) ((long)((a) - (b)) < 0) -#endif -#ifndef time_after -#define time_after(a, b) time_before(b, a) -#endif -#define msecs_to_jiffies(m) ((m) * HZ / 1000) -#define jiffies_to_msecs(j) ((j) * 1000 / HZ) -#define round_jiffies_up(j) (j) +/* Timer and timing stubs are in linux/jiffies.h */ /* Path lookup flags */ #define LOOKUP_FOLLOW 0x0001 @@ -2022,8 +2011,7 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate); /* Block size */ #define BLOCK_SIZE 1024 -/* Time constants */ -#define NSEC_PER_SEC 1000000000L +/* NSEC_PER_SEC is in linux/time.h */ /* EXT4 magic number */ #define EXT4_SUPER_MAGIC 0xEF53 @@ -2115,7 +2103,7 @@ void *kvzalloc(size_t size, gfp_t flags); /* Time operations */ #define ktime_get_ns() (0ULL) -#define nsecs_to_jiffies(ns) ((ns) / (NSEC_PER_SEC / HZ)) +/* nsecs_to_jiffies is in linux/jiffies.h */ /* Superblock write operations */ #define sb_start_write_trylock(sb) ({ (void)(sb); 1; }) diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index daef4a337a2..153a2841bf5 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h @@ -15,4 +15,18 @@ #define MAX_JIFFY_OFFSET ((LONG_MAX >> 1) - 1) +/* HZ - timer frequency (simplified for U-Boot) */ +#define HZ 1000 + +/* jiffies - always 0 in U-Boot (no timer tick counter) */ +#define jiffies 0UL + +/* Time comparison macros are in include/time.h */ + +/* Jiffies conversion */ +#define msecs_to_jiffies(m) ((m) * HZ / 1000) +#define jiffies_to_msecs(j) ((j) * 1000 / HZ) +#define nsecs_to_jiffies(ns) ((ns) / (1000000000L / HZ)) +#define round_jiffies_up(j) (j) + #endif /* _LINUX_JIFFIES_H */