Index: sys/opencrypto/cryptodev.c =================================================================== --- sys/opencrypto/cryptodev.c +++ sys/opencrypto/cryptodev.c @@ -904,8 +904,6 @@ return (error); } -static int cryptodev_cb(struct cryptop *); - static struct cryptop_data * cod_alloc(struct csession *cse, size_t aad_len, size_t len, struct thread *td) { @@ -935,6 +933,23 @@ free(cod, M_XDATA); } +static int +cryptodev_cb(struct cryptop *crp) +{ + struct cryptop_data *cod = crp->crp_opaque; + + /* + * Lock to ensure the wakeup() is not missed by the loops + * waiting on cod->done in cryptodev_op() and + * cryptodev_aead(). + */ + mtx_lock(&cod->cse->lock); + cod->done = true; + mtx_unlock(&cod->cse->lock); + wakeup(cod); + return (0); +} + static int cryptodev_op(struct csession *cse, const struct crypt_op *cop, struct ucred *active_cred, struct thread *td) @@ -1340,23 +1355,6 @@ return (error); } -static int -cryptodev_cb(struct cryptop *crp) -{ - struct cryptop_data *cod = crp->crp_opaque; - - /* - * Lock to ensure the wakeup() is not missed by the loops - * waiting on cod->done in cryptodev_op() and - * cryptodev_aead(). - */ - mtx_lock(&cod->cse->lock); - cod->done = true; - mtx_unlock(&cod->cse->lock); - wakeup(cod); - return (0); -} - static void cryptodevkey_cb(struct cryptkop *krp) {