[PATCH v4 14/35] swait.h: move declarations to swait_types.h

From: Max Kellermann
Date: Sun Feb 11 2024 - 18:17:32 EST


By providing declarations in a lean header, we can reduce header
dependencies.

Signed-off-by: Max Kellermann <max.kellermann@xxxxxxxxx>
---
include/linux/swait.h | 13 +------------
include/linux/swait_types.h | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 12 deletions(-)
create mode 100644 include/linux/swait_types.h

diff --git a/include/linux/swait.h b/include/linux/swait.h
index 68c2e30edb1c..4a4a240b337e 100644
--- a/include/linux/swait.h
+++ b/include/linux/swait.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_SWAIT_H
#define _LINUX_SWAIT_H

+#include <linux/swait_types.h>
#include <linux/list.h>
#include <linux/stddef.h>
#include <linux/spinlock_types.h>
@@ -38,18 +39,6 @@
* wait queues in most cases.
*/

-struct task_struct;
-
-struct swait_queue_head {
- raw_spinlock_t lock;
- struct list_head task_list;
-};
-
-struct swait_queue {
- struct task_struct *task;
- struct list_head task_list;
-};
-
#define __SWAITQUEUE_INITIALIZER(name) { \
.task = current, \
.task_list = LIST_HEAD_INIT((name).task_list), \
diff --git a/include/linux/swait_types.h b/include/linux/swait_types.h
new file mode 100644
index 000000000000..316038879a37
--- /dev/null
+++ b/include/linux/swait_types.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_SWAIT_TYPES_H
+#define _LINUX_SWAIT_TYPES_H
+
+#include <linux/list.h>
+#include <linux/spinlock_types.h>
+
+struct task_struct;
+
+struct swait_queue_head {
+ raw_spinlock_t lock;
+ struct list_head task_list;
+};
+
+struct swait_queue {
+ struct task_struct *task;
+ struct list_head task_list;
+};
+
+#endif /* _LINUX_SWAIT_TYPES_H */
--
2.39.2