From patchwork Wed Jul 19 07:18:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 13318439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9359AEB64DA for ; Wed, 19 Jul 2023 07:20:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=F7GkO2F59v9kX+SfTjMrP/I1F3pmoJ+AakmgffcnneY=; b=J6tX/TlHNgyFy5 KU80Gm565qiNuH/yG+YGgPg3WgkSi0i6fXl0j1/nx/ga1AiE+QGsWL7gCWMDV5rQXWGXJaVAd2p5D BhGj7U//eIFEFOxFeMNSL97mdBNzYPMStL05S2Ik/YQKi6OAH+wdUflTgTIhFdGuwCeDy6POUnJvO G+9laVBpqPvB6kmUS70YDFCefCLp6p8IAfSmR6Wye+V7dLbZFkN6P7AKKNaPV59RSdjUL7Or07omz UbaLKj4VIT+99vYkLoBh0l7j0g5rgZnmDsKKS3vF/Q5cCVQkJ69e6WqaJFI3q4KiRVU7rJUYze+1N JKbX+TxcA3Af97/DzchQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qM1U5-0064YS-1d; Wed, 19 Jul 2023 07:20:29 +0000 Received: from viti.kaiser.cx ([2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qM1Tr-0064TB-0R for linux-arm-kernel@lists.infradead.org; Wed, 19 Jul 2023 07:20:17 +0000 Received: from ipservice-092-217-093-053.092.217.pools.vodafone-ip.de ([92.217.93.53] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1qM1Tn-0008I7-ES; Wed, 19 Jul 2023 09:20:12 +0200 From: Martin Kaiser To: Herbert Xu Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 3/4] hwrng: cctrng - merge cc_trng_clk_init into its only caller Date: Wed, 19 Jul 2023 09:18:05 +0200 Message-Id: <20230719071806.335718-4-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230719071806.335718-1-martin@kaiser.cx> References: <20230719071806.335718-1-martin@kaiser.cx> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230719_002015_320706_FF19E403 X-CRM114-Status: GOOD ( 12.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org cc_trng_clk_init is called only from the probe function. Merge the two functions, this saves some lines of code. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/cctrng.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/char/hw_random/cctrng.c b/drivers/char/hw_random/cctrng.c index ac4a2fbc6a0f..2a1887f6483f 100644 --- a/drivers/char/hw_random/cctrng.c +++ b/drivers/char/hw_random/cctrng.c @@ -455,21 +455,6 @@ static void cc_trng_startwork_handler(struct work_struct *w) cc_trng_hw_trigger(drvdata); } - -static int cc_trng_clk_init(struct cctrng_drvdata *drvdata) -{ - struct clk *clk; - struct device *dev = &(drvdata->pdev->dev); - - clk = devm_clk_get_optional_enabled(dev, NULL); - if (IS_ERR(clk)) - return dev_err_probe(dev, PTR_ERR(clk), - "Failed to get or enable the clock\n"); - - drvdata->clk = clk; - return 0; -} - static int cctrng_probe(struct platform_device *pdev) { struct cctrng_drvdata *drvdata; @@ -517,11 +502,10 @@ static int cctrng_probe(struct platform_device *pdev) return rc; } - rc = cc_trng_clk_init(drvdata); - if (rc) { - dev_err(dev, "cc_trng_clk_init failed\n"); - return rc; - } + drvdata->clk = devm_clk_get_optional_enabled(dev, NULL); + if (IS_ERR(drvdata->clk)) + return dev_err_probe(dev, PTR_ERR(drvdata->clk), + "Failed to get or enable the clock\n"); INIT_WORK(&drvdata->compwork, cc_trng_compwork_handler); INIT_WORK(&drvdata->startwork, cc_trng_startwork_handler);