diff options
author | 2021-02-08 08:18:45 +0000 | |
---|---|---|
committer | 2021-02-08 08:18:45 +0000 | |
commit | 436960cf02775967604f33beab159c0cf4ade5a0 (patch) | |
tree | 022a7dc14e584a114cfe643944556b30f771ce14 /sys/dev/pci/drm/drm_linux.c | |
parent | route-to rules take ips, not interfaces with optional ips. (diff) | |
download | wireguard-openbsd-436960cf02775967604f33beab159c0cf4ade5a0.tar.xz wireguard-openbsd-436960cf02775967604f33beab159c0cf4ade5a0.zip |
Simplify sleep_setup API to two operations in preparation for splitting
the SCHED_LOCK().
Putting a thread on a sleep queue is reduce to the following:
sleep_setup();
/* check condition or release lock */
sleep_finish();
Previous version ok cheloha@, jmatthew@, ok claudio@
Diffstat (limited to 'sys/dev/pci/drm/drm_linux.c')
-rw-r--r-- | sys/dev/pci/drm/drm_linux.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c index 55462ad34a7..d400d72ebc9 100644 --- a/sys/dev/pci/drm/drm_linux.c +++ b/sys/dev/pci/drm/drm_linux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.c,v 1.76 2021/01/13 01:04:49 jsg Exp $ */ +/* $OpenBSD: drm_linux.c,v 1.77 2021/02/08 08:18:45 mpi Exp $ */ /* * Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org> * Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org> @@ -110,14 +110,14 @@ schedule_timeout(long timeout) { struct sleep_state sls; unsigned long deadline; - int wait, spl; + int wait, spl, timo = 0; MUTEX_ASSERT_LOCKED(&sch_mtx); KASSERT(!cold); - sleep_setup(&sls, sch_ident, sch_priority, "schto"); if (timeout != MAX_SCHEDULE_TIMEOUT) - sleep_setup_timeout(&sls, timeout); + timo = timeout; + sleep_setup(&sls, sch_ident, sch_priority, "schto", timo); wait = (sch_proc == curproc && timeout > 0); @@ -125,11 +125,9 @@ schedule_timeout(long timeout) MUTEX_OLDIPL(&sch_mtx) = splsched(); mtx_leave(&sch_mtx); - sleep_setup_signal(&sls); - if (timeout != MAX_SCHEDULE_TIMEOUT) deadline = jiffies + timeout; - sleep_finish_all(&sls, wait); + sleep_finish(&sls, wait); if (timeout != MAX_SCHEDULE_TIMEOUT) timeout = deadline - jiffies; |