[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZdLYE8mx0AJ7a7+t@gondor.apana.org.au>
Date: Mon, 19 Feb 2024 12:24:51 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Barry Song <21cnbao@...il.com>
Cc: akpm@...ux-foundation.org, davem@...emloft.net, hannes@...xchg.org,
linux-crypto@...r.kernel.org, linux-mm@...ck.org, nphamcs@...il.com,
yosryahmed@...gle.com, zhouchengming@...edance.com,
chriscli@...gle.com, chrisl@...nel.org, ddstreet@...e.org,
linux-kernel@...r.kernel.org, sjenning@...hat.com,
vitaly.wool@...sulko.com, Barry Song <v-songbaohua@...o.com>
Subject: Re: [PATCH v3 1/3] crypto: introduce acomp_is_sleepable to expose if
comp drivers might sleep
On Sat, Feb 17, 2024 at 05:51:00PM +1300, Barry Song wrote:
.
> diff --git a/crypto/acompress.c b/crypto/acompress.c
> index 1c682810a484..fa15df394a4c 100644
> --- a/crypto/acompress.c
> +++ b/crypto/acompress.c
> @@ -152,6 +152,14 @@ struct crypto_acomp *crypto_alloc_acomp_node(const char *alg_name, u32 type,
> }
> EXPORT_SYMBOL_GPL(crypto_alloc_acomp_node);
>
> +bool acomp_is_sleepable(struct crypto_acomp *acomp)
> +{
> + struct crypto_tfm *tfm = crypto_acomp_tfm(acomp);
> +
> + return tfm->__crt_alg->cra_type == &crypto_acomp_type;
> +}
> +EXPORT_SYMBOL_GPL(acomp_is_sleepable);
Just because something is of acomp_type it doesn't mean that it's
async. You should be testing the algorithm flags.
So introduce a helper crypto_acomp_get_flags (see the similar
helper crypto_skcipher_get_flags) and test it against CRYPTO_ALG_ASYNC.
Cheers,
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists