[Concept,10/11] ext4l: Extract timer declarations into their own file
Commit Message
From: Simon Glass <simon.glass@canonical.com>
Create include/linux/timer.h and include/linux/workqueue.h with stub
definitions for kernel timer and workqueue support. U-Boot doesn't use
these subsystems.
timer.h:
- struct timer_list
- setup_timer(), del_timer(), del_timer_sync()
- timer_setup(), mod_timer(), timer_pending()
workqueue.h:
- struct work_struct, struct delayed_work
- INIT_WORK(), schedule_work()
- queue_work(), cancel_work_sync()
- alloc_workqueue(), destroy_workqueue()
Update compat.h to include these headers and remove duplicate
definitions.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
include/linux/compat.h | 9 ++-------
include/linux/timer.h | 30 ++++++++++++++++++++++++++++++
include/linux/workqueue.h | 37 +++++++++++++++++++++++++++++++++++++
3 files changed, 69 insertions(+), 7 deletions(-)
create mode 100644 include/linux/timer.h
create mode 100644 include/linux/workqueue.h
@@ -18,8 +18,10 @@
#include <linux/kthread.h>
#include <linux/module.h>
#include <linux/slab.h>
+#include <linux/timer.h>
#include <linux/uaccess.h>
#include <linux/vmalloc.h>
+#include <linux/workqueue.h>
#ifdef CONFIG_XEN
#include <xen/events.h>
@@ -162,12 +164,6 @@ typedef unsigned long blkcnt_t;
#define dump_stack(...) do { } while (0)
-#define setup_timer(timer, func, data) do {} while (0)
-#define del_timer_sync(timer) do {} while (0)
-#define schedule_work(work) do {} while (0)
-#define INIT_WORK(work, fun) do {} while (0)
-
-struct work_struct {};
typedef unused_t spinlock_t;
@@ -280,7 +276,6 @@ struct writeback_control {
typedef int irqreturn_t;
-struct timer_list {};
struct notifier_block {};
typedef unsigned long dmaaddr_t;
new file mode 100644
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Stub definitions for Linux kernel timer support.
+ * U-Boot doesn't use kernel timers.
+ */
+#ifndef _LINUX_TIMER_H
+#define _LINUX_TIMER_H
+
+struct timer_list {
+ unsigned long expires;
+ void (*function)(struct timer_list *);
+ unsigned long data;
+};
+
+#define DEFINE_TIMER(name, func) \
+ struct timer_list name = { .function = func }
+
+#define setup_timer(timer, func, data) do { } while (0)
+#define timer_setup(timer, func, flags) do { } while (0)
+#define init_timer(timer) do { } while (0)
+#define add_timer(timer) do { } while (0)
+#define del_timer(timer) 0
+#define del_timer_sync(timer) 0
+#define mod_timer(timer, expires) 0
+#define timer_pending(timer) 0
+
+#define from_timer(var, callback_timer, timer_fieldname) \
+ container_of(callback_timer, typeof(*var), timer_fieldname)
+
+#endif /* _LINUX_TIMER_H */
new file mode 100644
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * workqueue.h --- work queue handling for Linux.
+ *
+ * Stub definitions for Linux kernel workqueue support.
+ * U-Boot doesn't use workqueues.
+ */
+#ifndef _LINUX_WORKQUEUE_H
+#define _LINUX_WORKQUEUE_H
+
+struct work_struct {
+ void (*func)(struct work_struct *);
+};
+
+struct delayed_work {
+ struct work_struct work;
+};
+
+#define INIT_WORK(work, func) do { } while (0)
+#define INIT_DELAYED_WORK(work, func) do { } while (0)
+#define schedule_work(work) 0
+#define schedule_delayed_work(work, delay) 0
+#define cancel_work_sync(work) 0
+#define cancel_delayed_work(work) 0
+#define cancel_delayed_work_sync(work) 0
+#define flush_work(work) 0
+#define flush_delayed_work(work) 0
+#define queue_work(wq, work) 0
+#define queue_delayed_work(wq, work, delay) 0
+
+#define alloc_workqueue(fmt, flags, max, ...) ((struct workqueue_struct *)1)
+#define create_singlethread_workqueue(name) ((struct workqueue_struct *)1)
+#define destroy_workqueue(wq) do { } while (0)
+
+struct workqueue_struct;
+
+#endif /* _LINUX_WORKQUEUE_H */