summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2020-06-22 14:19:36 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2020-06-22 14:19:36 +0000
commitc5a87ba79047b20d8b39b7dbe266d1fca300438d (patch)
tree9a0a580d91a552034963dac87280d2d528ff97f0 /sys/dev/pci
parent911ee731e28d6573a1e40b505d49699c7ccb0133 (diff)
apart from the lock wait_queue_head struct is unused so replace it
Diffstat (limited to 'sys/dev/pci')
-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;
}