From patchwork Tue Oct 18 10:52:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 77979 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp819219qge; Tue, 18 Oct 2016 03:52:42 -0700 (PDT) X-Received: by 10.98.216.194 with SMTP id e185mr3825862pfg.148.1476787961990; Tue, 18 Oct 2016 03:52:41 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hr5si29379611pac.174.2016.10.18.03.52.41; Tue, 18 Oct 2016 03:52:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753995AbcJRKwl (ORCPT + 1 other); Tue, 18 Oct 2016 06:52:41 -0400 Received: from mail-qt0-f182.google.com ([209.85.216.182]:35844 "EHLO mail-qt0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753905AbcJRKwk (ORCPT ); Tue, 18 Oct 2016 06:52:40 -0400 Received: by mail-qt0-f182.google.com with SMTP id m5so146933377qtb.3 for ; Tue, 18 Oct 2016 03:52:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lJQzJQRkC1WqnKvLlCFhgaGpa51TTvChym+4fqf4y84=; b=YdRLP1L3Zs0hHTOGkToX2ybH2Gk1IH+Yi8KVjPkwxd8/qZOHJ78kt5kaHKtklJxlig moMvnLfx7jO/+QKMQTO8u6Zsp+SNaRXBDbuOSS2B4vpfLk3sDDM/oLZ7cF+6nKmSfAId +B307o2Q+GDf6dO03gp4mgqa/SZUdb0dVmF3Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lJQzJQRkC1WqnKvLlCFhgaGpa51TTvChym+4fqf4y84=; b=kTDh7hT5WI67cKaQuqhnxaOvhpZx6e7CWp5b7iJUCzWiRduFrKIVLSHwRk8XG1l133 gYfOMFm3sBe00lBmZTp2e9kHI8NJb/YGnNhFVaNerKaIAEfbNXxJs+OyvrSPgrZ/qf3l dfd1m1m4WNzkRkx06/jFA7EoSjBOmDW4X8k7W8mMQS+mUk2sm0diTua+ZjGfAXqYvZLJ BNNYCsMYNMEL9h1RDZ5IFsvSH/LSkkwu3QnLrNN1Jbvj6+omW3o7qXXi8iPxJKC6+NoG PG1X0iLKMjuB0CY3FCATOFVyVvVEPFlFyGarRbWGM6Pkar9ryg14F8WJQWdjBaqwEfHw u64g== X-Gm-Message-State: AA6/9RmgK6UjJ1lZnL14VaAoKc3UAy+AORw05fvPh2LL880++tEb2mr+IqdfEEsWrxCma/KO X-Received: by 10.28.180.70 with SMTP id d67mr11938226wmf.115.1476787959310; Tue, 18 Oct 2016 03:52:39 -0700 (PDT) Received: from localhost.localdomain ([105.137.38.75]) by smtp.gmail.com with ESMTPSA id za1sm57784083wjb.8.2016.10.18.03.52.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Oct 2016 03:52:38 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux@arm.linux.org.uk, herbert@gondor.apana.org.au Cc: steve.capper@linaro.org, Ard Biesheuvel Subject: [PATCH 5/5] crypto: arm/sha2-ce - enable module autoloading based on CPU feature bits Date: Tue, 18 Oct 2016 11:52:19 +0100 Message-Id: <1476787939-21889-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476787939-21889-1-git-send-email-ard.biesheuvel@linaro.org> References: <1476787939-21889-1-git-send-email-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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 --- arch/arm/crypto/sha2-ce-glue.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/crypto/sha2-ce-glue.c b/arch/arm/crypto/sha2-ce-glue.c index 0755b2d657f3..df4dcef054ae 100644 --- a/arch/arm/crypto/sha2-ce-glue.c +++ b/arch/arm/crypto/sha2-ce-glue.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -100,8 +101,6 @@ static struct shash_alg algs[] = { { static int __init sha2_ce_mod_init(void) { - if (!(elf_hwcap2 & HWCAP2_SHA2)) - return -ENODEV; return crypto_register_shashes(algs, ARRAY_SIZE(algs)); } @@ -110,5 +109,5 @@ static void __exit sha2_ce_mod_fini(void) crypto_unregister_shashes(algs, ARRAY_SIZE(algs)); } -module_init(sha2_ce_mod_init); +module_cpu_feature_match(SHA2, sha2_ce_mod_init); module_exit(sha2_ce_mod_fini);