From patchwork Wed Jan 11 17:01:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 90955 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1218672qgi; Wed, 11 Jan 2017 09:03:20 -0800 (PST) X-Received: by 10.84.224.134 with SMTP id s6mr7781689plj.49.1484154200804; Wed, 11 Jan 2017 09:03:20 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id u22si6344529plj.70.2017.01.11.09.03.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 09:03:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; 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-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cRMIx-0008QX-J7; Wed, 11 Jan 2017 17:03:19 +0000 Received: from mail-wj0-x22b.google.com ([2a00:1450:400c:c01::22b]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRMIU-0007WG-O8 for linux-arm-kernel@lists.infradead.org; Wed, 11 Jan 2017 17:02:53 +0000 Received: by mail-wj0-x22b.google.com with SMTP id kq3so61426311wjc.0 for ; Wed, 11 Jan 2017 09:02:32 -0800 (PST) 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=Y7eH060fqbbGgaZC3IDJMpesyO21ZbKIy7V04OtmubLj9HWeCCkEV6c0hYl6RRteyv CKllnKgh2sy+Mnc97e/w/o9dCde/GZKhjd8BqmNG7jF/ALOpvzqngDsMmqZvmkfWU6+Q v5ELJJTX8KIDoWIX15rfPQAFqIS7K9CzOqgyY= 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=dEYdgKNeqpLF8/P/l50aWjhc1Hu0Xxg3aUxMIrvYEhRtX2WXKrz3/1nspxFaKBV4Ed A3tXA6UrHESafD7N9x9YsEfxDFhW27CTygJF9j8tKsRG+I6q53420b3vlzN+PPbVfjgB sf8qriiojpF/GzHfrM5JdcCtpIqcPZjOkn5LRnhOhL0C5JE1r9zy1GPNeCZEFvMV1bcC BUuQEq0S04Jnjv/AGZMvRlCwuXQV8cfyEZbi4YVzXPP784zH88qOHOXsIC26h4cNXouU QzkNWITize+sdJNAFHKmJQeq697b9I4r4YryDE5Of3cWk3xBc8Xy/YPjwDpnfVrIE2hm PMeQ== X-Gm-Message-State: AIkVDXLK0jeWxgfY0rWWCwT7BL2RxKhulTkG/PTxqpOQbhQ9sQjdRBoUYQOxZXyoVGPUwQkp X-Received: by 10.194.84.70 with SMTP id w6mr5815161wjy.134.1484154151053; Wed, 11 Jan 2017 09:02:31 -0800 (PST) Received: from localhost.localdomain ([160.167.203.25]) by smtp.gmail.com with ESMTPSA id o132sm9873491wmo.17.2017.01.11.09.02.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Jan 2017 09:02:30 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 4/5] crypto: arm/sha1-ce - enable module autoloading based on CPU feature bits Date: Wed, 11 Jan 2017 17:01:57 +0000 Message-Id: <1484154118-22139-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1484154118-22139-1-git-send-email-ard.biesheuvel@linaro.org> References: <1484154118-22139-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170111_090251_002070_0622A488 X-CRM114-Status: GOOD ( 13.47 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c01:0:0:0:22b listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux@armlinux.org.uk, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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);