linux: Add rwlock support to spinlock.h

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 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-12-21 12:45:57 -07:00
parent 789f4d44bb
commit 29d023d168

View File

@@ -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 */