Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/opencrypto crypto(4): Narrow scope of cryptodev_mtx to c...
details: https://anonhg.NetBSD.org/src/rev/cd7b54f2379a
branches: trunk
changeset: 366211:cd7b54f2379a
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed May 18 20:03:45 2022 +0000
description:
crypto(4): Narrow scope of cryptodev_mtx to cover wait.
No functional change intended -- this only removes an unnecessary
lock/unlock cycle in the error case.
diffstat:
sys/opencrypto/cryptodev.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diffs (39 lines):
diff -r add456b5083c -r cd7b54f2379a sys/opencrypto/cryptodev.c
--- a/sys/opencrypto/cryptodev.c Wed May 18 20:03:32 2022 +0000
+++ b/sys/opencrypto/cryptodev.c Wed May 18 20:03:45 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cryptodev.c,v 1.110 2022/05/18 20:03:32 riastradh Exp $ */
+/* $NetBSD: cryptodev.c,v 1.111 2022/05/18 20:03:45 riastradh Exp $ */
/* $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $ */
/* $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $ */
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.110 2022/05/18 20:03:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.111 2022/05/18 20:03:45 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -653,7 +653,6 @@
cv_init(&crp->crp_cv, "crydev");
error = crypto_dispatch(crp);
- mutex_enter(&cryptodev_mtx);
/*
* Don't touch crp before returned by any error or received
@@ -665,11 +664,11 @@
break;
default:
DPRINTF("not waiting, error.\n");
- mutex_exit(&cryptodev_mtx);
cv_destroy(&crp->crp_cv);
goto bail;
}
+ mutex_enter(&cryptodev_mtx);
while (!(crp->crp_devflags & CRYPTODEV_F_RET)) {
DPRINTF("cse->sid[%d]: sleeping on cv %p for crp %p\n",
(uint32_t)cse->sid, &crp->crp_cv, crp);
Home |
Main Index |
Thread Index |
Old Index