From patchwork Tue Oct 18 10:52:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 77978 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp819206qge; Tue, 18 Oct 2016 03:52:40 -0700 (PDT) X-Received: by 10.36.178.87 with SMTP id h23mr286991iti.96.1476787960187; Tue, 18 Oct 2016 03:52:40 -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.39; Tue, 18 Oct 2016 03:52:40 -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 S1752803AbcJRKwj (ORCPT + 1 other); Tue, 18 Oct 2016 06:52:39 -0400 Received: from mail-qt0-f177.google.com ([209.85.216.177]:34556 "EHLO mail-qt0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753905AbcJRKwi (ORCPT ); Tue, 18 Oct 2016 06:52:38 -0400 Received: by mail-qt0-f177.google.com with SMTP id q7so150249529qtq.1 for ; Tue, 18 Oct 2016 03:52:38 -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=tIhXXZitwFbq0MPGAZ6/t9pj8i+vDL+dWwBhTKwu+p8=; b=gLj2NfcXKnqU/04FuWJsfKTKK8dV/XohoxpsCQ1mmwd0tCpvltOi3gBJ2vJvjZu7Rw v3q+JMQOVDd/qcWu31ueVibRL6igXbvmyhtdqBp+7aRgq9Tp4BuvCNi9vpan+hZJJeXK +YVO1v7gMJCV5oEdpijJSPbmnZEQ/VkFUZEmE= 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=tIhXXZitwFbq0MPGAZ6/t9pj8i+vDL+dWwBhTKwu+p8=; b=fwnfE0xG6qk3Z6Ghkfdr6dQx//cD+8lqcDZEte1lrsi7A9fFiwW0cdPP/D+5msYIEy Cs1oMWmMLDSqpjoMy0X9fo74aBdzp05f9KFfVl0nWiq8g65V17ai8MGcXgI55zLDLGXU kKQRAg0vHGvXNTBv/HGeTx+zpbbfNXQKDr53QaxKQTqKp78KvxG11nhbT1+SecNW/F9l dB7RsRImf50vyj10Jt+a4/xa22c5xUGPaF6/Y7Z1gT/9lHoWjDgpZegGRuRiG8uXaYaD nFN5M/1/LV3zGnLY4pBTnL5wksVW2KzLQK5SKPORKPsvb0aTrTGUhRDbcTMJNFh1kknL A3eA== X-Gm-Message-State: AA6/9RmNn3Y/di31sVxEv2J9iXrGh2p6T543luI7H1gl9ogr852b7bGIchhiFiSp45nrMalt X-Received: by 10.28.174.209 with SMTP id x200mr243150wme.55.1476787957528; Tue, 18 Oct 2016 03:52:37 -0700 (PDT) Received: from localhost.localdomain ([105.137.38.75]) by smtp.gmail.com with ESMTPSA id za1sm57784083wjb.8.2016.10.18.03.52.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Oct 2016 03:52:36 -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 4/5] crypto: arm/sha1-ce - enable module autoloading based on CPU feature bits Date: Tue, 18 Oct 2016 11:52:18 +0100 Message-Id: <1476787939-21889-5-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/sha1-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/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 #include #include +#include #include #include @@ -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);