From patchwork Wed Aug 21 12:10:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13771314 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 39AB0C52D7C for ; Wed, 21 Aug 2024 12:15:21 +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=eYwqVf5nC1G106y3/JeoEY92jkLlLo2RAUiFL4iAX5k=; b=Njw1ehbOjyWDxBPJq/i3x6PEt3 O1enjiXypki9cTKaE0mhLddvLj26U2IYvck6MThL6pTyBJ7NcuUT8LPvRc5h4JXKukqMhvxSTL+Rs sU4YC1n/wPKO4Z2VhyxRUhzuEU0NWW13+PPFsJV0WxrSGcR8kudPfTjv3wmBU13AZxFT6QSrMAM8B 1cP5qoAIafp4kfgA37C/3Sot7BMh5NomLIKx99QKjl3n3zYbI4MQlLr/6JrHqQdtsXwqmuSGM5lpf prlghqxFTNeNWcJ4UeLJADP841ZlhVPo4WBgwmJTwR0lBwe7sxc9BlemIK2ko5DcwGSHj+kswz56x qwwhzgSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgkF2-00000008sQr-3lPV; Wed, 21 Aug 2024 12:15:08 +0000 Received: from mail-eastasiaazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c400::] helo=HK2PR02CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgkBf-00000008rOU-2H00; Wed, 21 Aug 2024 12:11:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ekg38x9XGr/D300EVQ1txNZ1U7ZFdaTr3AKC9Q4x5PsSDsSOfr4pAthNYQLaiU9rR04Aw3dVz/08/0dPII2KOqI17yPa496jmB6jqDGe4llKI5jgcg1i1vMY1Tmtf9+vqRh+lCzoGpGiHuCOTCOIQ02/eRMd0aQeM/p2CjH2e2D4wi5rvtfuwYLxMZ0HZZf4dJZ/iBMp3gXRmBJMDC4YWbiIc1I5CXMhzEYDucFENPwukraRj4xRUmWK1IJoni6LmWI3Q+Fx89XRAJ3/J56gMjqqv5cU6oVqE0rNm/0mXK5EsiK2wRbZWXYDwYSufU1Cmp/sH/DEgsnkkL2txpnOmg== 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=t3Ucl1XkoJCNK5Y5+r/rmp9rskINXn6cdWMrfCfHkCw1Zlz4LV6sYaaNaHgcCa77cTLjAYD98poet7eJJf9lZc4cSO5q0C0iYc/X/VyJtdLoy151IGjHR4T3+2LqbenS4weKQRwP3vpUvY4XhKkYAhVX/xEZiAnlnMGuWsvBYMxrQYdpnkZKTVfISw3JsX/24TKG6ESmn/SfVDAj4rCbpP6qNIWeEq8NWe4P2MmlxqAtlaTGXunf2Sm9EvwMRpBRArkDoYtqelPHSau/+dfFUYF/GmrKn7nY4o1O7zRwmXokr2xZW5fKNbDfR0bQ4fWqlNby4jCykqr/wDB22DwiZA== 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=pfOYb3OHyPGw/rNEPld6I6QzJVvd1jR86diaWPcy8jTN+bgaWoXfOyBrEwQad8HbdfTiHWIKlqvwxEddfae8KxGRsisu/35fOk5zPFKf6KQdvGWXxklz/RjTiXtWUZPeK48skFqJzmFrITuaG+MAi7kMZrm2g3U8bOht34yipD041PQT9YHp0easXdzLLI+ql28hoFEH1Vd5O0KKXytJFQjUN04hHNmtbKEpb/bRYdKvQ7SfQ8a1osHwXp7cNOAwi3NWE0XarvSbQvK7gylqeC3lWy/FiNbRJkXZJDZMtHNBfB4Bm8hIrjgBxBQiBrcbR9mYb4T+tgAJAWSfyVIQaA== 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 SEZPR06MB5667.apcprd06.prod.outlook.com (2603:1096:101:9f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.20; Wed, 21 Aug 2024 12:11:25 +0000 Received: from SEZPR06MB5624.apcprd06.prod.outlook.com ([fe80::e837:10e3:818e:bdfd]) by SEZPR06MB5624.apcprd06.prod.outlook.com ([fe80::e837:10e3:818e:bdfd%4]) with mapi id 15.20.7875.023; Wed, 21 Aug 2024 12:11:25 +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 , Lei 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 Subject: [PATCH 3/5] usb: r8a66597-udc: Use devm_clk_get_enabled() helpers Date: Wed, 21 Aug 2024 20:10:41 +0800 Message-Id: <20240821121048.31566-4-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240821121048.31566-1-liulei.rjpt@vivo.com> References: <20240821121048.31566-1-liulei.rjpt@vivo.com> X-ClientProxiedBy: TYCP286CA0069.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:31a::17) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|SEZPR06MB5667:EE_ X-MS-Office365-Filtering-Correlation-Id: eb0bc62f-4d6b-42c7-c9bf-08dcc1da60df X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016|7416014|52116014|921020|38350700014|41080700001; X-Microsoft-Antispam-Message-Info: nzcr//cfZRl5SNldIGTu+NAG8YLuSv9LPyT0xR+nyFNbOxGCTp74OE41Z4qy2LCD+7NiYnC0nFoo2+7KNFVViFN9IgQZiyVvt7DtUGMiCfsY8sAHbk69RSfeuYy4YMEt0QdgqAonChe4Gk7X2LSrZqGZTLSQpzQGzO0BOo312+ot0igcsx2Z60aEbldkv2ZLDZsAu4f9ZWVhCCb8phMt3SxOnseFNUS+lFKED6n5SZzami8q28wtGvPomr/Aiw64OaXIIouRgaB75uIeMna/ox3KuGBPTPCdvUycrGXW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WmZmNlQNeQoArUyV49dB1S23DhJTR5a+NlgCBS9NQMPb/6yMgiUT+Q1ic+KIlh5pcANjcZExcRDOw7KKILSb3SiB1/P7bqlWbltUVkDr5 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)(366016)(7416014)(52116014)(921020)(38350700014)(41080700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 87PvIVu+H1G/bN0I27Tj56MsmNXV2PYHJhAKlOeGCtURjGo0whHEFBfmSsPxkJkk9HhDt+/+tIxS/NaplYwsBu/HljEaxBf+xgUy3yjwYMdiTTHbh3yUiVyR1AeuhvbUgZgHJbvH8eHYMZsf60ulFsPnou8QletuG8NK+49UpvS1KVoCkXEA9Szyf72zjgINelrfiNJYBsiE6+R5HYUFDk75AJG+qQV38lcrU4z6fZwIfqwYRT+fclvoFW0Wjxsuh6uVJRVz54aHioBpqtzKJLWBtD+Z8/p6OQ7Vy+bKpe1BovtBcuQASCaE+T08alRBjYIVDXYqVV0dzqOrdY0/bgMg4P2UPTHMhb0/e/9yVx+aJUQfidXjDzb+u8f5WnIWIoSe9xYsHFr7OVhm8GI2rrYOwVixkrFrSsDRC7FNXO+jsvqNYinYELDDn6OnhzzXMF16mZAGntTr8o/9qojX2gR/mX/s5rUwIEb6qayKzLnyx63/wMqOFDOtJ0UoP+f4AyCdvBFgEv0tp9P9nawcmQTeIfTX107egRXaZ0FWe7wWd97TVPyjNEVg+15VOo71SKyCJYp00sYtQhNF3jXMhNOG871wbwJXLgKSVLizKvCHUfHw2K1ynupMo2g0xLXQ4oT/9KFUbwkU8bEHn8bDdBeNh1TqcspFwvwDUHr50jdOIapJc517cEE3gTXuYmqem2G7xXJx518mCwQAkapHIcnvOZyty9JyLKX+bjW++5fXsjYswEpmZP/kuMGXylaPNc9tYxj2o4z6MK2Bri7mTy75u0P51mHe5zyt1uAl64vpuuEbWFeci0ebx3+qleHPfW3WIi0aaQPCZnn1ZgGXKEs2sISFS6XhABec2V14wCwkcSnLwZefmZ1kueV92ZZUJkmPTnbFX3VR2BZFr9GiEaUcBhPnI5DL1xNEZQ9IQdPyha26S09NsM4qdU3YmwKDZaykx2XBp3fkrkCiDRlOcLf7kKdoJlTAXbqPhKLtL3Nj+4WhyFTOlSq5LJrvoovvJfQicmDC24sBvLrDe5NVScMly1d5lp0zUmyBk4s1lEzh3d6tpoYpCgQPL9O4/8MyHv3Q6EqRiLKvdN8FeOU68p57W+rIAVZXaeMOe+V30o+JBU/lFX3JokTwpawgSCknbcpN7TpK+v8As9gETh0FNKsmoDTIJnGjApfjXYOLQyyXgGbu0GCvL9c8V1c425AESNuTFRmzs/gxQLEcOkyabntO1wsFCugW51ReR2AqPJMiTl8qJt6ub1xhqX3TK7tanNJNqY4DPRRyKAXycg6G3QL9YNg2lb08CRESCSCsQTgLqB13oJUYSHi38KiKDWmY2UZ7slFntsAWF9bjdvWllFbWUYK2pzyqDow/o1sD1anIVO5VOUXT3o2s5EoPJr4gy8zF/ZC5gYfI5wiG9SifLtn7hM+yMxRo71qYDyqPrT8UlAqEEMP1Z8oMYbxgXA8BY02ICHlIKBO9TNVUXcsc6nMGS05M5uUWcl6brav3UsgHCeQU1AGTAwIkSGWtf6Pny7ZBQNbbwM4H8WHr7LAUC+fGB7AdgrUHVyhX+qzDRcYKK07v4Dop1Di7mGcK+SBJ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb0bc62f-4d6b-42c7-c9bf-08dcc1da60df X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5624.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2024 12:11:25.3827 (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: S/qUDBEhG1LgOcgip+bwHIVP7Yrwj6HBkNfmqAoswJ9fPCgiJ22Vq49MY/SUJdLEEkdm0XjtS2KpGNuQqx3rwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB5667 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_051139_606410_F32E9091 X-CRM114-Status: GOOD ( 12.90 ) 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/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);