From patchwork Thu Aug 22 04:07:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772642 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 2DF72C3DA4A for ; Thu, 22 Aug 2024 04:12:39 +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=fMhYEbOVCFycJvIsPBug9AMUgALVFXAv4pcxvM6ALJE=; b=u2BzHvLizCoDGv BdomIiaQ58zRN27peKFjTjWtq0CgFF/bvDLOmR5skA9F56M05c14NzFxguvLEgI+Dhdlm9i23EKTK Cgt7kpCmylsV0UM3Vu7cvdJ+BEnK3OdYnVjxic3XTMnXaNtRuLaVn1PJitfV9rYxnuJm1oGiwsKIr UWu3QYAJsWeBNTorFwfmBEZTYmn7wYT4QB9YUGLyQwtWvi890i7DUQp4k+89JWLUfzDcuM9PxDL4w ZF1NVXFavOMolumiFPE8s8pnhvD3TqM19Sc1XJHpNeMR4bv4yanMVL6dvhAckEZrUa/iiBSAoEd7y zhi5+8bgNFopu8ZpB7Ww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgzBc-0000000BL0k-2CWu; Thu, 22 Aug 2024 04:12:36 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgz7k-0000000BJy8-0TME; Thu, 22 Aug 2024 04:08:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=U66r+/XDGd8ba4fl6mZskdUS0Dc0b0JN/6atOXTbsEA=; b=NmrT3FIiFWSVpftfECU5vLXIHK yCzYEfwap+cnhLrvcLeyl/U40wIfILWpRO3Z7EhLpOE3rwmfJW7Ps/Pr1N+7eYm4M15l0PIlo/52u 7neVNixDP1H4qC+tTxfytttvsinvRH/0fuUdpWtfBHud761b9qhTqV5SW4L7negqNPwjkTAydXbeL 3bad35KZXHxO8M97KYZPZZHNELmkVJPECPMTBLW1BJGuQlLMcZjX1rm8E/DKtOQvxDOXZjXPASPUX O3MLZ9MnPuBSEO2e7inyHxzSHJt21KAAPm8F0J5RC8VRJ3I8l/gtwt177k3M1wv5itFDurda7aw8e bfMKPJKA==; Received: from mail-sgaapc01on20609.outbound.protection.outlook.com ([2a01:111:f400:feab::609] helo=APC01-SG2-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgz7d-00000009pJO-03Lt; Thu, 22 Aug 2024 04:08:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PmMbXHig04ai/z6L0U1Ybiwdc4H0n/PEYE+XSYWSwRSFD7vUrb10d9/WvwGF70lFfaDCuVGDrkdmiwXZw6Zp59oftVg5hn9z5bP4ax1lQch0GBJJjwHAx5eq1w3/pyQ7S+QutHx6PPzaOamcc+kW2IzrVp4sA8A20834bCtAdJPgRkZ39wBHfUXS5j6cpLIkvtipnzEb+QBRsgMcMcJnr8t76Ne3kUOy25UKUS61yKSFhv2E1NW/gybrfW817rIAZeo6qOhPg66jSEVjIcabTMpTPdIxHIhNyvBF2NHfz+1pvw6RZlj22hiiSwQJBq0uG8GUIe8J1kJZX3cZbdlwTA== 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=U66r+/XDGd8ba4fl6mZskdUS0Dc0b0JN/6atOXTbsEA=; b=L6tLJcGzej2nxV1+5fv5XtFOEeYWMrU63b1hmrWVYwwD1iDZ53/DAljpJ0kEIXgViJVeGXZmtw+pcBSjSmfzzfMf9jjzebXH53Bh1FkS3w/sMRqww++VaCx41GxsO370JjfXfyxTiUBUMfJgaGERNRFLh28G/2y6WaozZdf81EE/Vh0YkVsurGD/rcvDivwv4yajkd4u09p/ucal26RI+ch2gSDV+m3DEYf7Mv9h3ivT9H9Vmb3bAmA/QdRlMh1/jo9UbRviW6wA5nlw9JlTCt/y3aeTy0T/8WrDhnZ7ssiYxMx34mZbDGP2rGVFx2/eEvJlLdL93/GNKKThhOzbFw== 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=U66r+/XDGd8ba4fl6mZskdUS0Dc0b0JN/6atOXTbsEA=; b=Kd+pjPZ0XS1QCq37Nj8DYhzSjfLfRJkbecztHCati38bgf+UaS1QGq2DiZwzl2XhV72g9WvxIAZAmDMnIkcF+9619nBHL2lGJiQNNlDd0q4zM/ufxVGZgcqtr+X3zYDBTNee11CR74ifVGNwsEvMRjGfaLChJcR/FjoXnpU6YnTWJkTzIkcOIBOhfNnn+u1pPGG8G4Vt1+3wICAs8MR9O0dreVJqXm20G2Jm616LaZO0s8TyRK0ZXtzshEF8J5dvftENmRp86Hurjo8gaKFCYjpVD9oTIRtdEs2Zcfuxnmcl8zgGpAtO7ke2EDo5pcy2vl6LZ9K0hMI71V3TFwmyiQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PUZPR06MB5620.apcprd06.prod.outlook.com (2603:1096:301:ee::9) by TYSPR06MB7134.apcprd06.prod.outlook.com (2603:1096:405:8b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.19; Thu, 22 Aug 2024 04:08:21 +0000 Received: from PUZPR06MB5620.apcprd06.prod.outlook.com ([fe80::b771:8e9f:2fb:ee83]) by PUZPR06MB5620.apcprd06.prod.outlook.com ([fe80::b771:8e9f:2fb:ee83%7]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 04:08:21 +0000 From: Lei Liu To: Neal Liu , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Conor Dooley , Daire McNamara , Bin Liu , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , linux-aspeed@lists.ozlabs.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Cc: opensource.kernel@vivo.com, Lei Liu Subject: [PATCH v1 5/5] usb: ux500: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 12:07:30 +0800 Message-Id: <20240822040734.29412-6-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822040734.29412-1-liulei.rjpt@vivo.com> References: <20240822040734.29412-1-liulei.rjpt@vivo.com> X-ClientProxiedBy: TYAPR04CA0012.apcprd04.prod.outlook.com (2603:1096:404:15::24) To PUZPR06MB5620.apcprd06.prod.outlook.com (2603:1096:301:ee::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5620:EE_|TYSPR06MB7134:EE_ X-MS-Office365-Filtering-Correlation-Id: 94715fbf-8259-4c2a-a08d-08dcc2600fb0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|52116014|1800799024|921020|38350700014|41080700001; X-Microsoft-Antispam-Message-Info: YtUJD9ZSbVk2UvYVIy7gx2hjh+F9DcB6kJwYc+4h+c4aTdRzdYDco3SF1dIjPaReubtemXRDYYRycFvx2oK/OTqi9mPpLvkPFG7GssdAtDfujT12ottXdk80w3g7daNlSaHTkBI+d3kqNwzWtSEeV72e/p2pGbXlv3OhbzUJDV1+iyiWa31mZQi2nnOPqZVu05KBJHMY9uak8cm6qHOCpLcXZBQWEYu/B5N8kwRc8rs66Yh59KRsC1gMa25yJ1lee61w7GhmjVqGT+zIS/IV4+qstP9I6g3DTfITvTXcTYEL3pnm3ckcYpE+r3h4N2YNSkLrMAZ7sXRk0S7eQa6dbrljI1neUthQdCTrn2xGMywvZv82RF/2gWs73QzAV9t/67qG+wmBbV8au9UfktIz1/oqKfxC9+Blj09mK41QZVYGR8wtmG4eG+BWiFV3wYAHJ98gian32g9QQC8XnHJt7PiM161s03eqpqpKzUUgu/qHOiMTT8NssXtPGKkF4tpEHe97Uc4UxttMg/+Lx7SlHaEEf6hafBaeuiJP8rWUeNlenXFYc48T+peB9K7fsyIi+Ve5HPyU1qdC3V8RpEPnYrsw5vGHHG9CsE+FrHn833+iZJtN9X+wCRosl1cwQdcC5iCQXjDRhTJH+8Rl8E3eK2vvUxPyA7m9z1ASdTcAZCiJ1PtLD3f6giF4HU/ST4DUyDPGueHzjAsCjKmQmv+1hi2871d8yY0ss32c4S1tUYfFggPF1P7MCIUpb7e7OZWHqD6llHOYf4JbaW/GeaYTIAmIex1+HkBgfFpkIlQUiZCHZ7UjQnMiT4Ny3EZEJC9ZZQXJjBAZSt2EhTqDl/53Hbvzd4Xh0Dq/QP/gKgtgT+b85D/krHk63QzweaLH8HfgnbylL9jeLso2uJ9Bq53oqKFbrp+hlksUyZe+tu26z8nYGWqBj0zTZSDVo/0CHXqDIxa4eASsx+n7biKd9rQUlSeTh7HGI0wtsJpSEhYXo8VuqiLgM1hKglJDopjFy2WV5fA/FWZPmWeinWzkcivRJ/QyZ27sILQrwvv7hCLdeGsl4APv1h4RhjAxReJpe+qxuzHPVxHP9LDxMcWlEIPBVNdIoGictFA2uPDytks5aTBICWjtdSH3BKVPHiCXWMh+37mIEV/GCJgjyDXrch8d+sgwN6+tOSqlYRibX3ifAYYdRldD+VCstXA6tlUZp4EsTcaOZJquEzTAtGeylXRLxP1xLlUx1XdapoXe0yowsaPDxrPCyPzDZRULGZkBZAaksbXRFxgjWPvYmyuTOuSYKYax29zzlrN2wP73kCyEz3YAKr1vVX5J7yaAFDEn+OfiwhPFYMekYBnysCPZeFGdt1gtMBc21GcaTHbTtBLx+ZcO7UWVSs2+ylf1eqCCsZOAqo697l1mT4ab7TTKU1fIW/gupb3dOVbhsc7EQw6Ricdt8+uoN1uivlZtzSUIhGpS X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5620.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(52116014)(1800799024)(921020)(38350700014)(41080700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SmvJygEqLt5DPe4VR/uBaRcfHbbGknq5yZeN7P7jCgVastEeE/P+YOkC33I7FPD9DaOOBFmjv8t0llZjDWgP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lNEQVhjYsJCe35jXXZd7RtUYJUdT1i2Dj0DrcatCeUWwAFl+/A/qozkVpaH6vln0OLDuBLZ2oCKfkvvSTDYAUxVwphqeuFPKlm3Ko9HjpTosysvopYERT5AmXM/ha/yi7Ad+QFZJuITi1mXHuAnYlOzyLIW0ddDmms6l8Bk1mFan61lTLY2gQJuEZwZqK7nQeSC89hdVE1XW6sqwveMY/vyCNVYJtnRMG4IdnkF1MuID39GSZtjL6N992YdG2Dj0OSNsEC9z1SsRlj/X1v4pXPN/UolmoTYpwpYICnDIfokovPmFwhLDQrO+YVWKhM8fKGrNNXpS7Kq6Ml3GnObblRMHkB0Dm/gpfgQdnkdye+bsR84hEM1u6rKhmswNRGbQB+UBgFGD3qtczVsjcMSSYZDVLHXdX7gtEINFeK1/zWSSos1LixdKEpHuF/YpP X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94715fbf-8259-4c2a-a08d-08dcc2600fb0 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5620.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 04:08:21.7479 (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: drOLShEdR5kkhIA08Zggt/RGIQ4Og5XA3vMtcP5oZDYMU69xP+jUebzk/ehtdXm1oAGqxqNaW8w9mANEl32Z/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR06MB7134 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240822_050831_755380_F967104D X-CRM114-Status: GOOD ( 12.33 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The devm_clk_get_enabled() helpers: - call devm_clk_get() - call clk_prepare_enable() and register what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids calls to clk_disable_unprepare(). --- v0 -> v1 Incorrect usage of clk_prepare_enable() should be corrected to devm_clk_get_enabled(). Signed-off-by: Lei Liu --- drivers/usb/musb/ux500.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index c8d9d2a1d2f0..51ce67678c0c 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c @@ -246,19 +246,13 @@ static int ux500_probe(struct platform_device *pdev) goto err0; } - clk = devm_clk_get(&pdev->dev, NULL); + clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(clk)) { dev_err(&pdev->dev, "failed to get clock\n"); ret = PTR_ERR(clk); goto err1; } - ret = clk_prepare_enable(clk); - if (ret) { - dev_err(&pdev->dev, "failed to enable clock\n"); - goto err1; - } - musb->dev.parent = &pdev->dev; musb->dev.dma_mask = &pdev->dev.coherent_dma_mask; musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask; @@ -276,26 +270,23 @@ static int ux500_probe(struct platform_device *pdev) ret = platform_device_add_resources(musb, pdev->resource, pdev->num_resources); if (ret) { dev_err(&pdev->dev, "failed to add resources\n"); - goto err2; + goto err1; } ret = platform_device_add_data(musb, pdata, sizeof(*pdata)); if (ret) { dev_err(&pdev->dev, "failed to add platform_data\n"); - goto err2; + goto err1; } ret = platform_device_add(musb); if (ret) { dev_err(&pdev->dev, "failed to register musb device\n"); - goto err2; + goto err1; } return 0; -err2: - clk_disable_unprepare(clk); - err1: platform_device_put(musb); @@ -308,7 +299,6 @@ static void ux500_remove(struct platform_device *pdev) struct ux500_glue *glue = platform_get_drvdata(pdev); platform_device_unregister(glue->musb); - clk_disable_unprepare(glue->clk); } #ifdef CONFIG_PM_SLEEP