From patchwork Thu Oct 26 15:34:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PrasannaKumar Muralidharan X-Patchwork-Id: 10028581 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 5875F6032C for ; Thu, 26 Oct 2017 15:35:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A82028E2F for ; Thu, 26 Oct 2017 15:35:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E0B828E81; Thu, 26 Oct 2017 15:35:38 +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 DFBEF28E2F for ; Thu, 26 Oct 2017 15:35:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932334AbdJZPfg (ORCPT ); Thu, 26 Oct 2017 11:35:36 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:56969 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932255AbdJZPfg (ORCPT ); Thu, 26 Oct 2017 11:35:36 -0400 Received: by mail-pg0-f68.google.com with SMTP id m18so2967617pgd.13 for ; Thu, 26 Oct 2017 08:35:36 -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=IX2axVsHFTCnUEQntASBl/9jsXskGrAovSnIW/iBWQ4=; b=YboC+bd5Y7R2PZRt2auQOKqJcY6hYZRkTQ5vozoIj/Zc5mbtGG47MkiZV2Y4wLsVsH zVOAjYEoL85t1u0BiX2rqtOBrE8p9x8GQ/vSfStJwVAii9QFhw6NruKrUlidxmkLDbJF +TC/+gRY8dLV9SAn1P4kLHYVDyKbg7opGA0lhaVMPd+DVe29Yvi9YA5ukifwgeMjRWKq c+LBrVhCGU8iwVvl+/LGk3HtIpfqH/sysE4nKwFHXD5VokbtrvjuV7aquxE52W1hN5CF 7tz5/0mRCru63qIn7DLwiyG0ul4qJgH6w3b0nrz0mYVuAL6JTV3T58coyTJU2LsDvW2/ 11Qg== 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=IX2axVsHFTCnUEQntASBl/9jsXskGrAovSnIW/iBWQ4=; b=h7WZJF/enupuE0vbtcpu9LvM4jCa1oNCvEu9b/BcX00a2jAGCSWmsz6WVOfRJT8Vn6 4pxoop1l3QPvz/oKIrZxDcqs7rSLLbo1IxiXPR2u+dtCR5yZ85t1R75WGzsNq6EzYx6x UV9ZOcvLCwLcrenl5CUctp6qg4SetaW/GUZxateVgVBVssIsGFxUF+MvEnCCZ5ocEmx1 c2PAGRzHwzpO/nxZtiM6IulMgf0giG34NAI67B/u3cW1+GogyArqcUO4e+MrypDfa3E4 FTA2BFXDV8dWC59aesPzYwyG4bM0o0x5hFxkYmkWwfLg/AT+YDXsIVxYYpj2LKmGoPOk 87RA== X-Gm-Message-State: AMCzsaXuSXGQFpoN3wkTnf1Rq1yP890ZnaX5eHAwnbrXN/jEJe3submV kDMlH1v4yWv0D2Db6fu4HpI= X-Google-Smtp-Source: ABhQp+RMCDNbmP6la1XQpYRGUUZpXBZKwBQAZHp/xlVUz+yYG85Jep3Ci3OfAWa6XNtjqFoQbjdckw== X-Received: by 10.98.242.15 with SMTP id m15mr5810980pfh.176.1509032135822; Thu, 26 Oct 2017 08:35:35 -0700 (PDT) Received: from linux.local ([43.224.131.52]) by smtp.gmail.com with ESMTPSA id n19sm10391618pfj.52.2017.10.26.08.35.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Oct 2017 08:35:35 -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 1/4] hw_random: core: Remove forward declaration by rearranging code Date: Thu, 26 Oct 2017 21:04:24 +0530 Message-Id: <20171026153427.22334-2-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 drop_current_rng such that its forward declaration is not required. Signed-off-by: PrasannaKumar Muralidharan --- drivers/char/hw_random/core.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index 9701ac7..8e1f43c 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c @@ -49,7 +49,6 @@ module_param(default_quality, ushort, 0644); MODULE_PARM_DESC(default_quality, "default entropy content of hwrng per mill"); -static void drop_current_rng(void); static int hwrng_init(struct hwrng *rng); static void start_khwrngd(void); @@ -83,6 +82,17 @@ static inline void cleanup_rng(struct kref *kref) complete(&rng->cleanup_done); } +static void drop_current_rng(void) +{ + BUG_ON(!mutex_is_locked(&rng_mutex)); + if (!current_rng) + return; + + /* decrease last reference for triggering the cleanup */ + kref_put(¤t_rng->ref, cleanup_rng); + current_rng = NULL; +} + static int set_current_rng(struct hwrng *rng) { int err; @@ -99,17 +109,6 @@ static int set_current_rng(struct hwrng *rng) return 0; } -static void drop_current_rng(void) -{ - BUG_ON(!mutex_is_locked(&rng_mutex)); - if (!current_rng) - return; - - /* decrease last reference for triggering the cleanup */ - kref_put(¤t_rng->ref, cleanup_rng); - current_rng = NULL; -} - /* Returns ERR_PTR(), NULL or refcounted hwrng */ static struct hwrng *get_current_rng(void) {