[Concept,09/34] ext4l: Use linux/completion.h for completion stubs

Message ID 20260114225635.3407989-10-sjg@u-boot.org
State New
Headers
Series ext4l: Clean up ext4_uboot.h by moving definitions to standard headers |

Commit Message

Simon Glass Jan. 14, 2026, 10:55 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Remove the local 'struct completion' definition and the
wait_for_completion() function from ext4lm using linux/completion.h
instead. The header provides the same stub functionality via macros and
static inline functions.

Also fix linux/completion.h to use 'static inline' instead of just
'inline' for the U-Boot stub functions to prevent multiple definition
errors when the header is included in multiple C files.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 fs/ext4l/ext4_uboot.h      |  8 +++-----
 fs/ext4l/stub.c            |  5 +----
 include/linux/completion.h | 24 ++++++++++++------------
 3 files changed, 16 insertions(+), 21 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index aee6938977d..16b0512781f 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -126,10 +126,8 @@  struct lock_class_key { int dummy; };
 #define rwsem_release(l, i)		do { } while (0)
 #define _THIS_IP_			((unsigned long)0)
 
-/* completion - stub */
-struct completion {
-	unsigned int done;
-};
+/* completion - use Linux header */
+#include <linux/completion.h>
 
 /* Cache alignment - stub */
 #define ____cacheline_aligned_in_smp
@@ -2135,7 +2133,7 @@  void invalidate_bdev(struct block_device *bdev);
 
 /* Kobject - declarations for stub.c */
 void kobject_put(struct kobject *kobj);
-void wait_for_completion(struct completion *comp);
+/* wait_for_completion is now a macro in linux/completion.h */
 
 /* DAX - declaration for stub.c */
 void fs_put_dax(void *dax, void *holder);
diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c
index 2084faa3b50..6e16af2dc24 100644
--- a/fs/ext4l/stub.c
+++ b/fs/ext4l/stub.c
@@ -486,10 +486,7 @@  void kobject_put(struct kobject *kobj)
 {
 }
 
-/* completion */
-void wait_for_completion(struct completion *comp)
-{
-}
+/* completion - now uses linux/completion.h macro */
 
 /* DAX */
 void *fs_dax_get_by_bdev(struct block_device *bdev, u64 *start, u64 *len,
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 9835826d285..7336421ea84 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -129,39 +129,39 @@  extern void complete_all(struct completion *);
 #define wait_for_completion(x)		do {} while (0)
 #define wait_for_completion_io(x)	do {} while (0)
 
-inline int wait_for_completion_interruptible(struct completion *x)
+static inline int wait_for_completion_interruptible(struct completion *x)
 {
 	return 1;
 }
-inline int wait_for_completion_killable(struct completion *x)
+static inline int wait_for_completion_killable(struct completion *x)
 {
 	return 1;
 }
-inline unsigned long wait_for_completion_timeout(struct completion *x,
-						 unsigned long timeout)
+static inline unsigned long wait_for_completion_timeout(struct completion *x,
+							unsigned long timeout)
 {
 	return 1;
 }
-inline unsigned long wait_for_completion_io_timeout(struct completion *x,
-						    unsigned long timeout)
+static inline unsigned long wait_for_completion_io_timeout(struct completion *x,
+							   unsigned long timeout)
 {
 	return 1;
 }
-inline long wait_for_completion_interruptible_timeout(struct completion *x,
-						      unsigned long timeout)
+static inline long wait_for_completion_interruptible_timeout(struct completion *x,
+							     unsigned long timeout)
 {
 	return 1;
 }
-inline long wait_for_completion_killable_timeout(struct completion *x,
-						 unsigned long timeout)
+static inline long wait_for_completion_killable_timeout(struct completion *x,
+							unsigned long timeout)
 {
 	return 1;
 }
-inline bool try_wait_for_completion(struct completion *x)
+static inline bool try_wait_for_completion(struct completion *x)
 {
 	return 1;
 }
-inline bool completion_done(struct completion *x)
+static inline bool completion_done(struct completion *x)
 {
 	return 1;
 }