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: 122431 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2258945vqt; Wed, 19 Jul 2023 00:24:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlFs/nuGqOK66l/6tOgSqPmntAEMRod+nSz3uhCCHWhm9WomUnSruMQlC8NcSuuXx7i34MxJ X-Received: by 2002:aa7:d70d:0:b0:51d:a263:ef0a with SMTP id t13-20020aa7d70d000000b0051da263ef0amr1703024edq.24.1689751483659; Wed, 19 Jul 2023 00:24:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689751483; cv=none; d=google.com; s=arc-20160816; b=gmhYZKd2oVLTDZv6uFzOvLlcr1D7nHvM/fu7SEEPWHYtRI+rrt3O0ieL0BXXpoloHa PKJ9FJqtOtOgo7EPy7SO+5yUeMSPBgPUgjAnH7oBoxeb9esB81q+2Uufr5/1+76vCJMJ woiGXq1+lgeUiIB+b4Dzkf5Ct5KyLvIPUrZAicvNGhb1LIO3VKxnAgXq4X6hf8sKQkf/ d9LvOWpTHsKQanjsdig61EVATLU9tDQ2w+nCWYAT33MFYkvgCC2xNPgDt9EHIDZZfj+8 iVnM/Nld59U1RKwJ4IaqeMVpIjE+RA+pNkGymieAntnboakueylbDX4nhr7LFHTXiV8j uzsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lfG4+TxiryFG0wpNx3IP2X2iIpwspiCznvK16ZPGgyE=; fh=dVfXhkbP60ZT4KVr26y6imwTSq8xUCJNaPCgpFL70HA=; b=gSaK3sWr6HqKHBaPhh3E4WTMK9A0cqEOOfV3W+p2l+aH02ib4M6IQXBtgCthPll8Q6 f/+cLKT9JeJyDH09kEgkyAo38rbgNc5z1qF6a295TJN11pHntKbAbNIgezATycgPW96V kWtIuOKEdlQhbJhKUAMdVEK5M5uYom9HiDbI1+BymVUgt6Kup4IAXPeQ8xEvLyR+YRJN hbMrQBgI6qnbjgzijgCO0RhzGT1/+BNWditLWyxcrH9JqO7H96TxMmQiDJRQesFNy4TM aZrw42SlldV70VS1cyjfrlvZTXK13RWMIaAZ7SqQ9kJIMbA89vI37Ytbppb9cOjBP6mW q0cA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bf22-20020a0564021a5600b0051bf8f889dbsi2692496edb.448.2023.07.19.00.24.20; Wed, 19 Jul 2023 00:24:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229938AbjGSHUW (ORCPT + 99 others); Wed, 19 Jul 2023 03:20:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbjGSHUO (ORCPT ); Wed, 19 Jul 2023 03:20:14 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3BC9E43; Wed, 19 Jul 2023 00:20:13 -0700 (PDT) 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771832851805235742 X-GMAIL-MSGID: 1771832851805235742 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);