| Message ID | 20251230234134.906477-4-sjg@u-boot.org |
|---|---|
| State | New |
| Headers |
Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> 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=1767138279; bh=pq0gJyAnmaBvJbABY9B7XyOYVHPFtnaZXNJyupso39s=; 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=M1adhZteJ5D4Gl6bjwPyfWTCDGvggVtrtHkoF/F1iU8+i+TuLlUI6o1SJydqmNqDf lr7RosgqLI8YbqxUdzLlq3uf8k/xMQkRolvagoEYcBnFwhoT/Oab3tV+JhFd9dKQp7 Xl8nAnRE/LEvOCaKVtuCmxhhpZzZgdY/95r44Mg00AjkMLfM9ZBL+5VpnwGJVdAT1j 41gb2o1dlDYgl74RAvZbxhtfNkZV0S2HLucQKLqFsiStaREXR5i6y/iRXHDm3jg1BI DqRLRmVJXpa7pAViazcHCQFTrlsMpoU9BSi0kjekf5wPSmNgTli80BXGNJfj3/GcSb 5L7xpIR2j4eEg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3A47D64E2A for <u-boot-concept@u-boot.org>; Tue, 30 Dec 2025 16:44:39 -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 mGY7wUKJ6IPR for <u-boot-concept@u-boot.org>; Tue, 30 Dec 2025 16:44:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767138277; bh=pq0gJyAnmaBvJbABY9B7XyOYVHPFtnaZXNJyupso39s=; 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=lSzvXD8TEaORxZjf7nyXis4Lx9pDFqsYUxk7WL3OSGMFXjbmQb2ZkFuQ/Lr2Gno9g p2vkzghliJqUYaE+89YjJiwb8cP9QmGO11dIfAm6B+kvhRBAWBGcNUTIprJCyYMiMx Yh2sRKurkFKSq+VXmoR3fNWCF7L/RmWKAimFcCpw0PZpUO1w9hC70QctTBe6U3/K65 hQVLzFK0a35ECa1EGJkjb5th2DUPVFTHOhDMt4r1l1sCWoyyklNeHBCXgtZR5To6sZ BubndY5IVtDPr5HgEXt8Y08VYiwY+9HwRaN/Q5f+KR2uhRkDqqnt1OJticVUMwu0Ez Yb26jq7+ho1aw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 21A8868F9A for <u-boot-concept@u-boot.org>; Tue, 30 Dec 2025 16:44:37 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767138275; bh=0BsDARb6etYCgGV1EOs4mrQNSxzeNJX8ds3JtjaVEpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iThM5yBesUFHcbWTUfq/CRJlgiaCeQAbVAXSqDZRVfhq2U8XjHlOF4R5dMgxsU2lX lDQB6OJOhvWjsfn7X8G8Vx3alwEArqzuRsu5vrwpkmd8yMGiD1r16R1zSorAIccyX4 0/T9VtHyEZfOpbzCQYyby6k76fjJIv1Do5mWuT4VU3bLRCp9b2eCcki+wHtsxkqBWD RV/kUkkNa/Z6hpQN99EnHii14nbVz65eDHbJl5/PDJgSITW83UwbkLpCVwOyBArrWa 1t7B/spS1xDY50edetns8ehjOOyXlQNrU/r/oZpbn6F4ZhsA07I4A78fyV48CZUvm4 qvhxdex4kYBIA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ED5A168C58; Tue, 30 Dec 2025 16:44: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 10026) with ESMTP id bbxkggol46xo; Tue, 30 Dec 2025 16:44:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767138275; bh=2RtOffHWcQUUOZfJ1n0Urfn8ZcxMpJUxEVazkaouakg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KB4Ubsbb6Sq6biIkR1lqrC65u9Z0nN8D40irbpefIw5ZlB8p6s0MBJVzIGH9sVqFt wzU68I5gu4GUk1aZmVL3mPqt6AVDpJE7A3ySqpoKFHfjFasNxQUL2pdN7mcn9Yay8W jhjZyNAhoTw19nbkQJBf8LFehvkJile2N+8ej5P9VtRhmSRedgIqk8Vdz6PlqAge+h 36rUxLRiOmmw4ED56MmtbU8VJHIqSsYmA3MawfasLrbdgBD4TJ/GArcTx4WBXOuicO gRFPDaX459IUXF4OHXU/2ZU/A5Nm8/hu+/ixhHpvqL4QQpLUPeRkfG+fYCOXMoMP+w A1B6y5IVsqtGQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6B39B68C0F; Tue, 30 Dec 2025 16:44:35 -0700 (MST) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Tue, 30 Dec 2025 16:41:15 -0700 Message-ID: <20251230234134.906477-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251230234134.906477-1-sjg@u-boot.org> References: <20251230234134.906477-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: KZZHDAQLBR5LJD3N2MQOYMCLDKV4UNWB X-Message-ID-Hash: KZZHDAQLBR5LJD3N2MQOYMCLDKV4UNWB 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 <simon.glass@canonical.com>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/15] bitops: linux: Add fns() to find N'th set bit List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/KZZHDAQLBR5LJD3N2MQOYMCLDKV4UNWB/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit |
| Series |
ext4l: Infrastructure and fixes for write support (part K)
|
|
Commit Message
Simon Glass
Dec. 30, 2025, 11:41 p.m. UTC
From: Simon Glass <simon.glass@canonical.com> Add the fns() function from Linux to find the N'th set bit in a word. This is needed by lib/find_bit.c which uses it in the FIND_NTH_BIT macro. Taken from Linux v6.19 Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- include/linux/bitops.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index f826d7f3b34..86f7ee492b4 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -194,6 +194,19 @@ static inline unsigned long __ffs64(u64 word) return __ffs((unsigned long)word); } +/** + * fns - find N'th set bit in a word + * @word: The word to search + * @n: Bit to find + */ +static inline unsigned int fns(unsigned long word, unsigned int n) +{ + while (word && n--) + word &= word - 1; + + return word ? __ffs(word) : BITS_PER_LONG; +} + /** * __set_bit - Set a bit in memory * @nr: the bit to set