From patchwork Wed Jan 14 22:55:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1496 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=1768431423; bh=MHLw5YoXQ0QwfqKQZ+mXasr+iUEly/GMXYu7PHkH/+0=; 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=VKSPIYQnyvE7N1kZq7gI8vPG/B/gd7xamlBzA6JuSUEbEPpMj+OHPahsMS42JDvAp iDSwh/+KxprZ33JsPBZWEMaLkV1q0RIcSD+bJJfL3TxjtEorf6CKy2LZ/zRGShUwgn zhTeLybEx7SDZdbPJzEAk5OJh5uJDsAdISZ++glUQrQzRLsObO8kGF7KfCKE21t93S uKICtxSuymrr8H5+XO/9LPbmY6IvP7H0S6JLWQ+i2THIlTUNXI9zNh8K/2Ehc/7Drh n0ls0j00aIUhap1TbyV5LQwyH0HjchQkpjrjsykaGNaCLbrWjU/YfXBWs43MDNs6hU L07owZAHvYEXQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2320C6933C for ; Wed, 14 Jan 2026 15:57:03 -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 r261bDqI1QrE for ; Wed, 14 Jan 2026 15:57:03 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768431423; bh=MHLw5YoXQ0QwfqKQZ+mXasr+iUEly/GMXYu7PHkH/+0=; 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=VKSPIYQnyvE7N1kZq7gI8vPG/B/gd7xamlBzA6JuSUEbEPpMj+OHPahsMS42JDvAp iDSwh/+KxprZ33JsPBZWEMaLkV1q0RIcSD+bJJfL3TxjtEorf6CKy2LZ/zRGShUwgn zhTeLybEx7SDZdbPJzEAk5OJh5uJDsAdISZ++glUQrQzRLsObO8kGF7KfCKE21t93S uKICtxSuymrr8H5+XO/9LPbmY6IvP7H0S6JLWQ+i2THIlTUNXI9zNh8K/2Ehc/7Drh n0ls0j00aIUhap1TbyV5LQwyH0HjchQkpjrjsykaGNaCLbrWjU/YfXBWs43MDNs6hU L07owZAHvYEXQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0821369345 for ; Wed, 14 Jan 2026 15:57:03 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768431420; bh=/AxHE6QJUbwgUFDyU9LCrpNy5k+pPmwfLyoKQErqJDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UviWBQ1DTMyPEvrQrsaqNN9v4BotxTiuuJIIvI8QBylvmKyIHPTQ7MG98epylJC9/ 6sn1Ttpfvy3opt4Q6y6kvBqAcFEeJRAbfQJ6ymGZhKxXT3jxBOIFXSeEGT3luaEV3+ I8xcqSXB04wrGX1mC4iNH28ceq2c31UZ07y2cGs0DzfDqX1i0DwBYGS2K0OlKx67oE sSWc8akccQvzNQNdvDrsBOdTNYxIuWrSMTPwMLyJTuXwcJEpxTyEjnSmzX/V34qco/ Ac0tuQgylD3ZM600cD2xTz/pHScMIXjOT6FtzWO9t/mA+eLgcCmvIYb7BuBUU1MK8/ gRwcqBORI23mA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A53D66933C; Wed, 14 Jan 2026 15:57:00 -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 qUMgs_0jRSw1; Wed, 14 Jan 2026 15:57:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768431416; bh=nnQuHGTkgFH3TW0MCCtA1y3CQQr4xwSExiVYxWlUU7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cGGsF/bYZXcdap569s7z2K+LgQz2yfzl+s0+ShaHthItI2pdHmA8HTzb0Ghcer9v2 UgZ3rsOK1fjklXrF0+jSFSW9uK///jfMly7rzBYqLlMPt14ijhAPlzLsf0Au8BjEbR c61aXl5TnHm7e15/jQbSKkar6+X7y9tUz5vPF161l5vxSIYFQXJeW/S1WLz3f1EgqG ZH9AAV2gLH9133e6JEPGtWlwMuESvphaUxdKw3PwAMH2fzr/8N0AhX55Jce1o6fIRj Y0OUtsRYJ65moceZKTeUAYbIPtMr2KcOLyHIdJnDDrFdVeJ0/ie3N5jyy8CkuSZcpk lBB4lp8UjsQBA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 587C9692EF; Wed, 14 Jan 2026 15:56:56 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 14 Jan 2026 15:55:52 -0700 Message-ID: <20260114225635.3407989-3-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: 3NPBQHR55AMZBBKQZ6JGKVY6EXZ5Q6SF X-Message-ID-Hash: 3NPBQHR55AMZBBKQZ6JGKVY6EXZ5Q6SF 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 02/34] ext4l: Move rol32 to linux/bitops.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 Move the rol32() rotate-left function from ext4_uboot.h to include/linux/bitops.h where it logically belongs alongside other bit manipulation functions. Also add ror32() for completeness. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 7 +------ include/linux/bitops.h | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index b2a33a17198..68dca2f8d4e 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -65,12 +65,7 @@ #undef no_printk #define no_printk(fmt, ...) ({ 0; }) -/* Rotate left - not available in U-Boot */ -static inline u32 rol32(u32 word, unsigned int shift) -{ - return (word << (shift & 31)) | (word >> ((-shift) & 31)); -} - +/* rol32 and ror32 are now in linux/bitops.h */ /* Time types - timespec64 and time64_t are now in linux/time.h */ /* diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 86f7ee492b4..a3cfbbd5250 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -148,6 +148,26 @@ static inline unsigned long hweight_long(unsigned long w) return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w); } +/** + * rol32 - rotate a 32-bit value left + * @word: value to rotate + * @shift: bits to roll + */ +static inline u32 rol32(u32 word, unsigned int shift) +{ + return (word << (shift & 31)) | (word >> ((-shift) & 31)); +} + +/** + * ror32 - rotate a 32-bit value right + * @word: value to rotate + * @shift: bits to roll + */ +static inline u32 ror32(u32 word, unsigned int shift) +{ + return (word >> (shift & 31)) | (word << ((-shift) & 31)); +} + #include /* linux/include/asm-generic/bitops/non-atomic.h */