[Concept,15/17] ext4l: Move lock and scheduler stubs to proper headers
Commit Message
From: Simon Glass <simon.glass@canonical.com>
Move mutex_lock_io() to linux/mutex.h where the Linux kernel defines it.
Move spin_needbreak() to linux/spinlock.h where the Linux kernel defines
it.
Move cond_resched_lock() to linux/sched.h where the Linux kernel defines
it.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
fs/ext4l/ext4_uboot.h | 3 +--
include/linux/mutex.h | 1 +
include/linux/sched.h | 1 +
include/linux/spinlock.h | 3 +++
4 files changed, 6 insertions(+), 2 deletions(-)
@@ -1320,8 +1320,7 @@ struct disk_partition *ext4l_get_partition(void);
/* DEFINE_WAIT stub - creates a wait queue entry */
#define DEFINE_WAIT(name) int name = 0
-/* cond_resched_lock - conditionally reschedule while holding a lock */
-#define cond_resched_lock(lock) do { (void)(lock); } while (0)
+/* cond_resched_lock is in linux/sched.h */
/* JBD2 journal.c stubs */
/* alloc_buffer_head, __getblk are in linux/buffer_head.h */
@@ -25,6 +25,7 @@ struct mutex {
#define mutex_trylock(lock) ({ 1; })
#define mutex_is_locked(lock) ({ 0; })
#define mutex_destroy(lock) do { } while (0)
+#define mutex_lock_io(lock) mutex_lock(lock)
#define __MUTEX_INITIALIZER(lockname) { .locked = 0 }
@@ -35,6 +35,7 @@ extern struct task_struct *current;
#define TASK_UNINTERRUPTIBLE 2
#define cond_resched() do { } while (0)
+#define cond_resched_lock(lock) do { (void)(lock); } while (0)
#define yield() do { } while (0)
/* Note: schedule() is implemented in common/cyclic.c */
@@ -78,6 +78,9 @@ typedef struct {
/* Assert variants */
#define assert_spin_locked(lock) do { } while (0)
+/* spin_needbreak - check if lock should be released (always false in U-Boot) */
+#define spin_needbreak(lock) ({ (void)(lock); 0; })
+
/* Read-write lock type - just an int for U-Boot */
typedef int rwlock_t;