* [PATCH] crypto: scompress - call the completion callback for the completed acomp_req
@ 2020-06-20 23:07 Barry Song
2020-06-21 2:07 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Barry Song @ 2020-06-20 23:07 UTC (permalink / raw)
To: herbert, davem; +Cc: linux-crypto, linux-kernel, linuxarm, Barry Song
While using acomp_req, users may customize a completion callback, if the
backend of acomp is actually scomp, this callback will never be called.
This looks a bit messy to users. For one user, all scomp details should
be hidden by acomp APIs.
But it won't cause any real problem if users simply use crypto_req_done()
as the callback, and further use crypto_wait_req() to wait for request to
be done since crypto_wait_req() depends on the callback only if queuing
acomp_req returns -EINPROGRESS or -EBUSY.
This patch will make sure the customized completion callback is called
for the first case. And it won't break the second case in which users
use the common crypto_req_done() and crypto_wait_req() only.
Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
---
crypto/scompress.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/crypto/scompress.c b/crypto/scompress.c
index 738f4f8f0f41..634b7ced9348 100644
--- a/crypto/scompress.c
+++ b/crypto/scompress.c
@@ -158,6 +158,10 @@ static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
}
out:
spin_unlock(&scratch->lock);
+
+ if (req->base.complete)
+ acomp_request_complete(req, ret);
+
return ret;
}
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: scompress - call the completion callback for the completed acomp_req
2020-06-20 23:07 [PATCH] crypto: scompress - call the completion callback for the completed acomp_req Barry Song
@ 2020-06-21 2:07 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2020-06-21 2:07 UTC (permalink / raw)
To: Barry Song; +Cc: davem, linux-crypto, linux-kernel, linuxarm
On Sun, Jun 21, 2020 at 11:07:56AM +1200, Barry Song wrote:
> While using acomp_req, users may customize a completion callback, if the
> backend of acomp is actually scomp, this callback will never be called.
> This looks a bit messy to users. For one user, all scomp details should
> be hidden by acomp APIs.
>
> But it won't cause any real problem if users simply use crypto_req_done()
> as the callback, and further use crypto_wait_req() to wait for request to
> be done since crypto_wait_req() depends on the callback only if queuing
> acomp_req returns -EINPROGRESS or -EBUSY.
>
> This patch will make sure the customized completion callback is called
> for the first case. And it won't break the second case in which users
> use the common crypto_req_done() and crypto_wait_req() only.
>
> Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
> ---
> crypto/scompress.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/crypto/scompress.c b/crypto/scompress.c
> index 738f4f8f0f41..634b7ced9348 100644
> --- a/crypto/scompress.c
> +++ b/crypto/scompress.c
> @@ -158,6 +158,10 @@ static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
> }
> out:
> spin_unlock(&scratch->lock);
> +
> + if (req->base.complete)
> + acomp_request_complete(req, ret);
> +
> return ret;
> }
Nack. This is a deliberate optimisation to allow the sync code
path to execute with no overhead.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-21 2:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-20 23:07 [PATCH] crypto: scompress - call the completion callback for the completed acomp_req Barry Song
2020-06-21 2:07 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).