git: 7945b99a003f - stable/14 - armv8_crypto: Remove dieing flag and rw lock

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 29 Dec 2023 23:08:57 UTC
The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=7945b99a003fec545140532662412696e93f1ae1

commit 7945b99a003fec545140532662412696e93f1ae1
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-08-28 23:23:43 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-12-29 21:49:42 +0000

    armv8_crypto: Remove dieing flag and rw lock
    
    crypto_unregister_all already disables new sessions and waits for
    existing sessions to be destroyed before returning.
    
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D41579
    
    (cherry picked from commit fdd51760c278302773edbd2466d35b35b865f5d9)
---
 sys/crypto/armv8/armv8_crypto.c | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/sys/crypto/armv8/armv8_crypto.c b/sys/crypto/armv8/armv8_crypto.c
index a8d88c31edc0..fd1d845c29b0 100644
--- a/sys/crypto/armv8/armv8_crypto.c
+++ b/sys/crypto/armv8/armv8_crypto.c
@@ -44,12 +44,10 @@
 #include <sys/kernel.h>
 #include <sys/bus.h>
 #include <sys/endian.h>
-#include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/module.h>
 #include <sys/queue.h>
-#include <sys/rwlock.h>
 #include <sys/smp.h>
 #include <sys/uio.h>
 
@@ -62,9 +60,7 @@
 #include <crypto/rijndael/rijndael.h>
 
 struct armv8_crypto_softc {
-	int		dieing;
 	int32_t		cid;
-	struct rwlock	lock;
 	bool		has_pmul;
 };
 
@@ -119,7 +115,6 @@ armv8_crypto_attach(device_t dev)
 	uint64_t reg;
 
 	sc = device_get_softc(dev);
-	sc->dieing = 0;
 
 	reg = READ_SPECIALREG(id_aa64isar0_el1);
 
@@ -133,8 +128,6 @@ armv8_crypto_attach(device_t dev)
 		return (ENOMEM);
 	}
 
-	rw_init(&sc->lock, "armv8crypto");
-
 	return (0);
 }
 
@@ -145,13 +138,8 @@ armv8_crypto_detach(device_t dev)
 
 	sc = device_get_softc(dev);
 
-	rw_wlock(&sc->lock);
-	sc->dieing = 1;
-	rw_wunlock(&sc->lock);
 	crypto_unregister_all(sc->cid);
 
-	rw_destroy(&sc->lock);
-
 	return (0);
 }
 
@@ -273,21 +261,12 @@ static int
 armv8_crypto_newsession(device_t dev, crypto_session_t cses,
     const struct crypto_session_params *csp)
 {
-	struct armv8_crypto_softc *sc;
 	struct armv8_crypto_session *ses;
 	int error;
 
-	sc = device_get_softc(dev);
-	rw_wlock(&sc->lock);
-	if (sc->dieing) {
-		rw_wunlock(&sc->lock);
-		return (EINVAL);
-	}
-
 	ses = crypto_get_driver_session(cses);
 	error = armv8_crypto_cipher_setup(ses, csp, csp->csp_cipher_key,
 	    csp->csp_cipher_klen);
-	rw_wunlock(&sc->lock);
 	return (error);
 }