aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@kernel.org>2024-02-09 09:54:53 -0600
committerMike Snitzer <snitzer@kernel.org>2024-03-01 09:25:54 -0500
commit877f36b76485d1e0dab5a9de8a7175c66cc791e3 (patch)
treeb9f5a3bdd48845c0c0cb7d3a1b314762975cd184 /drivers/md
parent8e6333af19830efdd5adbc994f256fcd5f31e7e7 (diff)
downloadlinux-877f36b76485d1e0dab5a9de8a7175c66cc791e3.tar.gz
dm vdo: fold thread-cond-var.c into thread-utils
Further cleanup is needed for thread-utils interfaces given many functions should return void or be removed entirely because they amount to obfuscation via wrappers. Signed-off-by: Mike Snitzer <snitzer@kernel.org> Signed-off-by: Matthew Sakai <msakai@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-vdo/Makefile1
-rw-r--r--drivers/md/dm-vdo/thread-cond-var.c46
-rw-r--r--drivers/md/dm-vdo/thread-utils.c11
-rw-r--r--drivers/md/dm-vdo/thread-utils.h28
4 files changed, 34 insertions, 52 deletions
diff --git a/drivers/md/dm-vdo/Makefile b/drivers/md/dm-vdo/Makefile
index be5020b81c475..32266ab04cc19 100644
--- a/drivers/md/dm-vdo/Makefile
+++ b/drivers/md/dm-vdo/Makefile
@@ -48,7 +48,6 @@ dm-vdo-objs := \
status-codes.o \
string-utils.o \
sysfs.o \
- thread-cond-var.o \
thread-device.o \
thread-registry.o \
thread-utils.o \
diff --git a/drivers/md/dm-vdo/thread-cond-var.c b/drivers/md/dm-vdo/thread-cond-var.c
deleted file mode 100644
index 82b80338b4489..0000000000000
--- a/drivers/md/dm-vdo/thread-cond-var.c
+++ /dev/null
@@ -1,46 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Copyright 2023 Red Hat
- */
-
-#include <linux/jiffies.h>
-#include <linux/minmax.h>
-
-#include "errors.h"
-#include "thread-utils.h"
-#include "time-utils.h"
-
-int uds_init_cond(struct cond_var *cv)
-{
- init_waitqueue_head(&cv->wait_queue);
- return UDS_SUCCESS;
-}
-
-int uds_signal_cond(struct cond_var *cv)
-{
- wake_up(&cv->wait_queue);
- return UDS_SUCCESS;
-}
-
-int uds_broadcast_cond(struct cond_var *cv)
-{
- wake_up_all(&cv->wait_queue);
- return UDS_SUCCESS;
-}
-
-int uds_wait_cond(struct cond_var *cv, struct mutex *mutex)
-{
- DEFINE_WAIT(__wait);
-
- prepare_to_wait(&cv->wait_queue, &__wait, TASK_IDLE);
- uds_unlock_mutex(mutex);
- schedule();
- finish_wait(&cv->wait_queue, &__wait);
- uds_lock_mutex(mutex);
- return UDS_SUCCESS;
-}
-
-int uds_destroy_cond(struct cond_var *cv)
-{
- return UDS_SUCCESS;
-}
diff --git a/drivers/md/dm-vdo/thread-utils.c b/drivers/md/dm-vdo/thread-utils.c
index 1a1eb9ae9e332..5d371bfba8ff4 100644
--- a/drivers/md/dm-vdo/thread-utils.c
+++ b/drivers/md/dm-vdo/thread-utils.c
@@ -135,3 +135,14 @@ int uds_join_threads(struct thread *thread)
uds_free(thread);
return UDS_SUCCESS;
}
+
+void uds_wait_cond(struct cond_var *cv, struct mutex *mutex)
+{
+ DEFINE_WAIT(__wait);
+
+ prepare_to_wait(&cv->wait_queue, &__wait, TASK_IDLE);
+ uds_unlock_mutex(mutex);
+ schedule();
+ finish_wait(&cv->wait_queue, &__wait);
+ uds_lock_mutex(mutex);
+}
diff --git a/drivers/md/dm-vdo/thread-utils.h b/drivers/md/dm-vdo/thread-utils.h
index 30637dd264cc8..c7a5d2d948a4f 100644
--- a/drivers/md/dm-vdo/thread-utils.h
+++ b/drivers/md/dm-vdo/thread-utils.h
@@ -31,11 +31,29 @@ void uds_perform_once(atomic_t *once_state, void (*function) (void));
int uds_join_threads(struct thread *thread);
-int __must_check uds_init_cond(struct cond_var *cond);
-int uds_signal_cond(struct cond_var *cond);
-int uds_broadcast_cond(struct cond_var *cond);
-int uds_wait_cond(struct cond_var *cond, struct mutex *mutex);
-int uds_destroy_cond(struct cond_var *cond);
+static inline int __must_check uds_init_cond(struct cond_var *cv)
+{
+ init_waitqueue_head(&cv->wait_queue);
+ return UDS_SUCCESS;
+}
+
+static inline void uds_signal_cond(struct cond_var *cv)
+{
+ wake_up(&cv->wait_queue);
+}
+
+static inline void uds_broadcast_cond(struct cond_var *cv)
+{
+ wake_up_all(&cv->wait_queue);
+}
+
+void uds_wait_cond(struct cond_var *cv, struct mutex *mutex);
+
+/* FIXME: all below wrappers should be removed! */
+
+static inline void uds_destroy_cond(struct cond_var *cv)
+{
+}
static inline int __must_check uds_init_mutex(struct mutex *mutex)
{