diff options
author | 2020-06-22 05:19:26 +0000 | |
---|---|---|
committer | 2020-06-22 05:19:26 +0000 | |
commit | 16a5a46074444bb9d67f84f46ec6bc0398fa18b4 (patch) | |
tree | 943d1f07eb8fe0ed34ee25d72457b9aad26b6edd | |
parent | let userland read vpd info from a pci device. (diff) | |
download | wireguard-openbsd-16a5a46074444bb9d67f84f46ec6bc0398fa18b4.tar.xz wireguard-openbsd-16a5a46074444bb9d67f84f46ec6bc0398fa18b4.zip |
in wait_for_completion_* return 0 on timeout -ERESTARTSYS on signal
matches how the interfaces are documented
-rw-r--r-- | sys/dev/pci/drm/include/linux/completion.h | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/sys/dev/pci/drm/include/linux/completion.h b/sys/dev/pci/drm/include/linux/completion.h index 04f039bc166..0859221262e 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.6 2020/06/13 06:22:41 jsg Exp $ */ +/* $OpenBSD: completion.h,v 1.7 2020/06/22 05:19:26 jsg Exp $ */ /* * Copyright (c) 2015, 2018 Mark Kettenis * @@ -53,7 +53,8 @@ wait_for_completion_timeout(struct completion *x, u_long timo) ret = msleep(x, &x->wait.lock, 0, "wfct", timo); if (ret) { mtx_leave(&x->wait.lock); - return (ret == EWOULDBLOCK) ? 0 : -ret; + /* timeout */ + return 0; } } x->done--; @@ -62,25 +63,17 @@ wait_for_completion_timeout(struct completion *x, u_long timo) return 1; } -static inline u_long +static inline void wait_for_completion(struct completion *x) { - int ret; - KASSERT(!cold); mtx_enter(&x->wait.lock); while (x->done == 0) { - ret = msleep_nsec(x, &x->wait.lock, 0, "wfcom", INFSLP); - if (ret) { - mtx_leave(&x->wait.lock); - return (ret == EWOULDBLOCK) ? 0 : -ret; - } + msleep_nsec(x, &x->wait.lock, 0, "wfcom", INFSLP); } x->done--; mtx_leave(&x->wait.lock); - - return 0; } static inline u_long @@ -95,7 +88,9 @@ wait_for_completion_interruptible(struct completion *x) ret = msleep_nsec(x, &x->wait.lock, PCATCH, "wfci", INFSLP); if (ret) { mtx_leave(&x->wait.lock); - return (ret == EWOULDBLOCK) ? 0 : -ret; + if (ret == EWOULDBLOCK) + return 0; + return -ERESTARTSYS; } } x->done--; @@ -116,7 +111,9 @@ wait_for_completion_interruptible_timeout(struct completion *x, u_long timo) ret = msleep(x, &x->wait.lock, PCATCH, "wfcit", timo); if (ret) { mtx_leave(&x->wait.lock); - return (ret == EWOULDBLOCK) ? 0 : -ret; + if (ret == EWOULDBLOCK) + return 0; + return -ERESTARTSYS; } } x->done--; |