From patchwork Mon Aug 26 07:05:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13777396 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 21F8EC5472E for ; Mon, 26 Aug 2024 08:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=BgIF22dr9N5cHfSHqoggAe1n8qmCyyRhjhPVgM+gwNc=; b=WMYCGadY3EiT9IpLhDykqY2kIu /SvqmEwNKK2H4fgPwsd0GjYc0W1mXSQo6ihZLnZZxzlouKT9oD0zPOPze9Y3DXA0Gd6oOhlrXZTRD kSPGDj1YJP6h+woA7GdYNc10ZLqz8CbCoDC2fo5Dh11F7axa4yBqGXQSkglI+q6onbs/3N0KKJxyj vlO2orIjpeINv8Mzt+IEv+exM13UN0tCpfALAfU/1Ycdy3iRV01OK0tE3dmbmlx+L7YQn5iimWJpb s8whfXoOBWWeh6csd1NkI5QyaLqphL0KguuOn7ImVlIXISaIdKVVc9JrkdE91JXow6zl6DqSgQ/go Y/fRv8Pg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siUsi-00000006R0V-1Dp8; Mon, 26 Aug 2024 08:15:20 +0000 Received: from mail-sgaapc01on20618.outbound.protection.outlook.com ([2a01:111:f400:feab::618] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siTns-00000006C7x-3U4O for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 07:06:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ufB5GAgQ6Hi87oWhYbby/j7Ff2/iTdYml4IsitwVBWE9yd7vOjIUJd27JE5Xj/4zYtnsQ79bMZD7S0DSx87CWFmx1UDGv2ASEfS6LobppV1pm3dQRXyfO52hOoSQoCzxN6GhRgUA1uvgp1VU9aGRqOph+38mxr1YTNtI7/VAW7VQRT/8FE5161sOezZq1sCB8+ai5sO92xHs49ieBQJCJnKVOk/rHl3SNWMn1h7iyBe++DAmSxZ0sMD8y5lTriu9zIiSq/sn9du5vmvEmEDUOIV+BIccsOVY8n87OaGDCopLivnWVVJGrNFMJ2qObeV0P5IGhwu7w7jJ56NZeydLrg== 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=q2cJW4MGZaESDKmRDRB16NNdhseCccu39BV1LFIyd8TLLVTjy6rxXsUz4IBCskQyel3DApYKVRW+iWVjJz0UV34I2a8JqS7OA01mOYURmSVvVjOXWzt5emoXFolnqmtVJ1S49g/CoOHoU3BvEGu1TzwlTggM3OjQvex4GkvPQo38hMEQO/SYen0qjSlqbmAF/6gLJ9jMB1n6fqBP50vIMrrSCTolEMJbtRwwvYRFRMAYyNdfgMjEDfRDjdhdoDYvHwsG7X+kchPj/upKPrJLw+bTUHxpVVt1lF+Rtiq/ftt/pjxrd5luoXA3fJ3T3CWYFJr9QDQmP4w7xG7WAOIChQ== 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=qa4IGBd6otPUd1BIxwcrAtSmN1cIB/h3S4q0zc8tbnBlsHHP5AwSj0/QGhCtefU3/hFPd1AvZQg4vNIm/dTQIhm7JdGfomlBGjIKb9433hgf37DAff7ttJn3TMvihREVgJb3aiymUpt1K/yGXg1Ih6Cpwzfumg7qt2uZ6KkhLXQ+DkHHObaDD9oAqXAoJ+pdI2bX6ii0PY4IRctr32ue1YaW+n/cgtJFmDrP1W0MINFIQJoVQipI3n7TQKcXfg/ByJbeHH4qoVjJDeSa+HYOQ5+ckTp9yb0oY02hdCRfHhXdU0+FxBtDYhJgAS5up4RIaj3pu8vF0eDuf7p8wRypbw== 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 PUZPR06MB6055.apcprd06.prod.outlook.com (2603:1096:301:106::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 07:06:13 +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 07:06:13 +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 v2 1/5] usb: aspeed_udc: Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 15:05:59 +0800 Message-Id: <20240826070600.1871-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TY2PR02CA0057.apcprd02.prod.outlook.com (2603:1096:404:e2::21) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|PUZPR06MB6055:EE_ X-MS-Office365-Filtering-Correlation-Id: 27e43008-232c-4899-f683-08dcc59d91c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: 527THOvlMkbPCQwq2iaePMRTr0ovuOH0UYMnMBQJLeTo9AymfMn8FXB/YlGtxPypp05SpO1H4V06ucRFpwQYO75feQWiKU6XoygQROmpgON+PFmqU60yi+7ZD6oHj56Dcr35hedQEWDfyW/73WbI2dAUs3nxaaOo4bi8EpN4GzawsKKyAnnTXmdjXaU2f5DK/dmF3RvAxz1lxyL86U9qO7z1z36DjX0iGzQfozwqIhbuTgxfnPDpzd7VylcEO+VBd4Qy+CZ2rHNp6eCvL62PyDWkAez8b0oh6EmdHY7GklqrmkJP7bVHYHPdaNt8AENIIKrwfQvcpzHZ/Y3zvVYeWcH+VrhyH0lApwgTjP/TQr979x6+v+OhvERD5I/yO/zkQ9YJXQgoa9YS9DJpv2ITiG/pqSBJ0W1/3w3o6eiLrrRXAZvUQ83RQ+5lTDA/26sIj7ZWZuKsZkZMOs2G9XCC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S:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6xiTyLT7arX/9K4bw1aOT3eUrfNkSpM/zHVRTLYLyvGj9fcf7PSSa7biRwttTkOrJ038OBupLWGQYnAjDS9uOCyyln1O/j45wCQsUi7KWAuZq/FaUOpEGAI6sO11S452nqzsgyjcoVspZgHfJvPHomo2c61aFl+Ivzc/qjvvOJQYvDyG/PN1n2pTwRc3wma2/Dk3XqoheEwYXoz0kLusrpEIp0RAcIWVuWlw2q7azCtfM50dijYEmcbGzoo1cuc8vTDPjfSLxSXTHT3sRAhjOh6yBADiJUg8UGmR3Phd/oEfMkZfokG56DPaw6qeGPqbMVrq+0mQQRPMBKi3TIs64f9yg9w0eFID+C3GDQheZFwBVBq5RZzD2wsqjbq0Wqjh3y8FHlEP2hnhiFlHcNxReqsuuQcNxdpWdDHT1nF/JJT9sk7T0T8DlbHlL43yn20cWfsCIiMVbjp3OY3QKGRJIpIUK+YfgP2yeGMOaOFceFrFkTIZA44kBmnFLDcfQP3yFaD1Cvem99VKqzIePV53rXEy3KkKQk7Gax/j+ixoMcxNhdMpC6x5C5QdFlowaJhIGjxV33WFRLH8fm/w/Ejc2wLxX82NoNy93zrs9m/JVJoqbDpUynl3Ms5cqeOoNEbtY9FATb8FjcqqNUnxT+PHp5a7vbtb0+9dZIzI6/dLL/VBYfE5iHuNV1Vlsb617fcn3QUfgJ84+XEqEASiyeA88wn4/4SHKk65QaRMkDWqfkngGJ3xD0pKaZQ1DIMIYr3t6daSKJ6f2imdn+vZHHJKfToCuZPHHrKhx7yC/nSKTTp/qgJ4LSD+wB3DXyq8KFltnY+GAQ/omEhWh4HsfY5DjKU/wrk6hTGdCkV93+DCx+paTD3wEUsJsKR9DHBXrL+DiPxKxNu+Dwxk2OqDUachaV9kzIeigdDfOP9uDdasDs4aJxEIixpeNRUtYik2hYiSpRJUOMwvcXoChD4eFHKzeNlZRk18shw2W7JP07SGOjiawqtDmX+kayI67zrLlGmjxOveXYH1aPJ+ObrxIbXeJm3fQ6f5ikqc9tY0H6JI9Hasdn+4Gf7JB5z4WAXrHFLwXpEp09OCSZx24C0ANrOjOhfoaPwmQeW1vJE9pAjFvYXObH8BtSojQj+3NrEbvpyIsQTH+42Ccpgy8mFa5jNZMgK2/h7ijyRgEBaFOFX5F6Oi67xXiJU9HGr6wVA9U8gqjRERB7kALO8HVTuVVI04DcOEdOh7kyDYHJgTuGZbx7jF55eA7TqvgtwduY5jiZnpdqzUyGj4tO5LvUEbBPDRacQhQLbWcsSKhc+Rz4r1qQbqSlzLeWMtc5RF/0G1PDkr4U9ttXmg1rQU4ROpNDEydOJXSW+ZWEi9bszS5UQuBJnm3FNub3upCJvz8Jju0xEp4zDIrz4NC0Ml0IS3i2AjHv4ylwHhEljgvrUdMB3tKhEx3SbrKtENWBE1L91BALdo5pFK4qpnH5k4QqizrSUM4+3tbejcAQxJOvMBmgow/tpNlASfKrCAG+ivGKppub/ys6S/cc+2fa92e2EvDCpCNEFSl4rfrjpZmZGM2hhknNZD62ihV5SdQcDGqW4OTaBA X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27e43008-232c-4899-f683-08dcc59d91c6 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5624.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 07:06:12.9861 (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: vCrynoZ5JEc83RhlatGAvt2mejDB8F7e985BcqNAaWLBHl7KdFltNYzOrfx3HimybMWTJcRKdC9v6Y9ZEQhzeg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB6055 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_000616_881514_D55E2FF9 X-CRM114-Status: GOOD ( 11.29 ) 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 07:06:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13777397 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 13B11C5472F for ; Mon, 26 Aug 2024 08:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=hCqA1B0nQSFfKg/8VT5mteK6iwf47eBKT6V7sKALC78=; b=fJYtTJXH/84ISBrfWXRqLR6DBl Dirsnw+1YVwlkTSlDoSs4spxsig+NN/qVsjLkNRCDS0zzQu49OprdifUHwOsR0tqOgz8CDR5PVXJn qbe1yhPcmbJRIfgOTlGQsOElYrtiSgoCknAiKIKvJ6a61lGfN/5ZBpxOj9V5UMkbCWnnCRfES7wuF 9aBWdVV2zkfOOzDQYMBzDIgTl1YO5hJK7QmtereYPutxl8SgL+hLfCuQlO1Nlc+1dwBlAZ+6vpCkO RwDjsUA3OL/QL1Y0U91KRShW7X60b2J/SfWZJN7o8k1EJv0I93/JvtR2KORDGQ6pctJ31fQZ8Cw3t Y3+iNhrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siUsj-00000006R1D-2TzF; Mon, 26 Aug 2024 08:15:21 +0000 Received: from mail-sgaapc01on20604.outbound.protection.outlook.com ([2a01:111:f400:feab::604] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siToM-00000006CEa-2pSv for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 07:06:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=koEFL6X/ynvCfoT60WytssfEQWhlTJvYKeg79KMW2wF5XYzn4+Qz5UHx7wLcHb3KvbkCx3avYNSDe+Hwz7PJmuYHowZ7YlkXULYLQ9c4MQZeaeTAALIToDHWV3DthXcM4IvaKM1u0Hny3ul8GXTxaooOMu68HnMvywos5xzormCRP/H7ADlaKaFx1yxqF5eq8vUSenW9UJVLJuG973ID+hxNwUh8lNwFYkgyVi2a0VZ80q8jILz7a/S2V4gyLP/QGqxVw+3/URWmtIO3PbspQ7bqWAJLiDrandlNNxXoMrAkMdZttXV/75mvvLDCOq7iscxaXI9/uPwW/V7W1BwxBQ== 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=hCqA1B0nQSFfKg/8VT5mteK6iwf47eBKT6V7sKALC78=; b=W4a2NY/InC7OqOKn4/UJNx05cl4w5lKpNSsTh+qaeftIhe5VQJsYmlg4WaFMbcOin3tDlHv8sgs2I5FlGchMCKMNmQdA45S0FwJUrgG4JWtsFyx8jqPJXJy9l+zEqz6JJK4facaBPDDmzV0AP7FfMLeEohqSdkEX26ks03wo+Uogk2gM8kUDVx1hNvLXvPwoKKmFztJR9XU+8yjyzvdy0sm+nMlM3+Vs25HcxxC2Cx4A0ArRnsLgPqHpxuOPzB5QKFSM0t1jL7dnee/sfm02N4asIuKtLsDz+QBo7z1GXSq6hXo8bMWHh57wxv+xEsCz7bUAUcoMpkOb86ML1zI/7Q== 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=hCqA1B0nQSFfKg/8VT5mteK6iwf47eBKT6V7sKALC78=; b=p5346XhlSaEaBDWUEUovMSGbsZnxk5bPyTB9V7csyiGEEd+UQdrs8InREaB7mKfAYLKVXao2RomOm8ITUV/jr29HE/hba8OBugaGAhFY2JSJIgRg3w2C6MZ3gfDRYd9x73rZYZSbfSB0PZmivX5j3Z2sx7MJoClzl+JE04wFl07pHeRKAIhlGrm+uqoCcAYYOPycxMX81hCqF5Ox2Zru3w0gV3t+Yu4biIvOhEvyVKX8R1rgsDKluxLLfdiGTU72fQkw8hWatl3A23oQkFQ+V8iSL/RO761J/HJlkzqSluygtlvXY+mW/9OVo8AfNRRupLiU3m17oO6OdadEXIF9RA== 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 PUZPR06MB6055.apcprd06.prod.outlook.com (2603:1096:301:106::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 07:06:35 +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 07:06:35 +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 v2 2/5] usb: pxa27x_udc: Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 15:06:23 +0800 Message-Id: <20240826070624.1891-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TY2PR02CA0062.apcprd02.prod.outlook.com (2603:1096:404:e2::26) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|PUZPR06MB6055:EE_ X-MS-Office365-Filtering-Correlation-Id: 417bc7dd-8643-43d7-44e2-08dcc59d9f1f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|38350700014|41080700001; X-Microsoft-Antispam-Message-Info: x1MAVraWJq7/Z9u6HhKz4CtTncCGPUZEBFga9khaWeM7/buGh5kvUt4Ew3CNSUnaHswHUNAVChX9a/hx5sPLZWZcns6/sU8xD7lhvpUU7t5L2QaPIvphXpuwuJRCaChqCW4z8Tnys8FRjKtFh832Q1PWDKISZBMaWj9yGrtDVeP06+yW9BvnaQ5L/H42gy+p9/1wpF5J5obnNTWI7TRQNsr2FqJLQjAj0P+U8kt/kLpi7B8+c6ISbyJickwjmJ5wlbcbc431xiZF0EN4FcMpUEoPAxfnJbsoO4wgJ8wrCjMiTBUATYtILoGAnAav/8QnPPDcLlmlj6DgHmOZbQl5xxJDnpRLg6Gw5hqLnrQO1yNvbVw/yl2+dFA7M/DggEnS9Y452yzoXBMzkf/T5ueh8UNB1a6mEWxo7OUUayODF4LdebgV7CBkpDlL5v/blXYSwg41qa5gKeJSThvIQow1xWJdoCkmak2KXL515/du545S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outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014)(41080700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UZOphrMFMUV39/0e1/pEhfIcKoTKBg2IyO1g6wijOXT6YI98utt5MBiJhBq1EvslTWBN1duVkUfmgfic/eKYgAcyxL+8RRPaIJOz9+noUq2g4RrXnLLasc3xp6LouTCYhI6nD8SiAfVjRF4eVSu5sDFxRuNH58PSHhU334wNnhZTFCHqdnN0HFY316IfWcEaggnu+db3Qx1Mk0ztT9XfvZpFkSNAGQgZtMCamCG/1owUWlroN3u4LDH8tErmRPzQt7mzlqfExDyQChLBwhtqhmEdYEOS5F4ONwa3e/meYMnGouTG6GGw7l5rtGU+wNHkTUCTbqBXTIqtUkNa9VcQtMe+1bjt7ewpU5lWOBobOzEsiV9H5h+cDZocVC+QwEbSHFPK4CGWaRILmlU2cwMwJdzJUwdySbjid2l4DJxAow+U46zLm9Pa7uaSpgHu5TBpgjq3EwZPVwBLeJkCTJR55zN/KEENZ6k0h/f8nJds3K+6ATJ2/0z0zPROAlGE5BCvr6UgHxIxhcuydCrYocRa/QqyAYi9ELkbdtlliCYFAEXmA2ZuQFC7Cz0jAuhzz191lkWeUdSILdss1JwNsrzp09W1gdzCmMnlW0EjCZ0xg7BpuDPZs2+ZXA2HeU6xWVSw3Kb1YUGZpd2B5VNd2Fw8DNCIckrX+5FcUvyG8I0sx+CIch6LE88Fh9Wu2HXyFhtD/WdQf1R8MYQCGM7tHvuK0X3JpA3JuP/T3V2td/5jPSESJf7aw5vMFmm3WlPgpm6zZHVM5uWV4mjoKQ8IlHpVvu2kLarXfKu6g+LH92GpXHr5pg9eNtG6Gixnf6RSsNMu40vxTEQlaraW0bm2NSNbTUiPaA2xhdclw8AeWlc77E6TnzeA8yl81rdsa2DrFRwIvCh0Z0KK47Qh+q+fI65Ev+iHxhbRklL1+8aZC6e47uL0vCfmM8xeWjQrue8E0P9f0UJn8vtgtxs/Hg1hhKpjLctripbP/rIPRNJRIilgRDNOMBzCUfTyCIlba/Q5TVgmumxt+D346ugyeyJA+93q2F2ZhdCdpa1SnZB5yIzHLP+u44oc2x4tDhtjsnLA1s7hKLXih4+K4sd3S8QA+nfsJg10vIBzAzN9PMnedjGvbCAoTcRQWzY6Tc/oN5t5TfgNJGceO6whFg8Ccos8Ewx/e2Ot91WyJ8dQ5LU2ZKWLUOkRnOD9p01JLwT2VNoGfp9YR7Rv6ISA/4XEkQpsN1qMSzkqiRmOZSSNVhPUGSDxJENkBX9LcE5aVNWoLB6HtPXSQxLxx8f/F6KJCpuvwd7ObaXfsk0dEV8yfBECTvE7UZYtRRZ5mE8LeEzGY7dD8ySHsLuh54IVjkinx5KyBmHhY7z2FV6Xi98XtrGN+ZQy3aWhiY1NRnc/8H6UVRET0H1UCd2pSFBYPZkl9J/jWikxcnsfDQbQVfIIBLwrM47/HCkNBM+Lmups4KUhA6JE72dL0ZmhYZkj4pHRk+FoFGDridTqLfr3z4/pSganZJ4a+kqLtDwcIYQwLLjJ4ofjCaFmK4rmdRooRZFGpOgD4M++tW3fyj5XelVMu1dRGorYt0TzN5oa4FZvg7MsKtWNSocw X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 417bc7dd-8643-43d7-44e2-08dcc59d9f1f X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5624.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 07:06:35.2841 (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: uPsRQxGsz6CDOXwGJXbPmrl/e3i1dixRFs3lKyyRqwvJzh813r8fTe/MWqBrmHpd9QDzE476EcfH2PYmXwvDbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB6055 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_000646_741177_AD85F42B X-CRM114-Status: GOOD ( 11.41 ) 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(). --- 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;