summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2021-12-28 13:22:43 +0000
committerriastradh <riastradh@NetBSD.org>2021-12-28 13:22:43 +0000
commit78c5b0a7e4a3b1a415f4a058ec0475b7a08c2ded (patch)
tree25e72e90b3112286ccadec77f74c135fafc34c12 /sys/dev
parentfd9592dbac6f8ffd87c142f508504f62b8de0abf (diff)
sys: Use preempt_point and preempt_needed, not open-coded versions.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/random.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/dev/random.c b/sys/dev/random.c
index 444b97e2fcf..454f290b758 100644
--- a/sys/dev/random.c
+++ b/sys/dev/random.c
@@ -1,4 +1,4 @@
-/* $NetBSD: random.c,v 1.9 2021/01/13 23:54:21 riastradh Exp $ */
+/* $NetBSD: random.c,v 1.10 2021/12/28 13:22:43 riastradh Exp $ */
/*-
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: random.c,v 1.9 2021/01/13 23:54:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: random.c,v 1.10 2021/12/28 13:22:43 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -282,9 +282,8 @@ random_write(dev_t dev, struct uio *uio, int flags)
rnd_add_data(&user_rndsource, buf, n, privileged ? n*NBBY : 0);
any = true;
- /* Yield if requested. */
- if (curcpu()->ci_schedstate.spc_flags & SPCF_SHOULDYIELD)
- preempt();
+ /* Now's a good time to yield if needed. */
+ preempt_point();
/* Check for interruption. */
if (__predict_false(curlwp->l_flag & LW_PENDSIG) &&