[Concept,15/17] ext4l: Move lock and scheduler stubs to proper headers

Message ID 20260120234344.495605-16-sjg@u-boot.org
State New
Headers
Series ext4l: Move compatibility stubs to standard Linux headers |

Commit Message

Simon Glass Jan. 20, 2026, 11:43 p.m. UTC
  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(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 1ac7b63819a..5ab32cba969 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -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 */
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index b13d85ef4e9..2246feaf261 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.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 }
 
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 579468ee414..9dca8f89f79 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -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 */
 
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 75afad92b9e..09fe285dfed 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -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;