summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2020-06-22 14:19:35 +0000
committerjsg <jsg@openbsd.org>2020-06-22 14:19:35 +0000
commitbb5b81493718e8e9da4fbeb99dc8381b0b09a051 (patch)
tree8327ee7d503eef10bc3649f18556ffd1e6338505
parentProvide working definitions of PROC_STACK() and PROC_PC(). (diff)
downloadwireguard-openbsd-bb5b81493718e8e9da4fbeb99dc8381b0b09a051.tar.xz
wireguard-openbsd-bb5b81493718e8e9da4fbeb99dc8381b0b09a051.zip
apart from the lock wait_queue_head struct is unused so replace it
-rw-r--r--sys/dev/pci/drm/include/linux/completion.h50
1 files changed, 25 insertions, 25 deletions
diff --git a/sys/dev/pci/drm/include/linux/completion.h b/sys/dev/pci/drm/include/linux/completion.h
index f7f883270fc..ea9c1fa13c0 100644
--- a/sys/dev/pci/drm/include/linux/completion.h
+++ b/sys/dev/pci/drm/include/linux/completion.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: completion.h,v 1.8 2020/06/22 13:38:47 jsg Exp $ */
+/* $OpenBSD: completion.h,v 1.9 2020/06/22 14:19:35 jsg Exp $ */
/*
* Copyright (c) 2015, 2018 Mark Kettenis
*
@@ -25,14 +25,14 @@
struct completion {
u_int done;
- wait_queue_head_t wait;
+ struct mutex lock;
};
static inline void
init_completion(struct completion *x)
{
x->done = 0;
- mtx_init(&x->wait.lock, IPL_TTY);
+ mtx_init(&x->lock, IPL_TTY);
}
static inline void
@@ -48,18 +48,18 @@ wait_for_completion_timeout(struct completion *x, u_long timo)
KASSERT(!cold);
- mtx_enter(&x->wait.lock);
+ mtx_enter(&x->lock);
while (x->done == 0) {
- ret = msleep(x, &x->wait.lock, 0, "wfct", timo);
+ ret = msleep(x, &x->lock, 0, "wfct", timo);
if (ret) {
- mtx_leave(&x->wait.lock);
+ mtx_leave(&x->lock);
/* timeout */
return 0;
}
}
if (x->done != UINT_MAX)
x->done--;
- mtx_leave(&x->wait.lock);
+ mtx_leave(&x->lock);
return 1;
}
@@ -69,13 +69,13 @@ wait_for_completion(struct completion *x)
{
KASSERT(!cold);
- mtx_enter(&x->wait.lock);
+ mtx_enter(&x->lock);
while (x->done == 0) {
- msleep_nsec(x, &x->wait.lock, 0, "wfcom", INFSLP);
+ msleep_nsec(x, &x->lock, 0, "wfcom", INFSLP);
}
if (x->done != UINT_MAX)
x->done--;
- mtx_leave(&x->wait.lock);
+ mtx_leave(&x->lock);
}
static inline u_long
@@ -85,11 +85,11 @@ wait_for_completion_interruptible(struct completion *x)
KASSERT(!cold);
- mtx_enter(&x->wait.lock);
+ mtx_enter(&x->lock);
while (x->done == 0) {
- ret = msleep_nsec(x, &x->wait.lock, PCATCH, "wfci", INFSLP);
+ ret = msleep_nsec(x, &x->lock, PCATCH, "wfci", INFSLP);
if (ret) {
- mtx_leave(&x->wait.lock);
+ mtx_leave(&x->lock);
if (ret == EWOULDBLOCK)
return 0;
return -ERESTARTSYS;
@@ -97,7 +97,7 @@ wait_for_completion_interruptible(struct completion *x)
}
if (x->done != UINT_MAX)
x->done--;
- mtx_leave(&x->wait.lock);
+ mtx_leave(&x->lock);
return 0;
}
@@ -109,11 +109,11 @@ wait_for_completion_interruptible_timeout(struct completion *x, u_long timo)
KASSERT(!cold);
- mtx_enter(&x->wait.lock);
+ mtx_enter(&x->lock);
while (x->done == 0) {
- ret = msleep(x, &x->wait.lock, PCATCH, "wfcit", timo);
+ ret = msleep(x, &x->lock, PCATCH, "wfcit", timo);
if (ret) {
- mtx_leave(&x->wait.lock);
+ mtx_leave(&x->lock);
if (ret == EWOULDBLOCK)
return 0;
return -ERESTARTSYS;
@@ -121,7 +121,7 @@ wait_for_completion_interruptible_timeout(struct completion *x, u_long timo)
}
if (x->done != UINT_MAX)
x->done--;
- mtx_leave(&x->wait.lock);
+ mtx_leave(&x->lock);
return 1;
}
@@ -129,33 +129,33 @@ wait_for_completion_interruptible_timeout(struct completion *x, u_long timo)
static inline void
complete(struct completion *x)
{
- mtx_enter(&x->wait.lock);
+ mtx_enter(&x->lock);
if (x->done != UINT_MAX)
x->done++;
- mtx_leave(&x->wait.lock);
+ mtx_leave(&x->lock);
wakeup_one(x);
}
static inline void
complete_all(struct completion *x)
{
- mtx_enter(&x->wait.lock);
+ mtx_enter(&x->lock);
x->done = UINT_MAX;
- mtx_leave(&x->wait.lock);
+ mtx_leave(&x->lock);
wakeup(x);
}
static inline bool
try_wait_for_completion(struct completion *x)
{
- mtx_enter(&x->wait.lock);
+ mtx_enter(&x->lock);
if (x->done == 0) {
- mtx_leave(&x->wait.lock);
+ mtx_leave(&x->lock);
return false;
}
if (x->done != UINT_MAX)
x->done--;
- mtx_leave(&x->wait.lock);
+ mtx_leave(&x->lock);
return true;
}