@@ -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 \
deleted file mode 100644
@@ -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;
-}
@@ -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);
+}
@@ -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)
{