From patchwork Sun May 21 10:23:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9738939 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B653860326 for ; Sun, 21 May 2017 10:23:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9EF928607 for ; Sun, 21 May 2017 10:23:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9ED3C28622; Sun, 21 May 2017 10:23:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E1DF28607 for ; Sun, 21 May 2017 10:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752646AbdEUKXz (ORCPT ); Sun, 21 May 2017 06:23:55 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:38890 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752678AbdEUKXy (ORCPT ); Sun, 21 May 2017 06:23:54 -0400 Received: by mail-wm0-f47.google.com with SMTP id e127so2373716wmg.1 for ; Sun, 21 May 2017 03:23:53 -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=SxRj0o76L7GGUSHBu/irUbJkK3OVlRNPIq0XQEcKoPG1QWQtB+3XZ0h3k8LBwluC4g O4obIkW3VhoXSML2yNMDELv3aN5z1fmkTlvNYRo2z8udnkefMHYFUm/WpTbREKsmh/ip UBtd5RGsSugTKWmFI3+j7XAd3ySdpfuLu2QF8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tIhXXZitwFbq0MPGAZ6/t9pj8i+vDL+dWwBhTKwu+p8=; b=RzsoIPQpROSLnR7BxoMg3dh1vP/8xQIBaYYfR0vWj51t4umDLaPmqca25CnsVRto3U 3jIzodho/bCQ8jarFT07C0i/SW5AR+OCYp0zVQXvABhe/EvXUzF2gRnMISQiscMv4Br/ blbpCGQC3YB+0lvM67NYfiVBFxIjqOOu00gPQH9zrwC9hgRHuqZq3QyW6XxLzOzS5UyM C5FU7kZJ0bS0p8omHcRUDQXbNjDlvvHnDKLnBeIl2yU04fipbhAlxPzdv4onNRVnUAcU cINAx4pxqi/i4JxOS1N1EQkTmiwMYvddPbW84PiX6yiTOvinp2vxfr0jXe1lZue+ZIaB LNwg== X-Gm-Message-State: AODbwcBs83wx5JXLKcQSN/IddhRV52om3BiF1R6+nJ7KCjhxPRHrzpm1 Rg91tpHU9BNqinTO X-Received: by 10.223.135.216 with SMTP id c24mr8071946wrc.109.1495362232646; Sun, 21 May 2017 03:23:52 -0700 (PDT) Received: from localhost.localdomain ([105.129.238.81]) by smtp.gmail.com with ESMTPSA id y60sm13381366wrb.39.2017.05.21.03.23.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 21 May 2017 03:23:51 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: [PATCH 3/5] crypto: arm/sha1-ce - enable module autoloading based on CPU feature bits Date: Sun, 21 May 2017 10:23:38 +0000 Message-Id: <1495362220-30044-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495362220-30044-1-git-send-email-ard.biesheuvel@linaro.org> References: <1495362220-30044-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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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);