[PATCH v10 12/25] crypto: acomp - Add "void *kernel_data" in "struct acomp_req" for kernel users.

From: Kanchana P Sridhar
Date: Fri Jul 04 2025 - 00:25:29 EST


This commit adds a "void *kernel_data" member in "struct acomp_req":

@kernel_data: Private API kernel code data for kernel users

This allows kernel modules such as zswap and zram to input driver data
without interfering with existing usage of acomp_req->base.data.

Since acomp_request_set_params() is the main interface for kernel users
to initialize the acomp_req members, this routine sets
acomp_req->kernel_data to NULL. Kernel users such as zswap will need to
explicitly set acomp_req->kernel_data for interacting with
crypto_acomp_[de]compress(). This usage model will be covered in a
separate patch-series.

Signed-off-by: Kanchana P Sridhar <kanchana.p.sridhar@xxxxxxxxx>
---
include/crypto/acompress.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/include/crypto/acompress.h b/include/crypto/acompress.h
index 9eacb9fa375d7..0312322d2ca03 100644
--- a/include/crypto/acompress.h
+++ b/include/crypto/acompress.h
@@ -79,6 +79,7 @@ struct acomp_req_chain {
* @dvirt: Destination virtual address
* @slen: Size of the input buffer
* @dlen: Size of the output buffer and number of bytes produced
+ * @kernel_data: Private API kernel code data for kernel users
* @chain: Private API code data, do not use
* @__ctx: Start of private context data
*/
@@ -95,6 +96,7 @@ struct acomp_req {
unsigned int slen;
unsigned int dlen;

+ void *kernel_data;
struct acomp_req_chain chain;

void *__ctx[] CRYPTO_MINALIGN_ATTR;
@@ -354,6 +356,7 @@ static inline void acomp_request_set_params(struct acomp_req *req,
req->dst = dst;
req->slen = slen;
req->dlen = dlen;
+ req->kernel_data = NULL;

req->base.flags &= ~(CRYPTO_ACOMP_REQ_SRC_VIRT |
CRYPTO_ACOMP_REQ_SRC_NONDMA |
--
2.27.0