From patchwork Thu Oct 26 15:34:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PrasannaKumar Muralidharan X-Patchwork-Id: 10028587 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 20FCA6032C for ; Thu, 26 Oct 2017 15:35:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1219428E27 for ; Thu, 26 Oct 2017 15:35:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0576028E37; Thu, 26 Oct 2017 15:35:48 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 A97F028E27 for ; Thu, 26 Oct 2017 15:35:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932275AbdJZPfr (ORCPT ); Thu, 26 Oct 2017 11:35:47 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:55680 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932255AbdJZPfq (ORCPT ); Thu, 26 Oct 2017 11:35:46 -0400 Received: by mail-pf0-f193.google.com with SMTP id 17so2759324pfn.12 for ; Thu, 26 Oct 2017 08:35:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rdcYF5kPH27KHomH5RvLDNiSWlNVS0s3Oj4BLeHGjxI=; b=qPz82az75uSeYe9brPb8ARy+TGwFGEIRuBmy9O+JXFsxPT2WFPF3Q17sroJjObaf1U oU4kpxggzRTcDa0Hx0mZN1rgREG4AmPBA43LsK9LfJmoMMcgiQN6R6llXS2pSm+tLDxS ml94p2mU+ZAznsZgEK1uPzeZym8FggjdigEpzFjbpf5n6LUlVJk7iA3wzjZ7qYN1O6g0 fhNGi99BaX4+fROGFgF93c0LwAbiMtHfLVSALYX2qsPQ7WJEG3/gcTCZ5mEi9KpHThUs oluvE1Edvbu+iaYcg4dOMfEPoJwfapL4zoe9gL/EN6z4oPb4F3pCVIeFrfoB7V1Wf2dZ y59g== 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=rdcYF5kPH27KHomH5RvLDNiSWlNVS0s3Oj4BLeHGjxI=; b=Fbhmkj2fx9Y2sSUEvLvKwJu/TYgsa6oUBe2mDqtUZOQhxFND1Y0TYlOJSYNt2BvHF9 5lETHAIRQVhaCP2DDCQCJsPhYoJ+jobLf+qcRzflvwmrNK9vMP1hhrzHMTPPlcrunmxg PvlDv9n/GcJlmOLfjtva4LB9Jvjfyclt0Z+MtEOYiqxRYG7k5Qo+nr718MqqF4374TQ6 TB6doK62t34vgv3XGMiODsZqIx6YTNF6p5BVjXlUdVXwPJOTix1iZVS7oY2kmunINZlW 1cIlptz7xtu07oqJ6IDhukd4HqW1h0DoNAC3EObdePh51dpFGrxtUeS9tIc/XF4oxwpm hsaQ== X-Gm-Message-State: AMCzsaXR9/w8p26L4D4DIyHP3+xHF6WsQ5CrB6D0X70fEfzcW/XKXgkq Pa+D2uUF408kpMV9zB2Jjjw= X-Google-Smtp-Source: ABhQp+TUoa8qYQq7BVXQWRVAx0Xp+LI+DTqj+JQ2WAj69HDBEUpNvisdKFEAtbv9TJPgB3Zfo+8x6w== X-Received: by 10.98.223.72 with SMTP id u69mr5957524pfg.305.1509032145867; Thu, 26 Oct 2017 08:35:45 -0700 (PDT) Received: from linux.local ([43.224.131.52]) by smtp.gmail.com with ESMTPSA id n19sm10391618pfj.52.2017.10.26.08.35.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Oct 2017 08:35:45 -0700 (PDT) From: PrasannaKumar Muralidharan To: herbert@gondor.apana.org.au, freude@linux.vnet.ibm.com, david.daney@cavium.com, clabbe.montjoie@gmail.com, linux-crypto@vger.kernel.org, mpm@selenic.com Cc: PrasannaKumar Muralidharan Subject: [PATCH 4/4] hw_random: core: Remove forward declaration of hwrng_init Date: Thu, 26 Oct 2017 21:04:27 +0530 Message-Id: <20171026153427.22334-5-prasannatsmkumar@gmail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20171026153427.22334-1-prasannatsmkumar@gmail.com> References: <20171026153427.22334-1-prasannatsmkumar@gmail.com> 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 Rearrange set_current_rng such that hwrng_init's forward declaration can be removed. Signed-off-by: PrasannaKumar Muralidharan --- drivers/char/hw_random/core.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 534c2ae..328d065 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c @@ -49,8 +49,6 @@ module_param(default_quality, ushort, 0644); MODULE_PARM_DESC(default_quality, "default entropy content of hwrng per mill"); -static int hwrng_init(struct hwrng *rng); - static size_t rng_buffer_size(void) { return SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES; @@ -108,22 +106,6 @@ static void drop_current_rng(void) current_rng = NULL; } -static int set_current_rng(struct hwrng *rng) -{ - int err; - - BUG_ON(!mutex_is_locked(&rng_mutex)); - - err = hwrng_init(rng); - if (err) - return err; - - drop_current_rng(); - current_rng = rng; - - return 0; -} - /* Returns ERR_PTR(), NULL or refcounted hwrng */ static struct hwrng *get_current_rng(void) { @@ -220,6 +202,22 @@ static int hwrng_init(struct hwrng *rng) return 0; } +static int set_current_rng(struct hwrng *rng) +{ + int err; + + BUG_ON(!mutex_is_locked(&rng_mutex)); + + err = hwrng_init(rng); + if (err) + return err; + + drop_current_rng(); + current_rng = rng; + + return 0; +} + static int rng_dev_open(struct inode *inode, struct file *filp) { /* enforce read-only access to this chrdev */