Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/opencrypto refactor crypto_unblock(). No functional change.



details:   https://anonhg.NetBSD.org/src/rev/eaf4e0bdaf9f
branches:  trunk
changeset: 823465:eaf4e0bdaf9f
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Mon Apr 24 01:42:00 2017 +0000

description:
refactor crypto_unblock(). No functional change.

diffstat:

 sys/opencrypto/crypto.c |  38 ++++++++++++++++++--------------------
 1 files changed, 18 insertions(+), 20 deletions(-)

diffs (65 lines):

diff -r 7296203bbe7a -r eaf4e0bdaf9f sys/opencrypto/crypto.c
--- a/sys/opencrypto/crypto.c   Sun Apr 23 23:39:42 2017 +0000
+++ b/sys/opencrypto/crypto.c   Mon Apr 24 01:42:00 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crypto.c,v 1.54 2017/04/07 12:17:57 knakahara Exp $ */
+/*     $NetBSD: crypto.c,v 1.55 2017/04/24 01:42:00 knakahara Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $   */
 /*     $OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $ */
 
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.54 2017/04/07 12:17:57 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.55 2017/04/24 01:42:00 knakahara Exp $");
 
 #include <sys/param.h>
 #include <sys/reboot.h>
@@ -701,30 +701,28 @@
 crypto_unblock(u_int32_t driverid, int what)
 {
        struct cryptocap *cap;
-       int needwakeup, err;
+       int needwakeup = 0;
 
        mutex_spin_enter(&crypto_q_mtx);
        cap = crypto_checkdriver(driverid);
-       if (cap != NULL) {
-               needwakeup = 0;
-               if (what & CRYPTO_SYMQ) {
-                       needwakeup |= cap->cc_qblocked;
-                       cap->cc_qblocked = 0;
-               }
-               if (what & CRYPTO_ASYMQ) {
-                       needwakeup |= cap->cc_kqblocked;
-                       cap->cc_kqblocked = 0;
-               }
-               err = 0;
-               if (needwakeup)
-                       setsoftcrypto(softintr_cookie);
+       if (cap == NULL) {
                mutex_spin_exit(&crypto_q_mtx);
-       } else {
-               err = EINVAL;
-               mutex_spin_exit(&crypto_q_mtx);
+               return EINVAL;
        }
 
-       return err;
+       if (what & CRYPTO_SYMQ) {
+               needwakeup |= cap->cc_qblocked;
+               cap->cc_qblocked = 0;
+       }
+       if (what & CRYPTO_ASYMQ) {
+               needwakeup |= cap->cc_kqblocked;
+               cap->cc_kqblocked = 0;
+       }
+       if (needwakeup)
+               setsoftcrypto(softintr_cookie);
+       mutex_spin_exit(&crypto_q_mtx);
+
+       return 0;
 }
 
 /*



Home | Main Index | Thread Index | Old Index