diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2017-05-21 10:23:38 +0000 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-06-01 12:55:40 +0800 |
commit | bd56f95ea933d1dd1628373a8213716225605d1c (patch) | |
tree | f12fd822b50a062c69bfe6bbd3c2cc8a4bfb5f90 | |
parent | c9d9f608b4339435ccec6bd2ec1a5c42e066788e (diff) | |
download | linux-stable-bd56f95ea933d1dd1628373a8213716225605d1c.tar.gz linux-stable-bd56f95ea933d1dd1628373a8213716225605d1c.tar.bz2 linux-stable-bd56f95ea933d1dd1628373a8213716225605d1c.zip |
crypto: arm/sha1-ce - enable module autoloading based on CPU feature bits
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>
-rw-r--r-- | arch/arm/crypto/sha1-ce-glue.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/arm/crypto/sha1-ce-glue.c b/arch/arm/crypto/sha1-ce-glue.c index 80bc2fcd241a..555f72b5e659 100644 --- a/arch/arm/crypto/sha1-ce-glue.c +++ b/arch/arm/crypto/sha1-ce-glue.c @@ -11,6 +11,7 @@ #include <crypto/internal/hash.h> #include <crypto/sha.h> #include <crypto/sha1_base.h> +#include <linux/cpufeature.h> #include <linux/crypto.h> #include <linux/module.h> @@ -82,8 +83,6 @@ static struct shash_alg alg = { static int __init sha1_ce_mod_init(void) { - if (!(elf_hwcap2 & HWCAP2_SHA1)) - return -ENODEV; return crypto_register_shash(&alg); } @@ -92,5 +91,5 @@ static void __exit sha1_ce_mod_fini(void) crypto_unregister_shash(&alg); } -module_init(sha1_ce_mod_init); +module_cpu_feature_match(SHA1, sha1_ce_mod_init); module_exit(sha1_ce_mod_fini); |