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

From: Max Kellermann
Date: Wed Jan 31 2024 - 09:54:22 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 988ff0f0f84d..7fadcd30e505 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>
@@ -37,18 +38,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