From patchwork Mon Dec 22 11:56:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1039 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=1766404646; bh=ArKxYkSF+iQC0fRdbAdKGgOCFg6PAuJSKcWM/xCytmk=; 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=aBw3mYp2tcr5KAi4dBFWNjyGumSmITXr4KjbgmSeZfMe3SEj97BwJCMbBl84NLXGD SHLv9UMeJZr2p/mq20lLEQL1UoTBsBNy7U7yoOY32cxdViWKj4He5+303AHgUEtcjX Io0nchyO3ZwwK8gWuEuj8sidSbQyGvMJJHpsZS9Hxhakun8eqH4i46Grc2csQP5Q8/ kGjBq3if7sYSenCLwDDxTvqckUapljRbq9f7FQw7mFyK1lekGOg5Am8TpDWWp1mcGK VLjiAaUnwXZHcf8ZUz0T8EScPXI2qnXZmz0344szJZdOMGnoVG9PiB9mWNP9w97NKp h7BS/Z8viAQoA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 74F7B64D66 for ; Mon, 22 Dec 2025 04:57:26 -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 WOPmTB5T0I9m for ; Mon, 22 Dec 2025 04:57:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404646; bh=ArKxYkSF+iQC0fRdbAdKGgOCFg6PAuJSKcWM/xCytmk=; 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=aBw3mYp2tcr5KAi4dBFWNjyGumSmITXr4KjbgmSeZfMe3SEj97BwJCMbBl84NLXGD SHLv9UMeJZr2p/mq20lLEQL1UoTBsBNy7U7yoOY32cxdViWKj4He5+303AHgUEtcjX Io0nchyO3ZwwK8gWuEuj8sidSbQyGvMJJHpsZS9Hxhakun8eqH4i46Grc2csQP5Q8/ kGjBq3if7sYSenCLwDDxTvqckUapljRbq9f7FQw7mFyK1lekGOg5Am8TpDWWp1mcGK VLjiAaUnwXZHcf8ZUz0T8EScPXI2qnXZmz0344szJZdOMGnoVG9PiB9mWNP9w97NKp h7BS/Z8viAQoA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 62A0164D62 for ; Mon, 22 Dec 2025 04:57:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404644; bh=YAfcOmBC/A3PHLi4HEIJjpxKtP5vo8xHtUZLE38SPS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MGdxHV2XGm32SxGQDphLuxenh8vdUhc+IbHw9bvxYgOg4vys82+4ffU+ybnyN59dn x2LPvELum6ce1zh2c2PaBzjPTAf2LVoItwIbGnKk2HRsI7R3/bcFasEkZXbJf7mmJr GxrZae38pggugcWs8ihKDadPwFNa/GceljeE1Ld1eVYIc7HOA/cnhvh0VPu/czPqEt wruBJV0CxlnxHv/geE3Dq8Lm2Z1tk4Tx84rX87L9hQy9WE8SXeQkpWmEXPSDDfmLH6 4wVphOt1zmt99+TeNTqEvWLzhK/XRN1prvu0RLV7Jq1UqlPnZF5FY1ufJjX6vqmbbs XlkxQzM/v18fg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2CD5764CD4; Mon, 22 Dec 2025 04:57:24 -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 nMVPOUeMu-uq; Mon, 22 Dec 2025 04:57:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766404638; bh=k61NCBWo0X26P08OIp2at10DzSPH/3We6Z15WR6oh04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=avRKXjPzG9TFp5+63VDcEZ40/Ba8mZO7t6+B1NIKPTEAdL+A4SoYIzn1kIdWS5shH uwKltqwC6Sbxb66KeiUaHM/QM+hY6g1eYdU8XTgpPd//Jfo4hVp7IL/NBHhTsoiOiE cirnsemf5K7W42YwuA2mnW0Hzwz9XZXZQLg4TwbelilzhP0h/j7MMwQIl8YuJvkW+N C+qRWnwqyWSz2QDld9j9bUQXzdWcUoWSBJOaeSEoJLoecH3PjNX/b2s9nRqKO9VSXP TeIlwJVyJD40pJ8LCJ6P8YGHVaB937bONzsP33FmCP5e93Le2SDbA0e/1J73n5fEl2 aWrPcEsj9nh9Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C44D664D6D; Mon, 22 Dec 2025 04:57:17 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 22 Dec 2025 04:56:13 -0700 Message-ID: <20251222115639.700578-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222115639.700578-1-sjg@u-boot.org> References: <20251222115639.700578-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: GHOZ5WAEL22E2SM6MEVW4PDWPBLH3V3E X-Message-ID-Hash: GHOZ5WAEL22E2SM6MEVW4PDWPBLH3V3E 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 09/26] linux: Add rwlock support to spinlock.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 Add rwlock_t type and read/write lock operation stubs to spinlock.h. These are no-ops for single-threaded U-Boot but provide the API needed by Linux-derived code. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/spinlock.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 906766931b4..75afad92b9e 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -78,4 +78,25 @@ typedef struct { /* Assert variants */ #define assert_spin_locked(lock) do { } while (0) +/* Read-write lock type - just an int for U-Boot */ +typedef int rwlock_t; + +#define __RW_LOCK_UNLOCKED(lockname) (0) +#define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) + +/* Read-write lock operations - all no-ops for single-threaded U-Boot */ +#define rwlock_init(lock) do { } while (0) +#define read_lock(lock) do { } while (0) +#define read_unlock(lock) do { } while (0) +#define write_lock(lock) do { } while (0) +#define write_unlock(lock) do { } while (0) +#define read_lock_irq(lock) do { } while (0) +#define read_unlock_irq(lock) do { } while (0) +#define write_lock_irq(lock) do { } while (0) +#define write_unlock_irq(lock) do { } while (0) +#define read_lock_irqsave(lock, flags) do { (void)(flags); } while (0) +#define read_unlock_irqrestore(lock, flags) do { (void)(flags); } while (0) +#define write_lock_irqsave(lock, flags) do { (void)(flags); } while (0) +#define write_unlock_irqrestore(lock, flags) do { (void)(flags); } while (0) + #endif /* __LINUX_SPINLOCK_H */