From patchwork Thu Aug 22 04:07:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772636 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 1A9BBC3DA4A for ; Thu, 22 Aug 2024 04:09:46 +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=w4dioiYKcgfzlnlXflPaEAxQtGqqHlevygGpEC2SAf4=; b=KZa//K3kDHq1+E xMGg+h4sxFnkHgo5CzMIGPc6OWSx2XQMZQiP0CfJRglJNS6rD5Vyuq1QD2bycKfPmwTC8bFLm5a2k RkfdpZMimwkiCrThODua+j/6JfQbSczKoQaj0G3/90gotAUdDdQ4B5Fqjz9bxX9V/Yuj+atMUyB9z KRZwUCLMs0BJtlQvW0I0hcgTyfOkRRKl4lwz7NSB+7vWCghKgWeCDgUTRRMLlk7AvntWD3YrvXO42 Qid7necaN2VRB4dkuUdgo5wyE+dXOaxpxmaAvypzqMCyLQ+7Ju6ruCUKK6tBy3usi7cbvcsZAbIHg +aNrz5ApRaRZ4w4fd+4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgz8o-0000000BKHo-1ZyS; Thu, 22 Aug 2024 04:09:42 +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 1sgz7T-0000000BJtl-2L4h; Thu, 22 Aug 2024 04:08:19 +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=BgIF22dr9N5cHfSHqoggAe1n8qmCyyRhjhPVgM+gwNc=; b=cvtx/MBGwVZefArb9/JEROeLhb Vzoa5z2BASS+gwm0V+QuPt45BFYjvIwkbn8+HdiuLV71fTugKF7iHdD3XNiSDcynZfURFqPnLtTs2 Xs3z4kDaWJBfg0ShzH8J7vf/U7VaqfEf3cU/SiaTXo9dXtGc1rbSw2qbRBZXwXOlDwQ4pJNZKou11 Ao/DVa0cVGRRqpShhaEo6AtPKH7VKCygRr0cvU0zobtDzhrdHX3EC3OY/IfXwS2lT8U/b00Gdx4zC l0p80mgqYuwR6v6JY+Dv/O4kUrkOxbQir8YoMU4PTJIjx4VWD5IJ9RZ+t3hlMH3lQLcW+ytYwZ8sJ 4Aet/zng==; 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 1sgz7N-00000009pJO-26U4; Thu, 22 Aug 2024 04:08:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qslww901ByOe4ecDjGx6l4md+HsCLHRZdAAtrfxU9cFEiIFNW4I83/QwNxREAh/1pVjR795XGgs29PaM7CYWTnuCQj9c+WV+DsE21bUIPHckVuk70CuUG+WU39ywRZoPs1oqedzwNKhnZJ9b96cjAHok1ef547GVP4fvGhc7hP4cRCHVPVwYzoLICyVQK1XHGyO0gCp0J+zxaPFhgoxX5tFD/hWqf3NLQhPn6yRrOVTqCY03vR0V5FBWmCmsG/nY/ZHspthbzZjK0vS+e9/1at8RWTif5V2+C71VnzfhznRSERSqGTKhLpqU029E6iR7R9w+KQ9YsCkqdI53vcoEvg== 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=BgIF22dr9N5cHfSHqoggAe1n8qmCyyRhjhPVgM+gwNc=; b=tGyULwWbx3s8YEo0xvRt+f41YNw1mn5KLSf+7owMfX8/2ohBNbxIzWigEx6lA1oAmGdmM69d1b708Pvcb2+AEoRNL7nVOT961opQnbkKiKTIvj6WefqTqHWBSu/DP/tiGKW6HWdCDCgh9USQ4UY5dmkEgnAiopP8YI1F1KTEAXUqEPzrWEzQJqnF7/afeEgBkuuQiYiqxnmojTyNEPgDZgqQ+VRJP3aRuD851wy72/4FwZOS106IkDUHdG/SW4buYoXp+wdT5nxNJJ58zMaoN5P8NgZxsWS1oWrByrqL0tSqusLBOn7CZWkIFFgEBRpjYwyFAk3x220TWwrrhThGWw== 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=BgIF22dr9N5cHfSHqoggAe1n8qmCyyRhjhPVgM+gwNc=; b=hnCITiBT0YZJ3a32H8c5WzkB56wSkvPx2Kq6e8NsvOey2p+YUpQokDoCP3KUlHplGNXasZR+Km2S/kGx9CIRrrfUCAE/ZpYIFxtd61HanpgciafLrfVi1tji4jGZ2mXaNKf5yMyVZ1pGtJwltvtyP01a2U1Jmb92CeTHHheHy02WAjHSab9Bk3BCkNzyjJC8JP1kCmED1kMvTzunhwiwwA5mGIJJ/E4ZRmCbiaxp9BVGZnAHMrK7tgPDylzERLa+RePVhM1dJ0plUhT+jBxl/LL6VcEFVnaJGSBOfDIgm0zV2Io1bRshtNmYaYVdgVkevcG0dBNsLr6/NBf7HkS/aw== 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:07:55 +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:07:55 +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 1/5] usb: aspeed_udc: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 12:07:26 +0800 Message-Id: <20240822040734.29412-2-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: fdf2d471-0b40-4824-2370-08dcc2600039 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: PLlU3CTaS+nANiHYu3+9D0mDcIn4sSAar2zFE1razm8WWX+9E6970q7aYVbpYQwn8rN6wXO3W7M5THTjlsGTxNls48GbwmXKfSGHny+SXixbtT/d2zFFifOnqThmORtSLX7+ghUI1HxlRblruCktXaD1fx3CqTyi4tjCIHHMr09J2AMgrM6kic/myJRPf5GppeCllcTa1hGmiz4O2TrvBIQ6Bdl1U+PQgot4cn9ZuXw7HllXkqrgR3lWjFM9qn/uIg3xnFXdj1mdMpn5NsmOVpYhkrcdFB0SAO95kQBCpfH6qT4ckSrCUxDMc+NwAsQNtIB6/RW3cZnjx894+qkhlK3npFqV0FDThe3bwxGk03sDU5k1ZYTXXoam6bJdxcx7YRTNi3lGL8chPlyYUcl54ho+p6R53MXRlu+FEOMx2OasI9q4OPSkI+CcMC7CrtMsxPYEYYZ4EE5DuOjT6o0twgz4c2AhU9nGMc3Z+APP+Fhcd4wGuYQGK5ETPrsGS+G5DZiLD5o1zWhT8uTWhuyAon9hrMT1y2RK98T0OfzZ5ynPy93dYUjQd37ANN7gqaVR4UBwse4bwwIb0gcwOPOQ7j+n0GsL9Odqy+61oZviSYOEMBeyLB9MXFGZIW2rbhPnlxy7m9gNUgNFbT1xQT57ZC3XB/N1Y+Mfm3pc+GJPtDNdbtZ4N3bKteMN8k1tfDluegp20CqlD32Fu8IjgA+DlMqecUFkm1Qpr6okauNeboUUdRrPxYW+Y+SHpOVJuCXckD+kkVsXvKz2G/cokoJyjy5gs9xo4sTTOlhcB/6epU5FJvAJSzVDvl9bvtVHEIch2KoWFBDwdgMQVR7OACUGQc7/sq/IQK/L7NJ92TW4eBYje49ZeVAj8WLmwizIKRoev/Fbfrm7+v2dVhDS5Isd9icQAhnIguU1miek6PAjgs0Zo6z6Ih4Vy5jqvWbRzo2opWYxbiJ0+WQtZbviHt8fSwWjUxganvBQVLZDUYi2ianYpwCVlMKFn/r4tWBNDO3kJrRYcu6tdZPNMmJKGb7iObUzKLb8KG2iTI9bD9RV5UHqI8wK70CE0RGNU5bVTrTgQ+h4h2fl0x+0wkv9bvUqby+Ack6U2u1IlFFgypQZvsUB8cDr8oxbYqdzpxjw+SHZM4XA0SzIciqvbibGWftKFra+tEcRq2xx9ZA7ZvXdMH2+1wPzgczufkyLVong++dBNjUslZAl8ue4Qggzf8nP5UBUkLatW00rsOfLwtp+a2iD5fzO4co4PnaDeU+tmZgRJpiAQj7BG6Bpay3YocY/hL5VgDhGKfLIRBBglFxPoQ8yFzZVz0TGeUpLX6BEuF8BMBB8E04WP7jcl0/TSC+Kz/AFxqoiekDGCvMAg1X1MV3RLz2ZEL1rt17o7E/k/AK3o57Imle/Ikl+dojBX/mBnOfVXU4IQQsu/rRv5gnCijnd3WmyUrCaxOB9FIRS0MYs 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: 5bEIULdIxDx6ZCI5aY6BnqIQ6h4BMeMbKeQjlkCmqqRjwT2rMIR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ZsaN+JeY6b460Stir+Hmr0kWZnH+vkJGxqAds7jIIMM2XrVqJ+JQkbvzvVc1PMUkLvJUj+FJez/eWHq+iyA89S/xtpJXVlYtDhM2vlDjn9mNhmBd4dtPMnHAPEhRR0T8Ha+LJwecWPTu9aNIKggz0IoXO1OURnjfaJsIWF+3BeX2M4MJ8Eykw2QN8atquU03w+skgl/jvP9JMp79T1OjeVjfdvT7jxcSKZi6mAd0TeVfpu+p8R2iWUKH5HSbPqJ5vmIwmpZ3LKhRk7TGDIX58u7beeabOIzUTo3WnCupDtOnUbCCdkEzAv3/Vm+CjfTPjFABz32LH06UYb1Zs1i9pTWO1LFD4DxlWyukK2fw7lu7smBUPkAdhAgCoWtyO2/4m1LYqKuh5t2VW7uIDGLSqFqXccPlJG5Tofw3Th+HpE5CVUUdyO7Qq/DstYOAPpYOkLUYDp/5ZNiVYG7 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdf2d471-0b40-4824-2370-08dcc2600039 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:07:55.8215 (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: WFA0/Bpcx2uFizbSgpsccze4lffF0mKW14iI5U5E4LCWXm3B0DPLXFjo8mAHh6JIC2IRvZN2KZNNNCFluEIGxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR06MB7134 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240822_050816_195150_DF372526 X-CRM114-Status: GOOD ( 11.83 ) 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(). Signed-off-by: Lei Liu --- drivers/usb/gadget/udc/aspeed_udc.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c index f4781e611aaa..a362e31f7550 100644 --- a/drivers/usb/gadget/udc/aspeed_udc.c +++ b/drivers/usb/gadget/udc/aspeed_udc.c @@ -1459,8 +1459,6 @@ static void ast_udc_remove(struct platform_device *pdev) ctrl = ast_udc_read(udc, AST_UDC_FUNC_CTRL) & ~USB_UPSTREAM_EN; ast_udc_write(udc, ctrl, AST_UDC_FUNC_CTRL); - clk_disable_unprepare(udc->clk); - spin_unlock_irqrestore(&udc->lock, flags); if (udc->ep0_buf) @@ -1500,16 +1498,11 @@ static int ast_udc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, udc); - udc->clk = devm_clk_get(&pdev->dev, NULL); + udc->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(udc->clk)) { rc = PTR_ERR(udc->clk); goto err; } - rc = clk_prepare_enable(udc->clk); - if (rc) { - dev_err(&pdev->dev, "Failed to enable clock (0x%x)\n", rc); - goto err; - } /* Check if we need to limit the HW to USB1 */ max_speed = usb_get_maximum_speed(&pdev->dev); From patchwork Thu Aug 22 04:07:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772640 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 86ABCC3DA4A for ; Thu, 22 Aug 2024 04:10:30 +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=ScKTH3iMgceffsbnYUd92GIOKn2toPL+Pw1jUZAst+Q=; b=N4UN2Jn82z2L+T a7/wOrOc+2KiWT7nNBQyw2Hz6rfLdIEEFuuHlgcUv8giDT7xLiUMHpEIpYYFJyQs53yqzc4tsn3yn kiEKwq1GZK/Z1rRVegNjWEpDmKYrQ+L/o41hHgP7j0Tj0FvRJrK9LIgnyhUi0Adk0bJAMBNLqPfDX Sric+w4wkMNlpDntqJdHu2kb7g387EAZPF6Z1sgVqSE+oc5mRJ52rkX0LmRDcoZD4Q9vl/gZCItZq FStdpP5XNLPG9n7woNB9P7s0nb+XdDGrZxrcnTkEL8JgVARSWn1Ub8inA8NoFcOX0qWHFDzM6LlLr WNj1DOrX6Axqp+isW7cg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgz9X-0000000BKWT-2Dx7; Thu, 22 Aug 2024 04:10:27 +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 1sgz7W-0000000BJuP-3Eqt; Thu, 22 Aug 2024 04:08:22 +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=s2jmReZ0SVaFSOaq1iGOKgSIdyPKBAlggmN10PJDCGo=; b=NNymwoGcqZOt7BNwM1vGp9eJdY xMxkA2Txaxajx7XV8zlJhrzDIy7THGB8zaWN28k7RDwszcdGMc2IUM4Mfp+IuWXvuz7zsrAlgxdDZ q4p+cmFlUO9bd89Wx6GByePEoaM12cxLAEt2k7GSwnLoeDsO0hu9Nfii12oX855Xt9/w6+k/4/xqo dsLsdQQks5N8aPWmK+/ezEPpdYod1uBDmDh/Rs8nM8s5aii0q0k63pNj4UAuwWTYuE50t8+RPTXYz yaBxt1hYgpgd8jenc3yaNZ7QZNa/r7EPyg13Ire9UTGbohXCBRfQ+Rxv1+km/HfFqeGZo1hHl/BHd iKpTz7+Q==; 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 1sgz7T-00000009pJO-01oj; Thu, 22 Aug 2024 04:08:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vbD9Ioi9AVg5WRGPAF/TBYuqeQ4+jFLTFBYBol64IStS5nj+GI2MIMmVzAUkecQ7d7gGyC9frXl6k3JdjW0d+WZ7Cff7tYpZO9dUnR61nOJ8iWJVavCq2Hwbh1Q+tgZzqWecJvuacHEpvyRXCCfwxIRmL/z05OxiJ6yeHLp3gsCT4Sl9CWZWgzZTSaiiv3HyAK9vHKySrQeWp3aDIMBD8d5QH1waG4AGp5Ud0N+EidrE+We5DQEu5RUrab4/dGDjGRBRbcjONdCdi9xCF6E6ofXVhXRzdYPdXtwzErx8GXRPyAhUqhQ+GIJdn2tgX/N8wKJtQst+5sRvHMrQrm9jEw== 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=s2jmReZ0SVaFSOaq1iGOKgSIdyPKBAlggmN10PJDCGo=; b=XHzWjvJuYTlHS9CsShwz8+0be4jSQZhY7ia8Z4v1PM67k/KGRbQ0nKFPBfjUrBfep5ZNnRqMkcl3OdLR8mb+MlyL5cagsLQhpdVkUdUwwIhLcZ/iiVIXrSXCM/Az1bcf/bgDTsAG2C8A0/fqBmWoM9vSlPEXHyv8e+9/nJRrL1Ylxdi9O/C5s1X8GCk2jnpVHwRWdzN9J6rlk74qjdv+oMCR+flXsd+eDZS7g2uG6dWs0y5O3JNuYwgZ2EQU8JkogWZ9v/w81gWaQ9dNZGeLasHykyHys5ShM+IFmKd2ObUYDKPh/YlwCLQAwar9L/Le3urmf8njycHchkDBMntwvg== 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=s2jmReZ0SVaFSOaq1iGOKgSIdyPKBAlggmN10PJDCGo=; b=hPD+pq2o7zfu8kdhddySFwmem9Z+qtSDms7TnlLKgtGqrZ4TKFdFGgoxtVEnK9DofvS4DgaDcgwXfsi2miGZDKQhXCqQ31dkDG2e6gDIWv6S0k9tueSqG4waoXQOvqPS1ZbJTwt8CCGsOHVCLDj/MUtCw3BnJOxvyF6TDN57rCDhowSxB+evkC6I2uOKLrZO3Ek/JIxjWWSX3u9sEo4KdTy6/XuU/aBMkwMTr6+w/wFvAHw218+N38f7y0U82DzQG7tzQuRY30cJVTKTqogwe8LCYnFsEsELZ1vvN4XbGU+6RKF+EbqtWoctLyjEmW17idKgZ71KFi51nh69zlex+Q== 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:02 +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:02 +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 2/5] usb: pxa27x_udc: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 12:07:27 +0800 Message-Id: <20240822040734.29412-3-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: 1d1047ed-bdb1-4904-140d-08dcc2600431 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: XinCLQw+IROYIR7Z00ZeYTbcx7B4giwk3xD9Susie3FQdDJLWQdubBkIJb1o1c7J8EmuZVCK0yqxfXP/Lv1S4BSWY2VOlH6pqf0THyJsqaIM1+jMD/Ex1pOCguYdvIcn1zp4BfniSCMkoUsOCx+WJrh0s68je/zIN98aQqMgDH73N4X/Ata8dYMyH7qTQvrsYKuAZOeD6GEvqcmBHGOr16BAbSQYf5sKyeA7OwbAyOpeBQBrvIhoQsB/qwftYa0t282zRXiYH9icy03hNkyjk0jRAKtJCaygHYLpr2VZfMluvl4iJQtFdX1R75UoMqkHy6+BFQRXrM4SsZWnbPNe8MW3CcTFkeWlNzACHw3bbjCPV3JymFnO+0g1RafFib5jQeF4W7nCObCktCIrto7xHmEyn1aHf/joDfXXypwZIZxxziJuLxyi4XBv2Fvz5ovkW7/a4JR8gM8BwtQ+1XUxCwXVyr4XStTsaWdUh3DLUKp+bHwvuSWXxQU2mIDlb2AnZ8d6lYakudEEv/I+if9Ts/EPSO13J9PGiEhny2Ct5pePqrayQ1cAvR/ib+HMfBzUKwA2UixKFZapAp+SOgSuQkslF6W1xNjdxx/GbGeVWK+KsxochSQOuXrGJv9+saHKkzYbjJNajKd1hqqdErcFBU1dkBKMOVAWFgIEsZo5MmdI/cxxvuEPpzfBfXp8qToGmmI7oWtZcGw9EfcKor/XuuPAxqBeATUvO5CR2/jZY5vv5ZXevWm43y5zNrjofUb9i3dz06ZO+Q0zy3TFNApIWqVz1b6ZtQiVUF29n6/Ug6Df8NmyrA1ye3dAD5Tgd/xgi7PY9mYF1C1L3Qs5x9HxOKLYOxpklKnb8OezD2NNJUAxqDDizGdpT6AcLHXy2rYoj50gHZhfVGKRTzDG+uTXgfjiysPNBLXEr6m/H/oPy/nfMgY8PF/bE2ye3329N7f91qfBMQaC7p5UVJr7/QDGynaMw5gza6VDeDzA4BlMayoIX1W9bOZSMMveQFozSyw2aWobyaCFttGzs/VSx1l73B0HR+cYdbWxm0F55LHqmH/Ef/UhG9lXJiY+TKT5wwfA2djjRq+Y+BDwV9Cc58im5loiGOVFUmw8Ercoo3ggIz4TVzi9Vv3NoNcUjEUWDVcr8ApQgWFdwKGGm3tZ/L34G7hUVedaqK8bTRdUh3UAlTLT6IKxwhQXiFPP888HZ2Dj+I7Z8HEZCNTPkiSAiC/xvo1QCeu+nUkczXN8oZ0w+ZIyZuJMvH4y8YkQ0ma3I9FAwH3ivw4L3sy8sdniqIUEQfxXmLpmbAy1S7w26/ODlQYTmPfiRF9VNiulcxNAqfVYEaLKo4HOrqCfnneHazz/x6G/TxG0+xC931/i27E3gre5H1UqFMpWJj7T4dWWy5yj2gnMhVwxLy8YVO37xF5GFW/Pgcz6MP30SIQ0Nxlx1Oee5d+p9RdlStarpWNnHElr 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: A2g6wj+BU7wSFceAb6pvWY0ilT+5NL4J39kDGvxYu87Eo/sKvBid2QneAtGCI/XdTdUuG73J+UgD0+SLKBDQapu3OmqCty0oT3fZFDPYK/roRJ3qHYjGgPofK8qIOFtxCdgraBWU9pLJdimJhcURfW6DUbQTWvlbNBu+4ytXmbesU5Bc0fTaEolYVzwYAZmpmBMYN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SE1KFsp/gYCHsUfoiWXl2Zq8gJF+GlfjKTBfMpHw6qw9zUmdx1yLtCc/DADFD2r0A3QyXDPmyJfMKcPP2oL6x9eXNJHz0rxlsQwhDdBdj20y5goio9WteMMhkPAFhZkOwk9i5seAA/jza1dpPXrvaAunnbYVayY/x/xwe/wzMcgDa1zeA9O9/l1v3FdVvS17D6rHLyPbIWE2O5Lu+b2YLrVTpNJYOZxnJmk0Xi2b6GLxyKtp/ltUfNk4kOVAsVWS4jWbjw+LpuYifMq4PwERdp6VLQXVAA52samcfOqP+G6F2IyndkY9imbn04M3psFtmU241Ew7su+7HFj X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d1047ed-bdb1-4904-140d-08dcc2600431 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:02.4950 (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: Xv7AtCRpPsh4myX9Zud3BZA3kzxA6aHfQLesc5TP8Ah08+ItvO/9z+8VoegBJCcjhNqqv1eIDj4cJaaEwmQ+DQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR06MB7134 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240822_050819_446241_0F33FD9B X-CRM114-Status: GOOD ( 11.40 ) 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/gadget/udc/pxa27x_udc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c index 1a6317e4b2a3..6e99e75f1acb 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -2398,14 +2398,10 @@ static int pxa_udc_probe(struct platform_device *pdev) if (udc->gpiod) gpiod_direction_output(udc->gpiod, 0); - udc->clk = devm_clk_get(&pdev->dev, NULL); + udc->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(udc->clk)) return PTR_ERR(udc->clk); - retval = clk_prepare(udc->clk); - if (retval) - return retval; - udc->vbus_sensed = 0; the_controller = udc; From patchwork Thu Aug 22 04:07:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772641 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 0DBF6C3DA4A for ; Thu, 22 Aug 2024 04:11:13 +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=XZFDAtbnypM/BVE4zBGroV5MhO8S7ucFQggGZtk60eY=; b=GIVVEdEjxHxPEM NuSV0rUS6tSRoCutnbsIWvJIePvcbMMVLbBDGdt61NUVmsKs5P2YgDkY83/s+gXWMqIzRJ6XUb5zF 9JSrU8dfk5FvcGW/K11nYSa15SIh+pxae47yLcwEadxRYdVVKJofRFsfxjYaYqh3Xrtqmb59law/T RqzNknOVvVl2KMnX4W23WrUuBiY+4skr6YHnrlt6eNI9cACTuHaoNqVW0/FuihMMjtaOGqwV7pZw9 Bx/T2zIg+dfAZl69FNDbIiFMFYLkzDjSJxT2ER+Wf0jYyNlMRrTpfHNQy3Rn5rTOCzI/cClcti9Vz I/jtt4V6ChqsBxuKdpmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgzAF-0000000BKhS-1OZG; Thu, 22 Aug 2024 04:11:11 +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 1sgz7a-0000000BJv1-068J; Thu, 22 Aug 2024 04:08:26 +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=eYwqVf5nC1G106y3/JeoEY92jkLlLo2RAUiFL4iAX5k=; b=moK4ahQzeImu9w1s7cumRNNux+ G8U3cBlr27c/jYmBFOiXKzbj8yDEPZSoWa9KrCnkBHHRE5wzAenGGEQHGocnSt4kgg/h9uBC8AC5r 8xKhHBsidCIrQgIi+0gqibcHlCR/Z47iebVTC0hDjDq+pqOTNh0xcKeNwvCpkndCcYfNAZzL/CHDt l7h84nxG+OUu+JLMkWRMaNkTgZPKAxur++O4Afw0kMioMiDwC6xMKRX3aK7jSvP+B1Ef3UsefyC4+ Wot2kAjT9RaP/J/5SPUrTenclGgc4JGsviBPrsHHbwqx2iIKDbnS+wx1AdO8Nwr9Btme735HwS1Vg NV4YU7wQ==; 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 1sgz7W-00000009pJO-14dg; Thu, 22 Aug 2024 04:08:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gJY0TxFP9l1aga34XDLEpSgB/MGy4fh5mr4dPeXdCKyYFpwrFsiQAQHlOV0VIP3q/xdmsdARTh6tTayKjd7tXHfaHigiC8h6AW6urUFSxhtLr3L0o9oehnRHRqSw62rmPOiIw3nKpDrJGoIRk+9hGrM0Pb5DcOmvEos9PtzUyIWc4eUxyCTd6IgQUQZ3wsbu64I4t7DooOjpdf2a8woFYKFpeUPYESjTlcSFdzqGNFIcba8T7KOuYC3XAeJ3f/WS3EBCYGCSZJq6p7t09K/53FKwPK/Dt3VcvHQ6/8oTWbyCyHMyQ87BMsYSqPAdWm8sWoTLYAbVPNmkVCsdef9kAg== 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=eYwqVf5nC1G106y3/JeoEY92jkLlLo2RAUiFL4iAX5k=; b=EApxw6N8ByFqwXgR2oTxdy1+1KnAix0NpgVpOl5R7PefG8FrZFNj2BlFwE30hZI0sKo5pxdaxBVfhhSIX8fXOnuuXcx8fDqvn4hnhMRHS+XMoWc6siqomVWaYTUmv+OB0uYaT8YQxazxYGuABPEh1sKU887i3oRVQe8IqV6lweaJKcBXDMGKs1IltkHjOf9aUO64n1AAt6zVKfGeOOkVaOVvz8mfffxc2iRu3ysvQuOJQybIIgMlk5VhNzmG5qpIhMoC11owtCvvjAEKoTkQWfz9bMFuDuT7uJ8NlDQXotSGc0JYQ/A456jREMjyIxRAeirIg2szKi+LCvmvNDnNCw== 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=eYwqVf5nC1G106y3/JeoEY92jkLlLo2RAUiFL4iAX5k=; b=n58pJQT+uBH1X0M1W57AlaWy9gtH8743ACOYFzqvljKwCUMtcZ5EpvkrWSKZh3/DAYOuVf50dPUOLm1w/N+kSxCC0FTSo0rlRUvkM/3Zzm8Km+DI47wguCS7aOLz7sACSrYZ9cbtjKahn8iFh+8wPTcswl9LCLNfPYL00rW86o+NuZW8p2UNvdIcTlBofjCcYAAkD/ypr6momFkR+rSazSs68jan8jm1DmUeOetukWj2Gn7pZBEFBJjYz3wbf0x5CcW7MsmT2qEAFd/lVJya6+xds9CKUHN/w0EtTUDt5CAWJUc9BEygrDyPliTHBQAipeDysuUKpyXqijG6VvKBAw== 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:09 +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:09 +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 3/5] usb: r8a66597-udc: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 12:07:28 +0800 Message-Id: <20240822040734.29412-4-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: 5a89b64a-ee8f-4fd6-1ce8-08dcc2600810 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: PgUAd7ITCpcOY2pJHQauwAkNBIfLZVAeAX9lJ2OJ8LeA+xy+oPN5yHfkRaztoE6RQNVyUZPh/BkJ05C97mSVDSz//ovzdcM4USOBC6/aXzSw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E43W7a71zLROwp93m2WBmVSgQ2foAhaOk4jTZCDLAfE673Yp5LYEHRA+HAZYaYuGaGLNsfhR7gNEZ4pdY78VqlAPpNELJX8fbeaJuq3LcL3DAnyYvrZWmuCfpbFBlay8avzY+3GLaySKzvg0hnMEtdZG8l0zNIMkKNq9IiEAvAEWKmJW/UIdn1yQprPLXsPmgGGYJH2VBcPk/ZrBen/yB6WNBU4KOJOJsP4hyn9qJrzs2eOsSSz0tAijtfRzMgT1kDU64uELKHc8FCGpNp/8hibIdaE 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: Rtv6OEU/slen4I2Zt43y7f8tQQviRcM3wVRlK10uSzDzUzbTCnU22+23jtjwzW1Vg9nbokrgGas43DfjevCaJRGbj2Lc2ApP4bIpkDQJjDXLTtSjnWlPJ78wSyqLOzetQoOh2TkdgI6xwKu1xIwWwxcg/lIy9eI0zmUCT9vsXb+sJRHgVXKzTmkGgsjnjc/696n3RI/j4bJUTWIJ7KZnI5vjtshf7ge4pK8W9BPsvC8wnkQ6EpXUIS5naDD+rQW47XpbJUBg4XRIwheVxdtur8qyxr6SJy4vKkFjbwKT78HLSLGj7EQq7bRdBIou7eDYgX3Ezh2JIyxDuTUd3l3b3qaqJ3aq3VIq2ObYRn4pkwYawTfoldrkHvySJPPy+s668+nuk2W9hc/YVaFHr6XfnaJxbdwgULde0dw2JVpsyfcFdOyZWGW0Y71zaMbi+B+TXMatF+ar2ODiUjvy5YjYqBfBbnhiY0cy3mmjqHdh4BFsnXonpI8k10LIJBBh2n/byfFOH6ETUJeLNXIo8UohWr5cPhK0r09XYZUhys6UaP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enant-Network-Message-Id: 5a89b64a-ee8f-4fd6-1ce8-08dcc2600810 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:08.9365 (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: MBksq43PQFqqa7wQCuOpoeYrIO8L6Emg1h1UfOSeKcDgNYGEtP2etFhGiDJ+dykoX1OUsq2WAjCo2wF/e4pCTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR06MB7134 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240822_050822_564630_1542A634 X-CRM114-Status: GOOD ( 12.49 ) 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(). Signed-off-by: Lei Liu --- drivers/usb/gadget/udc/r8a66597-udc.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c index db4a10a979f9..bdbe5ead741e 100644 --- a/drivers/usb/gadget/udc/r8a66597-udc.c +++ b/drivers/usb/gadget/udc/r8a66597-udc.c @@ -1812,10 +1812,6 @@ static void r8a66597_remove(struct platform_device *pdev) usb_del_gadget_udc(&r8a66597->gadget); del_timer_sync(&r8a66597->timer); r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req); - - if (r8a66597->pdata->on_chip) { - clk_disable_unprepare(r8a66597->clk); - } } static void nop_completion(struct usb_ep *ep, struct usb_request *r) @@ -1876,18 +1872,17 @@ static int r8a66597_probe(struct platform_device *pdev) if (r8a66597->pdata->on_chip) { snprintf(clk_name, sizeof(clk_name), "usb%d", pdev->id); - r8a66597->clk = devm_clk_get(dev, clk_name); + r8a66597->clk = devm_clk_get_enabled(dev, clk_name); if (IS_ERR(r8a66597->clk)) { dev_err(dev, "cannot get clock \"%s\"\n", clk_name); return PTR_ERR(r8a66597->clk); } - clk_prepare_enable(r8a66597->clk); } if (r8a66597->pdata->sudmac) { ret = r8a66597_sudmac_ioremap(r8a66597, pdev); if (ret < 0) - goto clean_up2; + goto err_add_udc; } disable_controller(r8a66597); /* make sure controller is disabled */ @@ -1896,7 +1891,7 @@ static int r8a66597_probe(struct platform_device *pdev) udc_name, r8a66597); if (ret < 0) { dev_err(dev, "request_irq error (%d)\n", ret); - goto clean_up2; + goto err_add_udc; } INIT_LIST_HEAD(&r8a66597->gadget.ep_list); @@ -1939,7 +1934,7 @@ static int r8a66597_probe(struct platform_device *pdev) GFP_KERNEL); if (r8a66597->ep0_req == NULL) { ret = -ENOMEM; - goto clean_up2; + goto err_add_udc; } r8a66597->ep0_req->complete = nop_completion; @@ -1952,9 +1947,6 @@ static int r8a66597_probe(struct platform_device *pdev) err_add_udc: r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req); -clean_up2: - if (r8a66597->pdata->on_chip) - clk_disable_unprepare(r8a66597->clk); if (r8a66597->ep0_req) r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req); From patchwork Thu Aug 22 04:07:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772661 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 53268C531DF for ; Thu, 22 Aug 2024 05:15:57 +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=gd8NJm8bc7G4AW5WAE7x0DPifIOE6u4xfh/8Js7P9ZM=; b=RgOWiprvcNlqEx +VAHQiQbIfRecxijLj+77SbyfWpVPuNAEfXqI5OBcuHdRztwruyeYercVDqlHa2rep/NBUeF5Kzrq gtbY7z7ywPX4kfP4eVZJ7WMg3TsSIxtOBS0NoOo/drIAmbTV/s101Tiiy+DWNwkRKCt487TJ45R96 TS2xXhWutYe+MRYtWzCNB61QKpPBNUT89G3qv+qJiT29DcWXi+VpjNS5Kus/5P4ZROJFltVydPC7b i1My/UwjQyHihgh0XHPIbGQTIxrHYiJR628CLx72QPZUBVvIsBGe6LFHeGdAleNo+yE73sp17JDSj IrlMo+WUVT0jvUopMqpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sh0Ar-0000000BRgr-1ofG; Thu, 22 Aug 2024 05:15:53 +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 1sgz7d-0000000BJw8-0Eos; Thu, 22 Aug 2024 04:08:29 +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=NRb0/yRYVHGbZBkAZiOJH8ReCmwegUzzPIqXkY3mCSg=; b=USiz7AoCMHxFFwRLqxjsez0jz3 cB24ZMR4DrQC7nA8vZny5u24ac0UZ+nb7UCv7EYTICw3JcNLxJAmSlyAz8sqJhK0F7MRmu9g/wKOU ty9EeA0vmYx/VPl6rv4WhZaBSeWitgvtD/aTfhc88wYltmX4FN95rb5lgLTnBrnEPRiHtq4aowcEx g2XnBYvFyxaGzZzGRoa1DAjpFHcZ6el/UwY8bdRrOYYzhZV+WR6Lx3OSgjFcE/GZmrccBEVCDkndh VVSx58WL4c8os6lB60X+LRVlaYg8WK0aRBW8pNL18ORgN7DOOJewWbf16GDwgK+sXd7v2SKDBJUjh GdxyukhQ==; 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 1sgz7Z-00000009pJO-1Nxk; Thu, 22 Aug 2024 04:08:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KgtHYw4+9Ig1o3m7OLSPrbw/nDgkkuN7ufPt3yn+Hr2VF5k89Z9ioRf7slL5JcfIjJ1m5cUyDUyFs3ymgq3I4T+FCmRHJg+LCnR91Etk6+APAYIIrKuddUfYxFrLmhX2kAo6cPMKSx9qX3x3xb39ZJXnll7wiUgZPEE3Kze9wlLexzP0Tw2zkfMyCehczhF68LPimMLSewHxCGSD/ULS2JeXUlhm+0A0fGNoOCZ+Npn56XCPWS0wQrWlQROQPqEk1C0JdYuArIiWsDqYhaZGPyndA3VVu4Dn+F6gOFAfy+CLyT1VAWbDHRji0+OaYzd/BJtuIdpE+EsyCApYqjlInA== 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=NRb0/yRYVHGbZBkAZiOJH8ReCmwegUzzPIqXkY3mCSg=; b=peB01ouF/DBCMzIQFbT7RGQEby0ij5aw06iGJGG/rmwWu0DDv6cdNnLpfmNZzf15C6sHCqNvWF7OlwBq5xLrVvyuJgGlUjmHbS4tvhSvRGEtuuEToA6ngvpssd36YUWXGz//HrbiHx6FlzduPz82oesohrRmkHZCOqEOPynvIzP97pDYhq9f5SiewNEzh6msWlt6olfP9RiiQkbZFhS6Y1Dzy2euL054NPjiiScPwP+I9VBFXz1dMGAjkBLARt5UTD/l//AyZnzK/gs+vAYfjpxCGOlFChTBQo2LuqvdzGS2rGHMMrHrcjJfDarqRJDYJCiMP82XgFYwlmAveQXC3A== 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=NRb0/yRYVHGbZBkAZiOJH8ReCmwegUzzPIqXkY3mCSg=; b=BL4u1iyo9+VdpM3/HAUgAv+c+0YmedoNp3nABpmExK4aqKhLj2mhZelL8ezMdosFDkEvLB7g2PuvHnC3vDor8HzN1qnlQY7C8uDtBvlbwHXpG2DWrUrPAuIg81SebEq7ln3pRtdco84LeEAx57dk4lQ2Nir5cNG0szE9jnWc+rfqLofv0jSslTWH4ouKee+FMnse1SxeitrEfm5s+ysK1X9NIM5Fiix9+tjPNdtd1v78AKjeYMkmsnu2Hm5P5zv+OLADdg79o++xTBKB685HoyI8fbDlJW4AhPqhH4CBe9GCWtFoo7y/X8wvvwE9aQ/1fvSB3NGQLANtaEkCtQqeCg== 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:15 +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:15 +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 4/5] usb: mpfs: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 12:07:29 +0800 Message-Id: <20240822040734.29412-5-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: 248d692e-7989-4cbd-ef87-08dcc2600bfa 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: 4J3t83InEpx6fPmPBbEXbaF+Ldc6xLTpT5t+dI2L2cPqD5x/jiWIfhJTxG0Oba8EuGjxjiknQwYFd+Rhw75EVAsWo3lPscQMUVYtIwoaA6taBCbHR05LcGbdfamJt0ISE6fXR7wjACoVm4JBTbvRUjXl8aB1FOAWRZlOJiMn6wD9JEK1F70naNEqdWEWwb04zl4BAjf9SW+2c0zilVrAN+NYJBvL8hugtHaTDdRDmWuZZigZOGwYgFbNenZQP+QPGK5kzpOyVL2o5AALIvtjNkmSbwW4ReRg/i6jF5Uzw/YZBtyfkj58lHxBksE85MHLxN29eFZX4WjatnmlFiunnFSMYU0X+54PpwzAXs9BhSP4GG8IPf2FyJ4DkWrzbxQibnJJO6X2jXX3W9t9s+jgS7ioAX55pmV7sG549JO7UAg+JBNm6yWFDs1vbyx09lXkNqn1vnSdzcoRgvxftvsVa7sBNWY+NWri737e4k806LkGnFLy8cMfQgiUegqCh533JOTmR+mUAN8AoLMFOwX93FiA5rH/RREabUyLhL71rMaKUsj0DJIfDUvj6xAxEWMIWxKQLv0Nn1JRPGWjAyljoXNLL2HFX4Tf64biPnYOH6Q7VYye5wQPms1+EGbteydIvTN4YZYHfVe3OUmGb9DMYXYN0Rq9sdejKNmGZUAbFKVw3LYWDu1mB7iAkih4hx4v2KMJh6PLdRCNOJBnHUd26HUWXh5aQvr0sU/GcEAR4z+sk57XOTsnEY4bnGMWHKlnM77Ny0NpjG2XzAV5e/2CeJeg8puJ5+5Cmb4Aj60KDR5kDBtbaG8kxhoIxGCl74AJrlt1DGPJCgr7Ss/jkMbCivnRJJBssVjPABsOUNmWuBGxZZIdWcUTazhAyCDeauFfy2R/mxoHZFMZM9IejnECwPcrjOAfg05pqsRfZc/9xrG5F12EgeEmvVYzx23RcGusxxtC/zJ3JynJLcTk3FGum/vI9/v64e7tTXOPIysatGbsmGt+WBzZqbMCvKNG+zAf5RF9NFWy/Y6NrCYqexwWXsLZ5gltr1y9ovWMcWzmhGxuwv/sZPi2tYu6zI/AED9vTDg5qdhzE/ByQIMvPH+iov9RU6CrLuTb1KlD4aIIpMdk6vjz/RoZMEZ4cG/TTHRgAzgHFlMCPO3DlXiNA3qMdc7rf5yuFTdc6CPvSjmRBzflmpa4mrJu74yrawYpbqsWetM91NBWRFS1TQepOVENkNUDkSOjOEOvI6LIBk4QNdpMYPgm4xpfgEBO+mkLLVnUI4FmkcJd+5D4FeFCI5VCVJUidSbMhYYVxYI9WmfeQJ4/O1aUna8v6X8bCjabLdmk6gHL/mhjspi3rgeiypfM2X7zLMYMx4EVKxaZI7gED61PiM9sALLETB5jxus2icmmdOjJI6HJMT6fPhwaSHkuuBHp8l3o7Fa+k+05lI3yRMzxce56BUGmXxq2yhe9Kkqx 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: C+uSPuwNZqbNkLzhsb0plMbtKx5DEUnVVz8mXvEJ6c0OQMzT0XHn+bkkSU5+7DPzdcmd6I2eF8+YsSAUoSJ8uvjdiyQC6hMqYc225yF5Q/jWd10K+ajpeY/7TxHc/b/JQNdI9S0nDxSaNJASWFoahsnwcCeuYSyTCLG2VxQUKY4uaxdO6+N6SRwSeBkEARCaT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AIqhEVwG0yB9rAP8mRPzvG6fJIXmmHX5D13QAsFiv6KZm5dMPkPFF0Ay5ubdHD+ygEolDlb6kFUS2Ow29Epf9099Ui5qaJMCnTcG5p8uo3nCku2Pai9sZ8bFMw5z1sAeUDClOzg4m+HH51/reW+BHOMASOl6l68XMj7gdKF3voUOJTY1fUXkvK3j5X7UD3hTfP7vD+JG+1gSHcNiE/VpyeCxfqNA+NA9M7O1+FWX3Bf9yWO0uAWCrTJlz10ojbB2CxI6us59tUY8FdXzJQGI89ZWSZ0gfRPtO9gbbyCXef3P5tuYJJqeLBsUStNo/ncESL/tLoe4ym X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 248d692e-7989-4cbd-ef87-08dcc2600bfa 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:15.5274 (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: lGhe6g/PfoeE2uzevA1HyTS4fjJ4M4NK8CgjcF0sY3/BOXGnhz30sia/yPA/4r2E+ywkHsunOj7Eoy8R5TKNZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR06MB7134 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240822_050825_799734_E55EE44E X-CRM114-Status: GOOD ( 13.07 ) 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 devm_clk_get_enable() should be corrected to devm_clk_get_enabled(). Signed-off-by: Lei Liu --- drivers/usb/musb/mpfs.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c index 29c7e5cdb230..06faf5ab22e6 100644 --- a/drivers/usb/musb/mpfs.c +++ b/drivers/usb/musb/mpfs.c @@ -159,19 +159,13 @@ static int mpfs_probe(struct platform_device *pdev) return -ENOMEM; } - 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 err_phy_release; } - ret = clk_prepare_enable(clk); - if (ret) { - dev_err(&pdev->dev, "failed to enable clock\n"); - goto err_phy_release; - } - musb_pdev->dev.parent = dev; musb_pdev->dev.coherent_dma_mask = DMA_BIT_MASK(39); musb_pdev->dev.dma_mask = &musb_pdev->dev.coherent_dma_mask; @@ -184,7 +178,7 @@ static int mpfs_probe(struct platform_device *pdev) pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) { ret = -ENOMEM; - goto err_clk_disable; + goto err_phy_release; } pdata->config = &mpfs_musb_hdrc_config; @@ -203,7 +197,7 @@ static int mpfs_probe(struct platform_device *pdev) dev_err(dev, "failed to register usb-phy %ld\n", PTR_ERR(glue->phy)); ret = PTR_ERR(glue->phy); - goto err_clk_disable; + goto err_phy_release; } platform_set_drvdata(pdev, glue); @@ -211,27 +205,24 @@ static int mpfs_probe(struct platform_device *pdev) ret = platform_device_add_resources(musb_pdev, pdev->resource, pdev->num_resources); if (ret) { dev_err(dev, "failed to add resources\n"); - goto err_clk_disable; + goto err_phy_release; } ret = platform_device_add_data(musb_pdev, pdata, sizeof(*pdata)); if (ret) { dev_err(dev, "failed to add platform_data\n"); - goto err_clk_disable; + goto err_phy_release; } ret = platform_device_add(musb_pdev); if (ret) { dev_err(dev, "failed to register musb device\n"); - goto err_clk_disable; + goto err_phy_release; } dev_info(&pdev->dev, "Registered MPFS MUSB driver\n"); return 0; -err_clk_disable: - clk_disable_unprepare(clk); - err_phy_release: usb_phy_generic_unregister(glue->phy); platform_device_put(musb_pdev); @@ -242,7 +233,6 @@ static void mpfs_remove(struct platform_device *pdev) { struct mpfs_glue *glue = platform_get_drvdata(pdev); - clk_disable_unprepare(glue->clk); platform_device_unregister(glue->musb); usb_phy_generic_unregister(pdev); } 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+r3h4N2YNSkLrMAZ7sXRk0S7eQa6db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W/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/50srOO9KlqW6hIZIHajEfuSOeoSavAIPRxpnP9eVtlpdyKMqQ7h2+w8yVgXzmTmKmYml1Pub6IC5nVVNGHKi2nk5Ma2cw6ZREDl1tZOjzscXxvc3XkJXwbgxEvZiT+8Kf8tU9yHwIGEo0Gq1eHngRYjZOdmyla4w0ohKBoeLGUQSKYETS7N9obN0vbc+v0k/d48o8abSru3u9T0egfS8Lkyu4HiJMydoJt4KKp76Ft2+9YZlVAF6dVbk/iQhXz7bquivN8CX3gyYdmM4KGUA+4jra01a/lNESiL7PWVqpfUdP9r8KrJXzY/JRP2X5HOvIhEA3IudgWaW4ua5U6mnTTdtsxoPkd5OuSToRkXgxWHnVlfDBxbrv/cVejO9mqqCkspb6Qy/EPHpecBqbsI7L0ZB797nslHJ81sfdflL8LoXFZDWgMh9p2uEmFM/znZhJoCTTRRcGixtT4YLzyPHWZiRzhKxMSzI8BCMK/gMQj0RjGmRIFxL8j6UHVUwQYm4GlFNDcsRq1mV579UEkYdb3ydgI3ByE6cQlmcIcovzc+kgIWlxP68LNQ9iLgIXBl0HE3STBB76CdBUl7w+Nvz7WDWf+7ru7zpU7QiNSrLuXXEu2etGE7p3O0l/DTOVPoCFNiBanJtXup9+xYk3N5ERpynZ6TI05/qeP8IGyVMFpZ8LoF7Ry54DII8eamsGJ5hf3shueTQodmK+ISQSnm4F8WJdbmxutoogdNWnYleQG9SUQGbGxqj6bqwhcSr+uITvFa656qBWS4wMdgJpwpDGKF1zTWGlZMrS7ynY6LkZmSRyhlGfAUVfg7g7g/PPudBUP0e8LOYKDShZTx1VT+IpFbxVv5MWrAI9hRNZNujcY+vE03JH0hhPyNqYcMPXT5MEmfG5jkeP6lQBDY7tBJ/1sLtrABTD+H3pVV3eX5MYnv4r1cdXjlLa+oKpyEoSBQ/8g9YkgB4JL8iO/gUIQV3++9YeKzcai8cUThOU4UvIfeaTz0PSpxvuvQCMynuZr6o9+nEOAQ8PmvmJrl7WyxX4wTFxVFbU7g+JYQfp/XyRIcr0nlNEQVhjYsJCe35jXXZd7RtUYJUdT1i2Dj0DrcatCeUWwAFl+/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