From patchwork Tue Aug 27 02:39:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13778730 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 AF1FBC5321D for ; Tue, 27 Aug 2024 02:25:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding: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:In-Reply-To:References:List-Owner; bh=IoYgvq7W1xDKi4aaeUelRLoWcgyRwc8HRgFCfcQvVy0=; b=J96V0P5IOn9gUk4rLClRO3fVgZ wJbgcjxrE+PvmyDdFUQ/vMT9GyBMLJR5qpDsCYSSiYb+rWMoS4gpjkhX34wmjmkayIjr4Vd+CFgEz R8x31mGatWz3ugm4W0U41kwu+PIysgwvaK62dntLBm9EPpVRKmP6YK2dvB/8HW4GxC62RqqRQtqVg iB8RxwXzbrxacJq1LyGHGVa56i5dPPZSUSHfTTBYvgALfaAtchwJNHzY6p1xfVdS6ow/WP3dmQKig 4HpIGM88M733ONQuy3yfmp1QLA/pQrysg4JFuwOUbWzIrYjNWG9TYM5cH0RMCm0fj+me8zrwrY5l0 alHMdWLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siltf-00000009Rnr-1nb2; Tue, 27 Aug 2024 02:25:27 +0000 Received: from mail-sgaapc01on2062c.outbound.protection.outlook.com ([2a01:111:f400:feab::62c] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1silsj-00000009Rbe-06qu for linux-arm-kernel@lists.infradead.org; Tue, 27 Aug 2024 02:24:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=efRLa1C7Fd/WWqIsnT4rxBnnxK1W3dGpmnhqascIdpVDANU+CoG/AZ3yua1dhRCNXXSPxTrtvmCCt649vJNt414Zqs4p9Id4RUygihq12nBRuml4cRo3a21pFpbRjhF7saDl3vf70ScjHpL0YPw/RtWHZznG3DmmQEhnAzckIGiwQvWBGp2nenavd9IIbu1wJuS5/S9yatmx2dLr+r6yuMvI5P36adPDA8SGGzBO89fzuX+6ACCTBrJikEneVi8siawN1oRePg/rwuAfc5wl/oDtsfu/t6RBTSBSe83X34PZN8LWnY7lZdy3QCJSWa+7AGlHJ3uN7YF9SKCvFLt2NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IoYgvq7W1xDKi4aaeUelRLoWcgyRwc8HRgFCfcQvVy0=; b=Bo9+JjFttK5n7LgeOVIaqDCY5zeHBbL5NS8TF2g/leqOZk01jUfZyywFVkKuxVg//Qz73sT5G30nk+Ngl0/7SXSIVJSYiJOYSqR5vo+9Igmybxiq53KOXLWmibStTL9lh970fAdDbMDWhXFUU+mjjfkOSJL7bQqi8tu3Y/erDefP2VBuQ7z7nw7oorXiD3L8t+hPq0IZWcwFO1+eLgxmeHXSXcmklA3z7umJK+I+lwmul2DrIsrXFzSL+WnQ5ZpZKJ2iYDBwS6A7PXiUBawn9YTsx02e9MPQITDaYsRdw6fYQjFe7W5pp1X7NXhkMeZ12xtX6GoGMwedWa1gRjapFA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IoYgvq7W1xDKi4aaeUelRLoWcgyRwc8HRgFCfcQvVy0=; b=lkp2pY6/IyQXx/PhL8o6kG14li/6mem48Bh2oYqvU13xjnasuynNgRtpoOkhAKqCkLdBIBf01bOprNecqKIMP1LoE37JkkP/CIK2LN2t7g+rXrx9WHklwbmyjFXP8h6bJQVfT1YAzph4ng4D8NE8rt5bODQ+K7Dt3U4YDDFnd/jdvUYvRdeEx5nNzCi5GDJpfhyqRuz0naM8TnUcM50cDyXQ0SSQPgYHbyyR2rNFRpvOBFCBsfEt1egFjff3+UVZP6i9CGWn1HCQ75RbGVlemKEFHDz8GSLVvlIxXDZPErcB/1RgEFKCXifNrGXAxhNg/cWWc9GfbOFw7wiPQcxW+w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by TYZPR06MB6637.apcprd06.prod.outlook.com (2603:1096:400:451::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Tue, 27 Aug 2024 02:24:11 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%6]) with mapi id 15.20.7875.019; Tue, 27 Aug 2024 02:24:10 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Thomas Petazzoni , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Wu Bo , Wu Bo Subject: [PATCH v3] PCI: armada8k: change to use devm_clk_get_enabled() helper Date: Mon, 26 Aug 2024 20:39:14 -0600 Message-Id: <20240827023914.2255103-1-bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SI2PR01CA0037.apcprd01.prod.exchangelabs.com (2603:1096:4:193::9) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|TYZPR06MB6637:EE_ X-MS-Office365-Filtering-Correlation-Id: bad9f83f-8976-4b06-b3a2-08dcc63f55cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: he+OpbQxiZCStnGCjTLvsNfbhHR64n0iKrPnDHTw4NK+L58/J9fTxkVTH5Z9K9QZ8I5NsfFuO4LQQIAoaJvJe/NK2ryBsvPNq6x+/vL8llPkHmmTqe60sMTQhqf/UaLE6WQxHsmp/QecYQ4wP26Hy3iUedP2Qn9PUn3+lip6DNZGyg84yN7ANn35EUecMAycoFkNOc+mVU3gmfZbZiNZrmePTatTQW2FbdUX/B1etHuALGZ2EjiAxH/F3JqsL/QJ57+kacC1eLeebMQ6NaCsp6tXz8RGFHsiE0uFFF5n+KNF5nAd6DxT4mSlljfLOVLpZ5HTPx9ufVJyUef59eVuZOhj78xguv0upstSNWjuO+B55KVruxDkJymWKkHB2zfRSNW1Rfbxsr8JYRJclzKK3zwJccMOX1cHqOQQdzSlZdCO4wi3A6td55dTKOw98TEAkW4YDiLpicBJuLUrBkvMRV6QYlWg0AIw1TZMGX6CwY4lde+3bhMH9M1VCYVcEyyLlcTkfEIoheU5wXWR9vGXWVfC8hYJd/hmslFVGaluNpROPE3aNuxaGXp3kQIAE5xpdrepScNP+pYfXZqmwckmJcRktnfcycOPfuABaaX3DHhbOA2bM6hWi8mkWxjlBTW6NTKECI5jP+9krNIzkRlV7+5tAVU2D+3c2SENsyv4Vz3mgopC5U4RsAxXNZBJrwRZMISP53/k73dPsrlOlNZE1xaECV0xMo6iddFzOI/LbZIrhKr397TnI4+qP3bpFneRcG91R/StIC/8e2keEZG0jbRL8epLPVXJAsUmNPkjhmrqDGxqcWJfEpukHPoFQbc/0Mn1md9QK2CkU9lvl3IKrD/PPUsmZqHAuGH6yI8KMfjkSurihYJ96imavh/qVPePZNs5TwOvYaoIoVScwnspAodArOie61/IVLjAgLtJldaYYI5yF75lj0StFmReH2rbCDMUfmbMah5CyGnoWQg1wViNVFypkWGVboRygds28L54kDXyIUK4qyWDnwUdb2ExTwXGqrOd6yiq2TpxerErDtuwdxkMSLRvgFi8e8jdjz1SjS1XScNMNnwfuB6EhZeCcTQ5G2uBSqcWtIOcpko1fCVIauY33YEaNHGtp2Ti+sHluci4cJkBu1ofnLkjyc9wqMuatZBSRbJhzZj3NwM2KS2zODmZcy1j5W7Nwgzt0Qn/H8JWLM6P5vMtZicbwVT0oePJHSZ9FzeFLTKsxc6FiIHowbAnvmWcLn/qNGLmqx694K0ZHZbwNFjREuo50CEMnEpInwcvHgqcR0ofT5HJsdwCxSOD2daV00Wl2lbOXO+zZmcZIylj9iwD7QgrU7E5VCTw92Oa4nJa81jCPx+ER+wS/cpCSQe2TOKP6z/V7hCoexZoKt2q+6i9/ctcTyV4wVjrYG77RAeoI3dT7RTqpA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r2NfbPcpIDd45t/lteW3RYVfnI5G9p6CYBEV3FpmS/9fW7qZGEYauK0wssgXU9a+fgdzLfH4kZOUrqgjMsgKlp99Upci0XpEst3KSDlrrrGAp2z9Pu2w4lwzJI0bW7UUKgYSliN1rBwwBN4x6PJeIDjcL25JnV5YGkLNTQxEikvWF/Q1wNdZ/XbwEKT0/zgYibJBXVOZBRtBG8Z0NwUJEb88WjpK30nVIV0eEfy5+8hMoFcUxAXdXbze5eKilWJvCCnS/nYsPnar+5IOfG+7/9gJCCpoLBfKjE2IHLmEeNC0ywwAAeM88BkKgifOMNuq5BBfYPea3g0O5mygReXhFm5EnIQrzfpdjeexasPk7NqSbFSRoUsVACbIS3gn+cNtIytD5s3jjHB0us0OjDtCdQFaUj3d2Z4W5I/8J8y001QH7nPLkwwttToEppE5VZnBtL1jClkSVVOW9b7Kh7U95C2/lVrc/8aIsOyW7tu+lcYKU/eWqIGEYq5mBJPY/Ut1VQ4wnFdctM1pV0pZHiWHBFiNtFs7zmUV4eY115seDif/AZQx6j2k52JHz0SIF0w2pVLLAP530RyhX8wa0caIjkAeFiXgJ41XnnWxN4GCoAnsnBwz8tNNur4E7KXDlMzz7hTH03AW3CzrhJh24OAFlhi4Dp0+YrUF6Oy1X/8BqIwxhr8LKWt10d/GCmdHtgOFf6Oj/tXxNjr+pw5gQ8ehjcQmIRtNtgOyaFdqiEVzHdt44BISPUl2IPL9hrJEAwYReNbPIEHJnF+3Kv3dV+S/4Mxsv7FhjPbzBBd0iAy41o0h2WY6ceav0NZ85H/GwOuja4vNXGM4TTJQijw1VAMMTLjU0/HWlGqyBoApHLtloN6qm38F0rQCeRx3xujRYJ1jluNY5kEleBUQaDiRZ1cNE0fIGfpd1Ha4TQENkbDSZRBHpfCcn07iKcLau6X5L3ktHRaBLdMRH3Tuo8dxTx1JUaLdUnSC2EueWTiMvlDiGiau6cCVNu4lLxk/D2vWWXm7qQMPd/BGmIZGf1bevbrrVXOjMVpBPHk7APFz19sGOAfPdfgaDgKRcf0MoE2QzsRNiXy2HbIfEpQxN9ugiyNNu6JtY9YnhQrmi+berxAlrRak0Uk4hdpk496f1VOiY400fD8m6L0MFPmBtjzCWtXrBdNpfhVmP7rk1ABFr9UmGyek7LY2cpHGTLIeqXBrQR51weO2LakvGB/oWerWjp1d14y7u3MYDHf0fZyiQO9snTNMe//C9/vHMOchciuHIkqVzqXP76MlVDi0IaEPfmNRNYNG4fKNPKRikwYbMbhwtbt2MNPAO4P8XxU7K+zN2G+px48E6KSzgnJ42L5+Sqi/JuBf7WbaF5OYGZWGEK6iPxImVHGOoAnwdARw+KfRhJR7k+y5m4UbL972ckE/99jsL9vnMM38aMvFGfl3GwEfZfeq4Fl3/nEJK3wTp9cT8KGRZ1K6Vy4R5xa8dhyi+5yfF+6cWqrph2DmM5ZYaiJWaEHkU6+O3/tT+5JnS8mnXoPKacVz1VDgqvl30HnCxJJwigEGrjbS+6lQnjfh2BeTr9wNAsfAS/zkjvUEQr698HUt X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: bad9f83f-8976-4b06-b3a2-08dcc63f55cb X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 02:24:10.6395 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aYK5bsMCS/eXfB0tHv+LBgWDAIq3wPcL2V0NkMFo3jJkI7wl76iz54qqSLhCG8dmTIuG78QQjNu8KBnFRwh/ZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6637 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_192429_103749_B1923044 X-CRM114-Status: GOOD ( 11.06 ) 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 Use devm_clk_get_enabled() instead of devm_clk_get() to make the code cleaner and avoid calling clk_disable_unprepare() Signed-off-by: Wu Bo --- drivers/pci/controller/dwc/pcie-armada8k.c | 36 ++++++++-------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-armada8k.c b/drivers/pci/controller/dwc/pcie-armada8k.c index b5c599ccaacf..e7ef6c2641b8 100644 --- a/drivers/pci/controller/dwc/pcie-armada8k.c +++ b/drivers/pci/controller/dwc/pcie-armada8k.c @@ -284,23 +284,17 @@ static int armada8k_pcie_probe(struct platform_device *pdev) pcie->pci = pci; - pcie->clk = devm_clk_get(dev, NULL); + pcie->clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(pcie->clk)) - return PTR_ERR(pcie->clk); - - ret = clk_prepare_enable(pcie->clk); - if (ret) - return ret; - - pcie->clk_reg = devm_clk_get(dev, "reg"); - if (pcie->clk_reg == ERR_PTR(-EPROBE_DEFER)) { - ret = -EPROBE_DEFER; - goto fail; - } - if (!IS_ERR(pcie->clk_reg)) { - ret = clk_prepare_enable(pcie->clk_reg); - if (ret) - goto fail_clkreg; + return dev_err_probe(dev, PTR_ERR(pcie->clk), + "could not enable clk\n"); + + pcie->clk_reg = devm_clk_get_enabled(dev, "reg"); + if (IS_ERR(pcie->clk_reg)) { + ret = dev_err_probe(dev, PTR_ERR(pcie->clk_reg), + "could not enable reg clk\n"); + if (ret == -EPROBE_DEFER) + goto out; } /* Get the dw-pcie unit configuration/control registers base. */ @@ -308,12 +302,12 @@ static int armada8k_pcie_probe(struct platform_device *pdev) pci->dbi_base = devm_pci_remap_cfg_resource(dev, base); if (IS_ERR(pci->dbi_base)) { ret = PTR_ERR(pci->dbi_base); - goto fail_clkreg; + goto out; } ret = armada8k_pcie_setup_phys(pcie); if (ret) - goto fail_clkreg; + goto out; platform_set_drvdata(pdev, pcie); @@ -325,11 +319,7 @@ static int armada8k_pcie_probe(struct platform_device *pdev) disable_phy: armada8k_pcie_disable_phys(pcie); -fail_clkreg: - clk_disable_unprepare(pcie->clk_reg); -fail: - clk_disable_unprepare(pcie->clk); - +out: return ret; }