From patchwork Mon Aug 26 08:21:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13777415 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 0A9F7C5321D for ; Mon, 26 Aug 2024 08:23:03 +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: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=BgIF22dr9N5cHfSHqoggAe1n8qmCyyRhjhPVgM+gwNc=; b=dxj1q/R7luXQ4O++J5Kx2OZx2m nNq6IibjNJsXA/XM7eny8b8DydOUhekRh0ocJwHrHsjkuPJWkEzIvh6yu54bcIB4p94BSswQCBO0m XRc+iAbYC35G15vmMopgKWV3xpP7nL5BsrHam4OOUw1jeg3grzftsWoOMVOJcz3H/9NCCq+IkBtCu iFX4bSbjzosFwYxRHQdfX5anHyw8bW47pQqPSmE3we8h+yDIvJsl3jzPHEmZqk94y2Aolerqp26wM Vv3hxpDAlvkW2li8/mQHZqhiSOlXjiogtN/JroLP+g+FkyMOI5Bjb5Z7/1SeYBFhUEsxmzenB54K4 2F/vJwbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siV02-00000006SvP-0TWD; Mon, 26 Aug 2024 08:22:54 +0000 Received: from mail-psaapc01on20603.outbound.protection.outlook.com ([2a01:111:f400:feae::603] helo=APC01-PSA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siUzF-00000006SlF-1ZnA for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 08:22:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=il42Wti7pc+SLjeudZNcnGM4zsjLpixqCQe9SMpvqqp3CmN6IYvPjqoJN7Anh9Sk+O0VTfY7f0+5cS6waWWDeodQUngvuXwnmYcgm72c6vo2X0qaG4LMN50cTb22yZc/58M9yNm2zbszc2mdwStyLZZX5rpWSmEgyVFLIZszPHepVmDCYCd0hdbdoqCBdwHaDQhIJ/EChZEnCdPRycDPop7Y/meAe9hCPv6Lrdu2Qt+Wd78h3KEqgoIbCwUQeGzGGqdqcBpwIxJSOUJYE8FwMlnDYpSyya0f+oujyOtuJpUmEEKI60Lh3L38ElsVHQeFPG/M0gNE+bmuL+K0G/4eEA== 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=hLl93hDFGUoZ67t0B7KNazVwNLrOF0fuU+Qc9NI2msWrXxneqK83yWwXyTwpaAHZbQ6RFtOTzALdqDb1mof9P5ZVll/w0sc8r7/SXRcknqTDZkmhg8fFtvL7anth6ldCPzkWZnrWkB49siZwxkR8eXW2tNYR0QImzE9kRl0FLkmICCxppjXmSw4iVFPTgkwN2BQfv62RYqeZuvfpp1ELcHjiNNDAaSGSH5ao7zQRYa0rub3qmmsYjsoTEyxAcla66psu8zhjpOnaJqhlVKcubpeH0E56UnE0ASgEsIqB1yZP1bJxiPvsFdBhKhg+lnUC2SxNGKDK1jKwNFW/GIy2oQ== 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=U4MONYjrpAe+zlrt9YMAwMpJu8L505A5gg6ku9eHpK30rIGyRoXSjEdVCJrwuE/sQO3+tecxuKkXP1KKjrTvd1R2UlJPiQ81m9554gpoakrUT/M3B6YqTY49dF8KhmNgYzAGoIT+t6GISYGjabsmPeRNI1uiK2A38QUF+OplCKwAWkz2T2YrKiZxEDrcGXRuhc2n4ZrDMA/2d+L0RKCf4BmVZmdd/56mKNAmUg7LMR7SK6fe+rAkT4JIUYN43apPvv1mtAxQdjvgOwIkmC0QZwP0My3NC/023PzIbU2RfiaLg8wG1Jl07KmjyfIvZWdKxzdkOx2nJZbSDFPKtsLdPg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) by PUZPR06MB6054.apcprd06.prod.outlook.com (2603:1096:301:104::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Mon, 26 Aug 2024 08:21:57 +0000 Received: from SEZPR06MB5624.apcprd06.prod.outlook.com ([fe80::e837:10e3:818e:bdfd]) by SEZPR06MB5624.apcprd06.prod.outlook.com ([fe80::e837:10e3:818e:bdfd%5]) with mapi id 15.20.7897.021; Mon, 26 Aug 2024 08:21:57 +0000 From: Lei Liu To: Neal Liu , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , linux-aspeed@lists.ozlabs.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Lei Liu Subject: [PATCH v3 1/5] usb: aspeed_udc: Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 16:21:39 +0800 Message-Id: <20240826082140.2311-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240826081900.2284-1-liulei.rjpt@vivo.com> References: <20240826081900.2284-1-liulei.rjpt@vivo.com> X-ClientProxiedBy: TYCPR01CA0056.jpnprd01.prod.outlook.com (2603:1096:405:2::20) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|PUZPR06MB6054:EE_ X-MS-Office365-Filtering-Correlation-Id: ef32a74d-2fb8-4b0a-7a2a-08dcc5a826a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: 0OJhIANrkzCUIBM6oruxMGZ7JUJjIrl36Vw7Xd7VQpJWQE2DFlqzQGYFfSYhpXTi3CL8AV8We8TmM+aQSVq138BLv/tdqFZMY/uO3BVFSWme3P11OL5DhYp54LtyNKWZwltHSseBfI7R7KDbbyL/29SMjOqek1DF4IC6AgedYZiucolbM4HLphBAWSfldbVYzhuUVchg8cq/N+5WTJH2a0bAKUn73CBHQvkV47Q2T8OPVGVtemi2sdV/q24GsyYFwygKCRVFnbzkfkoVCVrTRbvcUzdfFGRrol3gRgQaaDLCzBO3ndPqbjCHoVUHvU3JZ62fo6C4e6LK4Jn5I0z7tlKtxuYFuKSFufZd3hPRKAylP2jLJUqj2BuRmQC95X8g8XcLgBw/psr0iAhRu4brYhyY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V:NLI;SFV:NSPM;H:SEZPR06MB5624.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: erfj9mjTpfMyMLoVEfkRiNDcr3bxAAMsFrbZRahyxhn2l+zn+FQQOz95D0Lfz5O87DDtZYmn6WPywRuBfUPkl1R/CeL/vmBbbfw8X/BJSm15Ab3JwX9W9ZemQYNstDwLcE2zZZ84H5ujRbMN9H+Elw8uUMrtWPnCzsk1x10Fi16XzMpMqxKs+EyvGONeLH71v0aAwXfI5InLmnmwVFPDExGq3FiaJPHWKUM8/5v6hkl3IL2yWWXca2Pe+rlys3XwwHZOnVPI3f3lHEj6tP7ZC42PQ2VzRcPwHyVp6dBaKTG97/1OlX1frF++/IXqfwJki9xDmFXrRRXnR9q5p9wIJvZt9fsPcYLLSftN+znH5tJd6U/tG8tU1x5Q21bKvOOeLpAU2rVUos9oKR6lbqaA30EVkB6/fZowBUic1vL62V32OaLK9Ln9rHY6gAOrWnr1Vq0O6sKMJgcnuR/Ek0gJX0OF9q10lvEvuv6ZGKXrfhk4nPNVOvXHQsc8Us2yXRds9NcYPEQ+lFKvSmp1ezHeDegFeZH/lOivwt6B6T4Nwlfac8wA30QZGldeZNgK05hbYqZkHdp73UNclaPPF2BGajHvCSyOiZHMqQcv2FDkCbyA7n5Aq4ruuxsJwvycc3rBYzjM1YB3NJoOw2x4oF7rSbKHJh2Uv8pZ7xmGAXjq4v4Fg+qK6r7f+q6L/9mWR+zlLL0+yJXjZ+hCL51EPA1zBY7RK9J6Y4L7yop2hLdg0fyYggDn71bSU7RNput9Slk4XHiwtJ4qxG+rAlj2y0lOG4N40CBY+ZGfB/tNRC+Wy5jPbmU+IcVCebYIqRrXIUZEKcqJfm1+7Ua94jze3y2DzKyqRY2MJyFKeDZOkfzgQGUZqwIWjBUx8td4AJZTTfF7sqxg4dqr5LWrFCStYNZ23A6ixWYx36nL7tFJ/+WVRs1we4zW18Bjk28DLuom4AE0OCoPVIXJs+ltzo6CiVQBB9Fpoz9FTv3KYrZsIf9yICrzw+5fiXduRzisOpgMlvqetdBOnxAz9UNa7Cb7DdB2WaJ3JsgJEuZ2WaL0NiZeeBmixGnf/xVCW4csfKbSZaqzFEs9AEDARSJ23wjEN7S108tpMDTTIIgnmowECrfCJ/+Np0QsdcYU7agrUsJByAm4HXSweKfzR4KCNGpbNauXFyo6isRoUYiZEewHKp33UtxZK1a4eKc9ELLeIzcFn5XMVTZiX6a+5F2L22eIY59ugTA7nxQm9wDlMgzlrNHjqWOa6MVDv1q51SdWFpe1mhXS5YZq8E/twkRYdfKf2lnnjzfZI/RJhZw52o43cApfoRzfcFtoIwGQEy+AztVcjMScKWkfewpMbY99xxJsmx79kJsxah8PQyUZG2gxWscUGJieDfwciU0Vt7dziHjvV2zerigj+wDCCONmNj8jaihwqJLMgGrqpJRlZ5amiYo+qGxGu+Ng3gbRDPql7WCHBeDiTJBQdzgIvaujg27hh8+SXuFtT+cZovdFzwIjgQAqwVDKz8EIOcNngXLlkevCdgS92ng/1jtxcDf+Qr4PioZvx99ipyLYrJD2gwgSgZA1bPyhVQbj0lP+eHchagqJDFIk X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef32a74d-2fb8-4b0a-7a2a-08dcc5a826a7 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5624.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 08:21:57.5967 (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: Fp1d+PeSB7l4oKi/hEi3KU9E7WVLgQ9cdTiTXtFKkvJsRrRFOOxe+zAzATkHkLBmHPalGjMftN+mav+Ym+s4vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB6054 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_012205_447677_9036DB42 X-CRM114-Status: GOOD ( 11.49 ) 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 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 Mon Aug 26 08:22:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13777421 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 EF1BAC5321D for ; Mon, 26 Aug 2024 08:23:53 +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: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=8qz03x8h02qC6gDrmqTA01oA9enpmey7Xz0yBtUzGqA=; b=urfyiX6cwAJRDerq0SMqa+ZNCa tFB2W/w+lYgX/v5CMwULXV4BgPMOEL5v9CzLBMi1Ycfw7rC9/5EqdYZ7sbDWch9gVb0GWwQcy9XDY 9lJ6+nDnn+fI8bT2qVs/uhz7zL1ejdTk63Nd7fAQEJi7mmRYnrDJ4I3W5w6c1PrHl9oWpfj2kVQBx jzj3iI6ebgWZyPzmEn5c/rA9SvHypKRQ13VfpmEkaFn74WWUlrJQNun0pG6FZcfXF1T7CxcJi3CZZ eyMsn6s08n4HOoq7wHyOOJ9X5tEescu+gZLNETVOInWd4TaIeiXAxLdAhL00z8wQa2MbV+wjHZdSa gcAiYorA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siV0n-00000006T9X-1J5d; Mon, 26 Aug 2024 08:23:41 +0000 Received: from mail-sgaapc01on2061e.outbound.protection.outlook.com ([2a01:111:f400:feab::61e] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siUzk-00000006Srs-0Vfj for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 08:22:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NI7GoHlW1Lhve8MWkpPNn3S3hzqfAaN2vbpxD/X1sFq5z3XTWGawtJifOSSuoXW5GAju3IGAoGq6JOtHDWa862kHrRZ7jIBpmTNGZ4yI03hOLNJt+Ird/hL8zpxRFlJxF2zspaaKEV62X8/WAaOEPzmLh/AZjwMyHKcKgGC+ueUSH6EHSlRKYneOvfileORU46pTlfGwWmNW5O4zBP1eYDrhb7UoWWzr12VbVU9NJsWwdwehE3nJOzq9f4IdCIJvQ6S0tEcWznVD82Oza+SDNC/LyN0OSsZuP4hGjCpnIYrRiCoMB7/kDIbcmHQjeIWYpZAfrVsD4IVEPD16PofxYA== 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=8qz03x8h02qC6gDrmqTA01oA9enpmey7Xz0yBtUzGqA=; b=UN8CmoGK8T/xBYYom+fP0H+iVXM+DmvJ39L925JepGuH9PsTiaitQxao8lOzLxAcpXXXWu7mdSn2so8HNt9XkIbDWuEH4NaNCd/vHWTScLfwu7mRCaHi3I7IdKzpRtC7/S6rzMwaGUI25+3ZDy65/5ESuSFqlYrS64hhFZfCkdeST8G4UyS8MOAAHnR9uCMYr5/KtWx5c93H5SApFjSyfQv4Ajh+c55r/KnPHmZKBNBGkVIpeG1BUsr5so9Io8gIPmEC5u1lFtz1QHmnwLjZ7mTyKXbZof9g3Q+r2qfDdVyHHtHT1VZC6gM4/lIztwowU8xQj/sL2hlpoFMVG8Px/w== 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=8qz03x8h02qC6gDrmqTA01oA9enpmey7Xz0yBtUzGqA=; b=f2VpBji0oG7TWdE2h5zEBfx05DoinIQWuA2sfmZdc/JRLzbxNH+AYgzM/j4xh2ea/X8upa1QLskLS8goCXfVIqmDpNfq8N/Cgdn/R8Kj4IBUGvYbv8b2rgXOeDU9C06ibqDe44eborIdZt+60U39r/6XCxNunrRtGyNdrScGsGC6umK7UyKjYpbdvUVd0Vx3K+GJiVl8/G6IDvMM1Y6M2kAfOptHEz1DjqZyIpuK73NPz0Inex+Qu6NdUy0iOXev4ZaQyg0ZMayK1zo0aL7d+yePNey30M2Nkth8FAvKVi8dAIlQ+I7BSTfRqdqNwvDpDuqTiUKYfyhJ+1yPWqe55A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) by PUZPR06MB6054.apcprd06.prod.outlook.com (2603:1096:301:104::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Mon, 26 Aug 2024 08:22:30 +0000 Received: from SEZPR06MB5624.apcprd06.prod.outlook.com ([fe80::e837:10e3:818e:bdfd]) by SEZPR06MB5624.apcprd06.prod.outlook.com ([fe80::e837:10e3:818e:bdfd%5]) with mapi id 15.20.7897.021; Mon, 26 Aug 2024 08:22:30 +0000 From: Lei Liu To: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Lei Liu Subject: [PATCH v3 2/5] usb: pxa27x_udc: Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 16:22:18 +0800 Message-Id: <20240826082218.2331-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240826081900.2284-1-liulei.rjpt@vivo.com> References: <20240826081900.2284-1-liulei.rjpt@vivo.com> X-ClientProxiedBy: TYCP286CA0240.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c7::16) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|PUZPR06MB6054:EE_ X-MS-Office365-Filtering-Correlation-Id: 481591dc-2705-4383-723b-08dcc5a83a55 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|38350700014|41080700001; X-Microsoft-Antispam-Message-Info: I67nQJVehKDnOjTiIl/EFCT1FKS0TQ9vJwdvE6RiKO2ctSWpvMwNr859IRWmPgLi8ur93Qd1OJawbzyYfFlGE7dV/9WVUsuXHSYwQB04iHQ/H35k63Nr5Rb9qeHmGDLu75zMvV4XZaHSLvMOblS9N7A7NawYhXBnYP+1MjwC9XNiAlXhHSYmMLREPdNpUMFu32pFPGavPIrLssbwaw0ngwMVOkTLQHTkr4m1vfkawtOnyAFpqVQrKtjnp6MbOo/GLj3JTsunZhaVBJXO9fUC5U18EOJU8RL6Ajc7wb9N4V+rHkLOPe5bTPSRuxIeY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JCal2zaHxIX7J3s06wg5NTAG1Ha+fjI2Cfo02ndfNfzx+hSEvKWXS95T X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5624.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(38350700014)(41080700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GAyjYmQjrW0DVXATSB3Q+H6v6mmutoiMzAis5Q8bGTlvf5IFfYB5C8tdaX1uDh8hS7Hek2ts6pOs0+34OyPOGBjZ8zy1EuZoU3vKmlKG4bxl0rooZuCRQOwFBo92wHhUM+IiE6Iq9OxCapHZtzIsgsiZ5rWHFBBQp5z6djlmsR2abW3tnaS7nRrXmhahP29iqSrZi2Hywj1GDkZndZAMCTe/p7on4GgwwAlND9v9h2ic9sCM+jsNpxcRfbgVskuDj2uR9ckf6ZhOIOX0kupKgJRT/CEzjlZ3kkDmxwlCintDBZ2yJKIpDsMvNbDTZyrMuIVfcUrkccFaRu+y/ZEM6RUYYwTo5CgzwKQeyCQmtKoPqSYPiSTNsfbBxrXcSpjMXPklEnp5QoGZ2vk08frn9m6YVsOvuT7kZ0l5hpU5Z3Ws8+X1Q5Y5DBlxRhE8wdIrxXKjtPrJlpOsuNp9nrLoB3hlbcRtthjGTF5Wqipumlfyj85oHRe0fiFuerolknsPu+cPlpMnqsqdzKNoKTzT/Zs7gVtuEf7yJaKEhY2wXE0q0MPUu3GfDGmnOy0tg+GyKjjvmC9oRy2zAYUwZnEVpyk2QrArA9/3fyBXLhLkxWbA5j9wefIsGm2u9On5wvyQGtj3NZ5cTqccnQZZJwACI2FS05V7J85bbTW+iqJkmB3Ev5U9daouvZcsHdBKi4SjlYhLMnCTxnbhHheGomrab16Qe3rK+iTRoPZnWpnSs3dDPLlbDRpZdtl28MufOciRyYSIcg0u36dPbFXEle5lQTbApTdmkUIo/GcR88BTtgAFgufrxoKNau9E8+qZ9RdD8/QStWQ2WzvZCpwOV3bIDLqNo1i/jZzoQM5SGxWxlddw6dwZVbSbuRAnU8pggNoaB/U77cMf/kMLBpjv3O5uYj1ugLKb/k5DFCAK2vvgwFpWi1pyul1epJFqE/uJ/DtVh4f8LdYq456RI11PvSL2f8GGOjdFadKAEAR7PZNho6SgfW/bBWaf0m5/5DspxjY+sTtrCFnC9yZmHX+C0QIzrL9iPI87tkAdoxPqLHD+XoV3yIN1gjmaG+OYLiGP6kppz30v8zjppVkaZtU155Qffit8gNdjYG2dn4+0BHVi5I48xrrbhPSIM+je2xWq4iKROWJI856MQE0WXhOqcO/Ljgo8LRKtRv+AytjRbFsKUD8E+NhQLIJAFtAnM3VBFW/mjhw+BaMOIQDxu85RwH3ro/b2nY7AbtaTZv19V78HzjWyfGxXWEyQNaCv+2Nw6WVg8jIjqUhrt4IwMPu0q9glMy/4AdDnYuzODa/PJzqmgtBzdV9oxtJL6MobZTWdN1ILXM1zu5nkrmPkzJfHW6B/7p+/9Qg72j/L+Ijxk0ikMu1yB9KFSZf2WLOGqbKgHfCd4BddZ5E42w1tHdVN9fxm1wEmk+NK095iq8uMA0/7N88fu28BAOSPYjDMijWMxBN7eEsaJ9S+QJcvXmzt2UiG2MKeX30h6r9drduXuyJhOEiVpF5DrSkib4kESXr0xsqJbPSzce6p7u0qstOZJQ3SPcaHCIiN8hos8Esl4M4c7p9Zk3uCNCI1efyAfgJ+rgwV X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 481591dc-2705-4383-723b-08dcc5a83a55 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5624.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 08:22:30.6209 (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: Vfm6OgEXHV3gciNhj/fK5ALuSEJCDuPodueYxcXvbn3DZYnKhmewt3D2aZU2IUkzyfuZywvtRZ1/s8VT49/Y9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB6054 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_012236_185534_5C14F41F X-CRM114-Status: GOOD ( 12.03 ) 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 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(). --- v2 -> v3 Fix the email thread. --- v1 -> v2 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..0619507d187e 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;