[PATCH] crypto: arm64/ghash - Reduce boilerplate

From
Uwe Kleine-König <hidden>
Date
2026-11-09 16:45:11
Also in
linux-crypto
Make use of module_cpu_feature_match() which expands to nearly the code
that is typed out.

Signed-off-by: Uwe Kleine-König <redacted>
---
 arch/arm64/crypto/ghash-ce-glue.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/arch/arm64/crypto/ghash-ce-glue.c b/arch/arm64/crypto/ghash-ce-glue.c
index eaf2932ceaf5..0884f812a315 100644
--- a/arch/arm64/crypto/ghash-ce-glue.c
+++ b/arch/arm64/crypto/ghash-ce-glue.c
@@ -384,7 +384,8 @@ static struct aead_alg gcm_aes_algs[] = {{
 
 static int __init ghash_ce_mod_init(void)
 {
-	if (!cpu_have_named_feature(ASIMD) || !cpu_have_named_feature(PMULL))
+	/* ASIMD is implied by PMULL, but better be safe than sorry */
+	if (!cpu_have_named_feature(ASIMD))
 		return -ENODEV;
 
 	return crypto_register_aeads(gcm_aes_algs, ARRAY_SIZE(gcm_aes_algs));
@@ -395,10 +396,5 @@ static void __exit ghash_ce_mod_exit(void)
 	crypto_unregister_aeads(gcm_aes_algs, ARRAY_SIZE(gcm_aes_algs));
 }
 
-static const struct cpu_feature __maybe_unused ghash_cpu_feature[] = {
-	{ cpu_feature(PMULL) }, { }
-};
-MODULE_DEVICE_TABLE(cpu, ghash_cpu_feature);
-
-module_init(ghash_ce_mod_init);
+module_cpu_feature_match(PMULL, ghash_ce_mod_init);
 module_exit(ghash_ce_mod_exit);
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.56.0.rc1

Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help