From patchwork Tue Mar 4 09:25:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herbert Xu X-Patchwork-Id: 14000243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B959C282D0 for ; Tue, 4 Mar 2025 09:25:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1FC60280002; Tue, 4 Mar 2025 04:25:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 17E29280001; Tue, 4 Mar 2025 04:25:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F38A3280002; Tue, 4 Mar 2025 04:25:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D5A88280001 for ; Tue, 4 Mar 2025 04:25:13 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 926191A19E8 for ; Tue, 4 Mar 2025 09:25:13 +0000 (UTC) X-FDA: 83183334906.15.CD485FE Received: from abb.hmeau.com (abb.hmeau.com [144.6.53.87]) by imf25.hostedemail.com (Postfix) with ESMTP id 70332A0014 for ; Tue, 4 Mar 2025 09:25:10 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=hmeau.com header.s=formenos header.b=hBMzOb3y; spf=pass (imf25.hostedemail.com: domain of herbert@gondor.apana.org.au designates 144.6.53.87 as permitted sender) smtp.mailfrom=herbert@gondor.apana.org.au; dmarc=pass (policy=quarantine) header.from=apana.org.au ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741080312; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=byKSmpFZ+BAJKsKdkjOGzGyv3O1PUfZflpCvm7z8pKY=; b=hRIC9RGRv7Uap6v4Oi6nwYlFD0ucX46H+NKYi+1GQeTcVRT6xhNmrSj/p7AEy0hFejjZE0 hFMIF0cxZidyD0tI8v/bE6nY8Y4VB1tZZL0pGqXGSExc1Hm5EBxu2+3dWPQh7mG0BVxqBr g4I+grRXwvG3zHoVnHsGntqL6zlwVQU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741080312; a=rsa-sha256; cv=none; b=J0tqhMVBfeQthbAwDmi1eaeqXfOhMtmwfrqkCxn0dzCYvhSjlPOaPUWDcDxCpNxckOQFEz A8zVCWPSmV4chG0xJHdDXkbFxWVJjhGJeX/UIYbt99EKsl/0R4EXLE7HRw7OQxzJcN0yyC uz3OVWGbOJJqrjDgTEXOtKSGREnH398= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=hmeau.com header.s=formenos header.b=hBMzOb3y; spf=pass (imf25.hostedemail.com: domain of herbert@gondor.apana.org.au designates 144.6.53.87 as permitted sender) smtp.mailfrom=herbert@gondor.apana.org.au; dmarc=pass (policy=quarantine) header.from=apana.org.au DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hmeau.com; s=formenos; h=Cc:To:Subject:From:References:In-Reply-To:Message-Id:Date: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=byKSmpFZ+BAJKsKdkjOGzGyv3O1PUfZflpCvm7z8pKY=; b=hBMzOb3yHsbMiRC+hwbLmYMdOk SPLaxeTu5rabFKGX8uDzGpaUAkobwoVW/FNXTC7PEAYkdKUxco8yJcmzKEIHzYfHIeYhUJJsxyMU2 1OglS7+cuLzT0jQ4gxMod1Bqvpr3OaXuybDZ2+lw/+hxmYovkdeTf6mnmFYBlmt88F2OuVJxWHyD3 5J2ZN4pQLUTvqcq5YXVJ1nSw0ZIedXXrVbM+E4BkfHgs5CqG80H2i5fbOAG5twVL+xwO2l0IEKokn 5WNBR2BECvP/8d1t7yGfiYMSyMY+DItrCMjQP1dzILLzf2TNDEqzF8ebo61VRrwtycE7fs40pH1sH r9ZXD2Rg==; Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.96 #2 (Debian)) id 1tpOWQ-003a2V-0P; Tue, 04 Mar 2025 17:25:07 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Tue, 04 Mar 2025 17:25:06 +0800 Date: Tue, 04 Mar 2025 17:25:06 +0800 Message-Id: In-Reply-To: References: From: Herbert Xu Subject: [v2 PATCH 2/7] crypto: scomp - Remove tfm argument from alloc/free_ctx To: Linux Crypto Mailing List Cc: linux-mm@kvack.org, Yosry Ahmed , Kanchana P Sridhar X-Stat-Signature: 1se9smhrnw4t7azt814ak61dsb3kharz X-Rspamd-Queue-Id: 70332A0014 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1741080310-414642 X-HE-Meta: U2FsdGVkX1+cn8UrLK4raix44xPFNmKoQQGzO3zeBzjuUR6D75iMM6HlNp0dArXuYtD60/ljo2mr402+2R1dqIxZBFTUhT2K/GIrPoSmVaZBg/oYMF98xSGuyh6DkWTgrDW88xJnpk20KcL3YwCOqIFaqB29MHQlwHvIQcReBGa5VNzpnf5JXgbOEs9bbgQEbcEiKt39+E7bwfoBBF+73hWKiXiQmbIXJSDr/mnIP1OA59zm2IV2H3OkmgbBNA7K/tGahO3P5mlZ0wxArzOimxaICMOZtebh9cjMVwxxN9tVNctiNDMoqfV3nMWQOHPTdsNEGbYBrL2QrTugWenkC7e2olH5HXJ/0Ri9y7Ovz7WFa5fhydH+aO2z1bA9mC4q2R2t/KF+kiaJyYXdXJqwlbtP+j1ioY2mXGhqOwNSh/W7xMN+vf+6z5k6H0oAjThR6hmfRhRvcsZ4hP5k491p/q7Q3hqKYI/uSDed8c8NI8PGurIUKUZRWULeaK0Q2jR4jLIOwt3gklzEvaIshARk64zL1OHij8XjCYNtq5LEzO9XXM/LOcW8Gd6t9dbvlswYuNQWxc2Z+UG/oP9M1VosGpPhre0csxjgji93k6izQ2Ek6FExcBMLimpWFs2zoKRfzuMKzYJNCJ7jUSjrRTETY91xA1pxrB4m9GyEpbuRJm1zw53QTMtwnrFTco02OZbPQ9HCJqDUa1+xzAcOFA1RlEaiyyvWOqtIH2/LXsWZVIc+DWf20jjFU4f2Zr3ZwS+UcJAC2Ep1dO1khYvQIIJ1PP/VidOgBFl8ADCZhEOOs4VnPhg69UsIR1S33Uho3+fLyzY7MUKKB2tKP2IUWID+Dfxh9NR6u1U0DvFWy2b11qmEb5KpKKIZ6Dz3W9/xsTYj3s0FwZQwN2YDzvQarfnpt0xl33xcM+k2F7pteam8qiaTx8i+QmpinuX9eghSbw+WMSucmXgqv3h1On1Xzdc LDLCyuOb fxo4EH2ldxL1ZCrrveivCWzmxNRm8vUT1E0J6Z2jSsAZMOoLXEbrZ99EagN9kuH+agxhny1PHpPmnMOPjP1Xf62YF2hJotYTLC0DTiwl0E9/iDveBFNt1Kbr8A31tOopy484HE9nDAyoirYLrAV19YHCrrXnUSiO5E5neg3ALjl0Tsykv0xxgMOfHBUKhZ/dgDMiAuOP1iuLQDKARkLiscQCiyeKB7HJ2ezEdfLPfjObwK0rJeDWwP9miKDwtMuZGnW4K6s4kerdVLUw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The tfm argument is completely unused and meaningless as the same stream object is identical over all transforms of a given algorithm. Remove it. Signed-off-by: Herbert Xu --- crypto/842.c | 8 ++++---- crypto/deflate.c | 4 ++-- crypto/lz4.c | 8 ++++---- crypto/lz4hc.c | 8 ++++---- crypto/lzo-rle.c | 8 ++++---- crypto/lzo.c | 8 ++++---- crypto/zstd.c | 4 ++-- drivers/crypto/cavium/zip/zip_crypto.c | 6 +++--- drivers/crypto/cavium/zip/zip_crypto.h | 6 +++--- include/crypto/internal/scompress.h | 8 ++++---- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/crypto/842.c b/crypto/842.c index e59e54d76960..2238478c3493 100644 --- a/crypto/842.c +++ b/crypto/842.c @@ -28,7 +28,7 @@ struct crypto842_ctx { void *wmem; /* working memory for compress */ }; -static void *crypto842_alloc_ctx(struct crypto_scomp *tfm) +static void *crypto842_alloc_ctx(void) { void *ctx; @@ -43,14 +43,14 @@ static int crypto842_init(struct crypto_tfm *tfm) { struct crypto842_ctx *ctx = crypto_tfm_ctx(tfm); - ctx->wmem = crypto842_alloc_ctx(NULL); + ctx->wmem = crypto842_alloc_ctx(); if (IS_ERR(ctx->wmem)) return -ENOMEM; return 0; } -static void crypto842_free_ctx(struct crypto_scomp *tfm, void *ctx) +static void crypto842_free_ctx(void *ctx) { kfree(ctx); } @@ -59,7 +59,7 @@ static void crypto842_exit(struct crypto_tfm *tfm) { struct crypto842_ctx *ctx = crypto_tfm_ctx(tfm); - crypto842_free_ctx(NULL, ctx->wmem); + crypto842_free_ctx(ctx->wmem); } static int crypto842_compress(struct crypto_tfm *tfm, diff --git a/crypto/deflate.c b/crypto/deflate.c index 98e8bcb81a6a..1bf7184ad670 100644 --- a/crypto/deflate.c +++ b/crypto/deflate.c @@ -112,7 +112,7 @@ static int __deflate_init(void *ctx) return ret; } -static void *deflate_alloc_ctx(struct crypto_scomp *tfm) +static void *deflate_alloc_ctx(void) { struct deflate_ctx *ctx; int ret; @@ -143,7 +143,7 @@ static void __deflate_exit(void *ctx) deflate_decomp_exit(ctx); } -static void deflate_free_ctx(struct crypto_scomp *tfm, void *ctx) +static void deflate_free_ctx(void *ctx) { __deflate_exit(ctx); kfree_sensitive(ctx); diff --git a/crypto/lz4.c b/crypto/lz4.c index 0606f8862e78..e66c6d1ba34f 100644 --- a/crypto/lz4.c +++ b/crypto/lz4.c @@ -16,7 +16,7 @@ struct lz4_ctx { void *lz4_comp_mem; }; -static void *lz4_alloc_ctx(struct crypto_scomp *tfm) +static void *lz4_alloc_ctx(void) { void *ctx; @@ -31,14 +31,14 @@ static int lz4_init(struct crypto_tfm *tfm) { struct lz4_ctx *ctx = crypto_tfm_ctx(tfm); - ctx->lz4_comp_mem = lz4_alloc_ctx(NULL); + ctx->lz4_comp_mem = lz4_alloc_ctx(); if (IS_ERR(ctx->lz4_comp_mem)) return -ENOMEM; return 0; } -static void lz4_free_ctx(struct crypto_scomp *tfm, void *ctx) +static void lz4_free_ctx(void *ctx) { vfree(ctx); } @@ -47,7 +47,7 @@ static void lz4_exit(struct crypto_tfm *tfm) { struct lz4_ctx *ctx = crypto_tfm_ctx(tfm); - lz4_free_ctx(NULL, ctx->lz4_comp_mem); + lz4_free_ctx(ctx->lz4_comp_mem); } static int __lz4_compress_crypto(const u8 *src, unsigned int slen, diff --git a/crypto/lz4hc.c b/crypto/lz4hc.c index d7cc94aa2fcf..25a95b65aca5 100644 --- a/crypto/lz4hc.c +++ b/crypto/lz4hc.c @@ -15,7 +15,7 @@ struct lz4hc_ctx { void *lz4hc_comp_mem; }; -static void *lz4hc_alloc_ctx(struct crypto_scomp *tfm) +static void *lz4hc_alloc_ctx(void) { void *ctx; @@ -30,14 +30,14 @@ static int lz4hc_init(struct crypto_tfm *tfm) { struct lz4hc_ctx *ctx = crypto_tfm_ctx(tfm); - ctx->lz4hc_comp_mem = lz4hc_alloc_ctx(NULL); + ctx->lz4hc_comp_mem = lz4hc_alloc_ctx(); if (IS_ERR(ctx->lz4hc_comp_mem)) return -ENOMEM; return 0; } -static void lz4hc_free_ctx(struct crypto_scomp *tfm, void *ctx) +static void lz4hc_free_ctx(void *ctx) { vfree(ctx); } @@ -46,7 +46,7 @@ static void lz4hc_exit(struct crypto_tfm *tfm) { struct lz4hc_ctx *ctx = crypto_tfm_ctx(tfm); - lz4hc_free_ctx(NULL, ctx->lz4hc_comp_mem); + lz4hc_free_ctx(ctx->lz4hc_comp_mem); } static int __lz4hc_compress_crypto(const u8 *src, unsigned int slen, diff --git a/crypto/lzo-rle.c b/crypto/lzo-rle.c index 0631d975bfac..261ef327637a 100644 --- a/crypto/lzo-rle.c +++ b/crypto/lzo-rle.c @@ -15,7 +15,7 @@ struct lzorle_ctx { void *lzorle_comp_mem; }; -static void *lzorle_alloc_ctx(struct crypto_scomp *tfm) +static void *lzorle_alloc_ctx(void) { void *ctx; @@ -30,14 +30,14 @@ static int lzorle_init(struct crypto_tfm *tfm) { struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm); - ctx->lzorle_comp_mem = lzorle_alloc_ctx(NULL); + ctx->lzorle_comp_mem = lzorle_alloc_ctx(); if (IS_ERR(ctx->lzorle_comp_mem)) return -ENOMEM; return 0; } -static void lzorle_free_ctx(struct crypto_scomp *tfm, void *ctx) +static void lzorle_free_ctx(void *ctx) { kvfree(ctx); } @@ -46,7 +46,7 @@ static void lzorle_exit(struct crypto_tfm *tfm) { struct lzorle_ctx *ctx = crypto_tfm_ctx(tfm); - lzorle_free_ctx(NULL, ctx->lzorle_comp_mem); + lzorle_free_ctx(ctx->lzorle_comp_mem); } static int __lzorle_compress(const u8 *src, unsigned int slen, diff --git a/crypto/lzo.c b/crypto/lzo.c index ebda132dd22b..ae40e80a4094 100644 --- a/crypto/lzo.c +++ b/crypto/lzo.c @@ -15,7 +15,7 @@ struct lzo_ctx { void *lzo_comp_mem; }; -static void *lzo_alloc_ctx(struct crypto_scomp *tfm) +static void *lzo_alloc_ctx(void) { void *ctx; @@ -30,14 +30,14 @@ static int lzo_init(struct crypto_tfm *tfm) { struct lzo_ctx *ctx = crypto_tfm_ctx(tfm); - ctx->lzo_comp_mem = lzo_alloc_ctx(NULL); + ctx->lzo_comp_mem = lzo_alloc_ctx(); if (IS_ERR(ctx->lzo_comp_mem)) return -ENOMEM; return 0; } -static void lzo_free_ctx(struct crypto_scomp *tfm, void *ctx) +static void lzo_free_ctx(void *ctx) { kvfree(ctx); } @@ -46,7 +46,7 @@ static void lzo_exit(struct crypto_tfm *tfm) { struct lzo_ctx *ctx = crypto_tfm_ctx(tfm); - lzo_free_ctx(NULL, ctx->lzo_comp_mem); + lzo_free_ctx(ctx->lzo_comp_mem); } static int __lzo_compress(const u8 *src, unsigned int slen, diff --git a/crypto/zstd.c b/crypto/zstd.c index 154a969c83a8..68a093427944 100644 --- a/crypto/zstd.c +++ b/crypto/zstd.c @@ -103,7 +103,7 @@ static int __zstd_init(void *ctx) return ret; } -static void *zstd_alloc_ctx(struct crypto_scomp *tfm) +static void *zstd_alloc_ctx(void) { int ret; struct zstd_ctx *ctx; @@ -134,7 +134,7 @@ static void __zstd_exit(void *ctx) zstd_decomp_exit(ctx); } -static void zstd_free_ctx(struct crypto_scomp *tfm, void *ctx) +static void zstd_free_ctx(void *ctx) { __zstd_exit(ctx); kfree_sensitive(ctx); diff --git a/drivers/crypto/cavium/zip/zip_crypto.c b/drivers/crypto/cavium/zip/zip_crypto.c index 1046a746d36f..a9c3efce8f2d 100644 --- a/drivers/crypto/cavium/zip/zip_crypto.c +++ b/drivers/crypto/cavium/zip/zip_crypto.c @@ -236,7 +236,7 @@ int zip_comp_decompress(struct crypto_tfm *tfm, } /* Legacy compress framework end */ /* SCOMP framework start */ -void *zip_alloc_scomp_ctx_deflate(struct crypto_scomp *tfm) +void *zip_alloc_scomp_ctx_deflate(void) { int ret; struct zip_kernel_ctx *zip_ctx; @@ -255,7 +255,7 @@ void *zip_alloc_scomp_ctx_deflate(struct crypto_scomp *tfm) return zip_ctx; } -void *zip_alloc_scomp_ctx_lzs(struct crypto_scomp *tfm) +void *zip_alloc_scomp_ctx_lzs(void) { int ret; struct zip_kernel_ctx *zip_ctx; @@ -274,7 +274,7 @@ void *zip_alloc_scomp_ctx_lzs(struct crypto_scomp *tfm) return zip_ctx; } -void zip_free_scomp_ctx(struct crypto_scomp *tfm, void *ctx) +void zip_free_scomp_ctx(void *ctx) { struct zip_kernel_ctx *zip_ctx = ctx; diff --git a/drivers/crypto/cavium/zip/zip_crypto.h b/drivers/crypto/cavium/zip/zip_crypto.h index b59ddfcacd34..dbe20bfeb3e9 100644 --- a/drivers/crypto/cavium/zip/zip_crypto.h +++ b/drivers/crypto/cavium/zip/zip_crypto.h @@ -67,9 +67,9 @@ int zip_comp_decompress(struct crypto_tfm *tfm, const u8 *src, unsigned int slen, u8 *dst, unsigned int *dlen); -void *zip_alloc_scomp_ctx_deflate(struct crypto_scomp *tfm); -void *zip_alloc_scomp_ctx_lzs(struct crypto_scomp *tfm); -void zip_free_scomp_ctx(struct crypto_scomp *tfm, void *zip_ctx); +void *zip_alloc_scomp_ctx_deflate(void); +void *zip_alloc_scomp_ctx_lzs(void); +void zip_free_scomp_ctx(void *zip_ctx); int zip_scomp_compress(struct crypto_scomp *tfm, const u8 *src, unsigned int slen, u8 *dst, unsigned int *dlen, void *ctx); diff --git a/include/crypto/internal/scompress.h b/include/crypto/internal/scompress.h index 07a10fd2d321..6ba9974df7d3 100644 --- a/include/crypto/internal/scompress.h +++ b/include/crypto/internal/scompress.h @@ -31,8 +31,8 @@ struct crypto_scomp { * @calg: Cmonn algorithm data structure shared with acomp */ struct scomp_alg { - void *(*alloc_ctx)(struct crypto_scomp *tfm); - void (*free_ctx)(struct crypto_scomp *tfm, void *ctx); + void *(*alloc_ctx)(void); + void (*free_ctx)(void *ctx); int (*compress)(struct crypto_scomp *tfm, const u8 *src, unsigned int slen, u8 *dst, unsigned int *dlen, void *ctx); @@ -73,13 +73,13 @@ static inline struct scomp_alg *crypto_scomp_alg(struct crypto_scomp *tfm) static inline void *crypto_scomp_alloc_ctx(struct crypto_scomp *tfm) { - return crypto_scomp_alg(tfm)->alloc_ctx(tfm); + return crypto_scomp_alg(tfm)->alloc_ctx(); } static inline void crypto_scomp_free_ctx(struct crypto_scomp *tfm, void *ctx) { - return crypto_scomp_alg(tfm)->free_ctx(tfm, ctx); + return crypto_scomp_alg(tfm)->free_ctx(ctx); } static inline int crypto_scomp_compress(struct crypto_scomp *tfm,