]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
crypto: arm/ghash-ce - enable module autoloading based on CPU feature bits
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Sun, 21 May 2017 10:23:37 +0000 (10:23 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 1 Jun 2017 04:55:39 +0000 (12:55 +0800)
Make the module autoloadable by tying it to the CPU feature bit that
describes whether the optional instructions it relies on are implemented
by the current CPU.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/arm/crypto/ghash-ce-glue.c

index 7546b3c024665ed0e1bf0ce3b94f99cff306189f..6bac8bea9f1e8e95a9ca80892bcdf03b02b8f48b 100644 (file)
@@ -15,6 +15,7 @@
 #include <crypto/cryptd.h>
 #include <crypto/internal/hash.h>
 #include <crypto/gf128mul.h>
+#include <linux/cpufeature.h>
 #include <linux/crypto.h>
 #include <linux/module.h>
 
@@ -311,9 +312,6 @@ static int __init ghash_ce_mod_init(void)
 {
        int err;
 
-       if (!(elf_hwcap2 & HWCAP2_PMULL))
-               return -ENODEV;
-
        err = crypto_register_shash(&ghash_alg);
        if (err)
                return err;
@@ -334,5 +332,5 @@ static void __exit ghash_ce_mod_exit(void)
        crypto_unregister_shash(&ghash_alg);
 }
 
-module_init(ghash_ce_mod_init);
+module_cpu_feature_match(PMULL, ghash_ce_mod_init);
 module_exit(ghash_ce_mod_exit);