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: 822650 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2050.outbound.protection.outlook.com [40.107.215.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4F9A78C98; Mon, 26 Aug 2024 07:06:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724655978; cv=fail; b=n1jtlLl9I9K7SOEBi7DGx02niry/5L/BNBS1RpgdhXuzAvdHzTHynaYQ7F7/qx5G+BtO1EnQZp1oh8/q8pdVp04QaW1l8rNgAIPrCkjY1OWR5/8chNDa++RbPdLmx3yp2oIJy6+25vPQPLzW7BMfOpROCdlg80PqyE42kRsPXwQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724655978; c=relaxed/simple; bh=YVBSjMz4xvwGs2PRVw+m14n4Yy0III8Kgb+kgRG7l0Y=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=Ve0fLTka1Prw2M5p8N0JIhbfMRgtU2bU32PXEafH9Gva/qAnj2km62Ww2AlLVK4qZ1Pl9cA6n1lmuYmhTSBAu/tqOwmldG6JqXPd0WiH+8Z38xeEV8MGds6RKYWd3YxJGNC5WwAcRsrcFDjeHj5aZpK/z1l0qz9NVKCs7phYXG8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=qa4IGBd6; arc=fail smtp.client-ip=40.107.215.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="qa4IGBd6" 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) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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/26sIj7ZWZuKsZkZMOs2G9XC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FS:(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 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: 823033 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2075.outbound.protection.outlook.com [40.107.215.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C33A2770E5; Mon, 26 Aug 2024 07:06:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724656000; cv=fail; b=eZpDNtBkUaboWm3FcBsjk2QZ1j8c1+PBcwRqgGA8WIPplQ7undZ7wuiaVV6A7mF4z7Wz7KmbHmjDFROdK3fjAzdb/6BpakbWRA/HxflNpVqTa4ckJojS8m0SDL39KDALBanykMuomHuXID6BhStwamaKte9qK4A+7RQN3dIUiAI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724656000; c=relaxed/simple; bh=u0+n1GQwDE7rBJX44eooamoelPv0ctmTtYeBw6eHikI=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=q7OzkFDFoLGW53GA+4G1sf3PQGSxyOwTZdHf8DgvPBNVaUqJdZHCzJ60g+DRe0Fb+pr9V+30zgLQj/Q9hTFulgkdnmOFWGI1ub8+HswS1gLOsgP8uRx0fEfEfCpAUmP1rlyvggwTY7VAe2khMTuf8RnWyg2eLx635Wt2Nvc2uvQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=p5346Xhl; arc=fail smtp.client-ip=40.107.215.75 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="p5346Xhl" 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) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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/du545SH7qCDfgyEUhIk0ZkQQh5+9c4d+OSCb4JPQb0Jb4comCp45UhofQsqxSfQXqOdGS2zePXdrsVsm2kAs10thN2OBex3utfGO+C06o/UXMjWKqZemtNtd1GbMSmQbnCE1TnJzuDXr/LySkQitZm5sHDsvFtmK72b7g1Rh6GysU/P7MFGqHIa/vFIOC3xc0vbqJYN+g1WnlCPM6sBH5HpB/d6Q1t53KdvhPytmbHcOGBtC+j4awABqGPDlxYQhncY9PaCN9tRhGo+GRvZoBr90o12DrG5zIg4oxz5FXduHIfhq3vpYM5SJgJTIR2TZx7HYAqECu3NaJJJw9hVawg0SQPCuH/0ZZ5CH2ksTfWTLYst/p/J2Royy1PgZCGbtBNGQ+M2Zt9rVY4Z6hMnU1dBo4BuOrJfWST6TWRxq2USvcduHE0iD0uStKibvyP+wNdeQdO5xwmmefC9XlDak+ONm/9pVyBcQKL3k/le6JU6yCbODeHA8rygPUA4HBCkVAwCt2Xg3aCZO7HYXKsnZl/54ik8HapHSMaR3Adc7Z05zhvONijpA2sO8duc4tScN82ILvg3NN/u645/Xu4LoDsRIKt8q72u3RW5y61n6dZ5YSbyAJG6bDZC2iRiEqUyVE3rH95zYI0lnft4rI35ee4WUK57k8Qop3tht/5wT2cExHPOTC/Sf/+IQDOJz9m/Xjg5pb9nvzdIsdX/VUCeDKK/KM4O7zbu9GDV+JYxg0VDYXcPyiHf4DBEN2ONQheU4XQ5diuMJy6UBt8xTfu+mHCKhRQgP/DGHc356teFltNbK/CN5AphgF+wmEp2LYaO/nTU7BGBSrLXjAy2qOmEUxCcZ5FFdzFzkd+/AQdBfs3BXDcb3NnfzkoEW/Lyl/FEqQcwRzIfYfhr+zbFp4rUFTzQ6YxRt1UWRyhz4vtL2x/PV2Obna5yUf09x0tlu0OWnT1bUK4FbdpoLBaTOePFsGSI7S5 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)(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+noUq2g4RrXnLLasc3xp6LouTCYhI6nD8SiAfVjRF4eVSu5sDFx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Rv6ISA/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 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; From patchwork Mon Aug 26 07:06: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: 822649 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2050.outbound.protection.outlook.com [40.107.215.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A12343FE4; Mon, 26 Aug 2024 07:06:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724656018; cv=fail; b=pHhtwVtz06UuBKS5Hj64aru/CP5q6OHfzxJIDzBgkX7p/pBS7XrVdLkoOwCPIbYOCm8cTfTJm5Y4yl16Ule3laTYhoF4ADQqrSXMWp8RLoVaXB1i1q9X6nDWLo0inVA+fcx3GMuuTxA30mZGNxe+jGQ1kV4HjZCCRQufk3Aif8I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724656018; c=relaxed/simple; bh=4JEh5659lE4oCzyGydPMyjW1bqFusCVtsG62nasmUeo=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=GCMch4/1jN+sGbOJSmo9TqFo3xAurAiLOKdLQn+uZgR38ID2F3tpYhshILL6UJsjpNOBaT9/zVAa3IZb5cRBEoLDlMJb4ZcV0zfdMpUl3rm6/uhaiQRJHwoGohMq5CSdMiSdRS5Q3sbbBLtLKpLqf5JzmOMy2340WoIuE+V3nr0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=VvwcRIQ8; arc=fail smtp.client-ip=40.107.215.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="VvwcRIQ8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=m8Ia4RD+EfgRBOCtym3+x5OvzgkGS85dKAoTtbEY7vwNMyDZAys75xYl0OeYN0sVu6V/uxSu5gJsDLDYLzxQv5Kq1LliGg7aT8atRYnivcyHQVGzTav6NdWgLm73kmY4Hxq6d/QElR+cOLHEdXjzkpMFoToj1RyxLuvOMmLCmeNr7lnBFBwafWE1lTn5Bp4wxET/AkPtK+OSQICZylYDnoGtK8HKOsq+MEHpFHd/Yh+aYHjp/xYiMwB8hAqq//+3H9O9RlwjmjXC+W2u5m7pYjYjYCbbSaCR3bdWX3YS26mXeT9dA9ekLdDCM7aEb+3I1K5Vd3Y090AqPHQngvugzA== 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=Pr5OZlD25G3cseMvZnsH/V7528jz5LD13DJ3CUBtJAio8ISRMirIucdmoIK9s9M3OdjVWj/ckDZYbyXOZkPQ8MvlPzHw+L2hNkpRgWZienKXikKib6EXyTd+ZZtyBk5JGw2/PaYYpp7KKrQSQpGCnL9BIX3qd7LJfag4Ox6MOgMcQoSxuaEdtvEsP3yKR/CypyU0cUkaPVOjvQR1dz0OUAbEzL0IjGHDPVH1QVSG2B4THXUWjDz3IbbtBo5RNE/iUCf35gbm+BVkPgl+0SC9o3j4bX58j9fYBp3qBZMldMKzVXS2H47sxq0g0id/dgTvWv1v8patK+7mFjIzgNXmDg== 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=VvwcRIQ8QUGiwhXeqaVGbGyBJv0JhXFfx8MNXslgPeDSmnf0p7pW+2rIgyrKqWdqXu07HGLpYgMpr3R6t+KBkUh3tjdocS3b/WuzL7K5wiGXrXOmp4bW2HsOunSDTK1Fd43+iot0wmPAPJ4NTeHTlTc+NBj5A8xIg0Dsi2kZc+s0qrVf98RAUW9463rQ+st+CoQ1KqgJ9XuTuzyj1kco+q2sU6B2QtmyVkqvS9bHYp26QWY3BgTMoC5jjG16b5IhVEwy67nmNm93uc8dx4JEjcBg/lN9FdjL5aENP8T4dWZAisXED6aOfXaWw/U/7vIPmJEM9ay28M3jdIZwAvHlrg== 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:53 +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:53 +0000 From: Lei Liu To: Greg Kroah-Hartman , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Lei Liu , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com Subject: [PATCH v2 3/5] usb: r8a66597-udc: Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 15:06:39 +0800 Message-Id: <20240826070642.1911-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2PR01CA0015.apcprd01.prod.exchangelabs.com (2603:1096:4:191::15) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|PUZPR06MB6055:EE_ X-MS-Office365-Filtering-Correlation-Id: 44d227fd-bc7c-4e4b-a0e4-08dcc59da9eb 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: NW/L+O2xU/9lJGfCfd+hJv/pEjplIB/gx7jdKwn2nkUQMCxstBRNE2ChXZTMtEgEQMfd2EU44CaygqJaRonb8suPPjcFtBPEHDVkFnx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KaeAZzg2ZvXIl/eThpSxI0C+BnmPt9tuARLSWxADPH7lynUt10sfI0La+RGxe4Gx+fG1zwGx7/fk3SJBCjKZbp3lVyqDAC5r8CROS9pT+L4XxYI8EwI0QdFU8jC6WZS4Maw1/avaqOVBzsCwzuV8PzM9fyZ7FAwvxKBX3u29wR9qOKhlF8cdcXfxh3Kwt6syblCKBLvj6pp8Ylt5gfbYwc3VyS5xoTRZimzPILiTHTen1FM3qQGXV4PWJ257T+pfQsdnew== 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)(366016)(1800799024)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8CMsnUeyuiY0HFMWw0VI4i2lxzDHP2DBe49hK0S/CFTGxg6oyWFAgV35Z3eNg3d6P6J1pHh+OwMw3fauVk77cMeCCromWlC0djZt/+MhGiYBMlMA1AJJarwkwb53sKJIXQjp/tHrQkEPTh0HE8lkUPqet4wl0T6FGxMm0VqOwHP8m58XzVHJ7M4RWArztWokMp1cHh1mrn4YkhulGm71QIcwIBVza4bjKvV8irE6DSz2OzSjrwvHK8EQMXKh/HgXt43Anww5b7UrP4IPUVlit6QO/rGitJQ+aGWQMOKTL1QZKVS9gH2UqGmFXPBXc6vfOBfXPdkSVM56hlri2fg9GHPv+cUfiYdiURBC69n1VDwi+N8K1489vxu0OLkShqV6Nl2MDqGYey25Dx7MZZu1gedVVsuAhVkuvdNCze4l6ruFiDzTUtw3IWfZkNyWeTlnmU2289xQmWmLNNAfN/3iGJi1AhPpP4xMHxEe1kFZvNy5SAJm9JRnte8rgzDitwA/mHSVnf6rVtmQhf1yq5mBO41WYOstJphfa4bh2/px4i9zq6/5DxpU+vp6oDcFSqTW16tVZVV/pTDVfseIJYLM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a0e4-08dcc59da9eb 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:53.2739 (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: rbJAorJYnatpe+U8KYKJc+rx07TVSnuKbaESB8a5g6dS+jLA40oubBTaKlq54uKdGOByr6Shtv8mjtCGTk49gg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB6055 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 Mon Aug 26 07:06:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 823032 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2072.outbound.protection.outlook.com [40.107.117.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EC6881741; Mon, 26 Aug 2024 07:07:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724656035; cv=fail; b=RZjD2rHzikKrQoEcsg4DJgBY1nltlDx90X+NKjVsoBYU4/qYMg5WQAQCCDEYOj561YmqVCXz6S8uWR4swJkOqX+sjyaLEojdc4Mp6jfD+RcH0YdcSnnQ0HgJQe0D9vK8XJBJEfa19gt+xpdYOdZzyQTWk7i+jAsjc02l2BpKlW4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724656035; c=relaxed/simple; bh=xaj0vT55hYLO1XmYaahwlOflpj5N4nHG7Aje86oWnuI=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=aPdx/Oq5Lt8UgxvOjfIxJcUvS/y9Hh9xfNxR3djb0cAe5jdacDmyNsQ2w6nYGEetHj/NLcRzE3r1AkEjpXrcbfwbDKuv04vc8UXLxA4FPeW0hAVTnzQlgmfTAw9bn/4LwL/XDUaSsv/Jwy2doSr7eoGMweW+75+hT6jU9gdigAs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=UHT17zFb; arc=fail smtp.client-ip=40.107.117.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="UHT17zFb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CF9MW4sE6Zu27BdONibj+oxAdnhBdp8G/SCmQ/R9VLHP5jC0l/DZAn1zM0nnnMMUHZTq8ni41yBnMSd21i5oTB/QcJ8RerZ+M5lRhG87AbjnhJkgSTkI13S0aTfdBEmFxyJuh4a1UY2h4r3CpQJSgLaJjgxbaBB3/kEXSlGKKdsNAFJ+CD2gLdbDoD9q/r+R4VQtL8BIrNKij03RKx7kBUWlYsVoxXKiF8SZ0FDfejRbtQUZRB4lJ/uFxFgk9BSD+ZOPF1NUeLQaqPpcZwZM7+Eplo9D04xghgM7Zjy4DGIka2FsET2Qb/UOZ3MyLE9PpEmOVdKpSchuPYL5BJQo3w== 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=CorwTMLuhosCwzF7YuR3ptqxDHpdpZfCA3AlN1a2eZo=; b=Wah2otBdhC3qS+51smeLjl/Kd0Vp2TPnfM5rUMBjs6uzHvLtMJbbgrVlDe7415vNX/tXAL9dbZ9KHgChlLN2mwZWgfU23MCw8mtXE4Aj/e08rGHfZ4v7dRxrgpOQprZuqGiK6PkS0NpKvzJRYCjDN1ZJotfczutGPIFzkRlKabz+cTjLQEtH0bg46cNd5d6kYBgNz/uKZXP3cD15mzFzUbL5yT1uKhA82sDX+zyq9NVgZEg6Wpx9n/ci6uKHLdaHW8MmPR67Mcpse2Lp7Chx0GKvVBNC2uyUaVHdz5QB0yjkMKB6WkY/3RXqN2WHMdC8c8D0lQqmRv1SQZArRpxSiw== 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=CorwTMLuhosCwzF7YuR3ptqxDHpdpZfCA3AlN1a2eZo=; b=UHT17zFbaptAN5IZ5X6dzCB3CcsWrIwL3Zi60YWFg0xhfmOqhM4z4lNlZ0wMY7ugJunmAzbnH+XBhqJKnguqHa22pEUpOFkRWByKFLjSL6reLQxzj+K8XIyN4PXerxccCmBSUiH9vIRv0QMoxKydWOUPFoH4UF9HR4cWUyZ6Oi9sakGK6ul93rD19U5yVMqGAZka6q1qALyo24ufsaeJ7V158rU4RTqvRjA5Ss0hI/E0cgxk2GVSvfhCQH3kguL1VQIvkbXu0gJ/Pk02k/J5dyualgM0p13rAL7YYHn6qtEhseHSZpGApEVSBiQywNongz7y2P576vT30Rb6vGdoTw== 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 TY0PR06MB5847.apcprd06.prod.outlook.com (2603:1096:400:276::6) 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:07:11 +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:07:10 +0000 From: Lei Liu To: Conor Dooley , Daire McNamara , Bin Liu , Greg Kroah-Hartman , linux-riscv@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Lei Liu Subject: [PATCH v2 4/5] usb: mpfs: Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 15:06:57 +0800 Message-Id: <20240826070658.1933-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2PR01CA0016.apcprd01.prod.exchangelabs.com (2603:1096:4:191::20) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|TY0PR06MB5847:EE_ X-MS-Office365-Filtering-Correlation-Id: cc379384-2897-4692-3a4d-08dcc59db448 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: v+KFbqy+PXK4q1Yrb7mcBK+VWNidlhUpYnDLFJW27dI8UMYLZLWlctRt+T8XAYDbNrj3U8kg3WzoO8A5bNi/w9/GuV0TLv1ODptwEh+rCAa/hXuvyEeVYpB7KPCjvDQG/WDKxna19zDiFJGtl7mVfPl6UW8rE8z+SE6dGwwZ9lhzzGmhXGzHRTduoes8gkX2PqT9vyKMVgmZmgMTVmerCJ3Vr86rmLVqj2TcBYHJn1UbopALl+ruQByvQauco2lGF2kU/akXaH3IKWsP1ko/iJ+k5ay/D8n74POtGw3uEK8e3Kdf+y4E+PJxdFVJZqynsKnGDX9Pj3O3LpT75Nm+/OwM95u3keYgaoHaQbWECaTPAkiijd3g9McJrNW89WWOugx5CAZf6Xq0YKSKD+84/9eW9BHxVRTCpszA/jqYHfqjkir7BBnhlvyPetFmSiR+FlJVeVPhcO2kP1oMNcBjgrz1SS5sqOGPoEyK9ZZnbsdEfz/uYFoj+D1WdoRU6JinIBP2+ZotJaBf5U3OjE3Tjl/A/hq9wOMLiXLssTC1Eep1Q53mI2XrV+VN1WE0UKLDyWt73sJJeezdQGVUKE3JRH75FNFVgaIFXvcl3F4VGYBs1Ns9xRjM7LgSgirbCYoJZ3OTnk90tqnYHIDguxJ3kkttvDNl7Bpq4fggDVn2NW5x1DezJja2cZTv7Xf9luPk6So8S9PBqzvkoOlwcd/8cB73sp0QJ3rxqDKi4j6Y0+GduRyGfVe4aMseosdNF74zaVL/M4j+VscC7DFCSD1ylyvyhfv5e08yzpNFp1QH3wost1XojDRSab2//T3APlTOtplQASFTjL0ZfWLRMfCp0WNOtPgGu+A3+XZNXprOquLrBDrhm0QnPF+vtN1rdbFIzL3n2oZKS7pdJQOMZCf322365Mx4YGKZNEz21I0ESTU6plJzoCxb2AsIrI/J3vhcTMZs7GM4Xal5eu8n2SLLEuJlZxlTUIh9hMDFYPipPGerJqN3zVDs//6xTUZrIHwbjCxSKYUWy84qy2O4iWogYGnN1o6gj1/a5/9zToteZYiCvRCg5zxTvPcX0WT7EALYhRhKhiy9POIJFiVl/f8XlOlqqifLwZpNvC6c1zrqCuB+5GLqURQaitCktBrz4skE0T+RWk4tPHhhcds9P2JzA7WJC2g3FZGDzYn5sgO/bQQx6tGOyl+jCCDyZBwyfX0y0KZV4+J55B1EVADPnyeW7VfC43hq/LGNxpgG5tACYIy2kyENne1IUrUMm5uN4bEIop0gx7kvQ0oxZPAVXX/XfFlLCJEpbldBICDKSdK6pw1X5iNvqgroVGvbcewjDvLWJOh/4L0GAXvaXGmZDhuqHFjtYjwGS4WTNZuJAGrSOEQQVCqZyNE4s/H44QiwSwKvaieDJVY+1FiR0ybvQHWTlw== 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)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4oMeI2pkbSAhk2DxJvbLe1CmXcQRZCi16n6n/SowOPYFzhp6np5E1eXbfoI6YpCWr29kPErKencxcTq5BLlUZrEeoBeG8paOq5WbZmOf6jfL8HiqliT4ODaFlestGz9LVShK8hSwIXUqs0xcDeCAMTljs6YMv8jQk9rCIvSfIHn8pBVigfwkSkfM+WxvAnt+bWmJ9kT0BaZbzsfZeCfdqKnvmWAGNUN7t+PP38Yktpwhl3dUI8fzJi/UxzftmNmg5+fbJlEBrIIJ5IzcXF+QtrK+bQMTIkxQ3vj9iOdKI4eauMlkKne7u/xUK4iDa2K9MS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IILt5rdeSnrc3NKB9l0wsrGbveU/LiP9P04LDTZX1R7ib+n/YriWd3iE0+lkyXH4O2WvNWUC8KoOyn80qwtUIrMmA9fphXYosKWuyKVGNilqCpe90/VKZTFnTmmkVzqTePPWuXqFAxvCQ0YHYAVOXtE9NxLddOSzIxX66LSuGKwDb1zI6uPeuiNhRo2Qqf8ER9dy X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc379384-2897-4692-3a4d-08dcc59db448 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:07:10.7316 (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: VpW4ZYRKgv9BycsRFPDIb2BTbyvhRA3F87qbebMo/zFgKXZJAR942TdVMKNyBJES+vOPJHjltaZz5vuY6aSPew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB5847 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 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..ce6ad65c5fd0 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 Mon Aug 26 07:07:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 822648 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2049.outbound.protection.outlook.com [40.107.255.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0891682488; Mon, 26 Aug 2024 07:07:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724656060; cv=fail; b=UNl9uawGFhh4fNjuCxr98PbES0JJF0WVxNDin6amvOGO2/bhM37j2uhQHflj7KxLtCYigb2KiKNwlcQkntfbEt/rbdx1GX+1tvmLQ6WYXck7igJ7YTWduQRrG1+kBjyHOv5WqEo/1U1ltRH8iHRi05k5Wi592O0eb2+KlNgzKfU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724656060; c=relaxed/simple; bh=/BOW4DzCFLJu0kLBeFbgIos/CbmtXXbW2fDhT1PoM1c=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=Gqm3JlZab55BUBYgDTAyl/86aPVTM/KjFp7yJribm5VYrq2cuh4kOD0ahXCtY5nmaTFSrGioFZHQ2K+x3rPySDMPVS3JNvF7SmoXqFDZVEEZmgSRudbcqLFJgdm2aiNbzTGDo3hryxYP4XEQxNRegt1Tb2xm2+q4BoEt6UJ+/0E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=bBsnFpig; arc=fail smtp.client-ip=40.107.255.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="bBsnFpig" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pvQOWG9xbv1zTsXj5PYgKfsK160yiwBVHiQZbaLSjp+xwWkRU/fz3n53Iyi1T11X256d48yfKy3LrQwaJSmwaM4ScQboOt16mjT7lD0A9kz2IYF46lW5ot0CSA7RSp92EXp0vU2V6lsqvpgEstW4hxScJ9BGFiPlwL7lxq/FUA7OXL/HaIh+UI4pi44enj6ZG/R7CGdOcvnma9XM9RsFugYEsMDHKmZngYUOR3ZvKGJB6KiNbeOdpWrncPnaV2QyBcEedGDg9GETmC2jxDDOAqfesg1xhPiQ+yifhBGJNF+TipAK+5CtaDXEfOMt7e3nvs17ev9yGZoFz8tlTHlk5g== 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=1d5DCDW9Agf3G+YLTYCvIXEtXlu4Ndn4w6lfN196Hdc=; b=syA2tmQWCgtlVocRZXAj6shJLCBEbqZfWCtkI98t9+Wl2YACXBYMpSeuXE32pymN/+dLdbgjV8d+ijJ4m6Thpd+xkDzRhIf5NMtg6yiTCerljBGSRzLy64wlHmVJx1BRqbHMQCX//JuMNVKoZ9JPC1barCIOWhbPeqOH80O4i3/a/O8Lq5Lq0911wrySfgYeiu/ap26ZqACQblUpgpwwnx8ZIGA+3vAD5ypMDa9ip/DyWBZcf31cKU80mYv77+Ty6DNQYNPLKBHDuQl9goqISiifdlCluAqlvJZVY6jmoPrklENZIcwWgARiS2Y92ugfpeCmQsbwI5Q4OkOSLGBySA== 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=1d5DCDW9Agf3G+YLTYCvIXEtXlu4Ndn4w6lfN196Hdc=; b=bBsnFpig/KLTjOHHUiPLxAu0aIl3pnv016vclAOej784H7gMo6HeIwWrBh3TcSSfi/TttYlRlF9Hergyt/KC7e75+ONwnpYDBhmbROafLCNZH0chcr+vfxriQpCGcE2vECqX7OK/N1UmvbajdE1FkEuP0Y+Lz3MQC+mr3bbcdQTpApkG4WjyeHBJFjt0ogQqum28sDJQw7OGLz0sdJ+BIS1DfB+O1eJDiuq89/ptQJZreYhAwUOS/CShlicJeCzUGGjNBoQiG30CM0GrG4b74MvFdS8bFnHa4Q6eTAXogkia8R3X/nGbKYLQN2m4X5h1TRim3w76Q/T//p025Web6A== 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 TY0PR06MB5847.apcprd06.prod.outlook.com (2603:1096:400:276::6) 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:07:36 +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:07:36 +0000 From: Lei Liu To: Bin Liu , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Lei Liu Subject: [PATCH v2 5/5] sb: ux500: Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 15:07:24 +0800 Message-Id: <20240826070725.1953-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TYCP286CA0313.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:38b::8) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|TY0PR06MB5847:EE_ X-MS-Office365-Filtering-Correlation-Id: d6a3557c-fca4-47e3-138c-08dcc59dc339 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: A5f1YQ4fIY41lQscq1p4OMlYmQYcyE+9UBpEVZKE/QVPnoLv5Tia69G12drIiVds7LJegxue+Zut2BThdvk4LLOhJS8wBfAWbJHTjXWGAfzcexyorO6a+GMGk1141hWaf6Bd6mZKJo4d3OVzry25rMS282ThhsKxnth7e1rxiv0m3sm4ImaQRvct30lMEYnTBLXji3W0vvAnAshhrhJUW48/Z84KNTILSYs1yG7IM7Snlx/gJSGScCpDj9xowGK6oWOhZFuzKipPX+EqprAD5NP79yCFNAx1fmd1lkGC0ay/THHnF2xcrCwYmesakETyGHTe4oamioqIkVKQBuk2VcCDHSAs2E3uHSK/zEqkFfKA9nUj8Tmu4xxft3nwggzJQkALjWOMlFvuP7zRCDoHirIqjz87E4Dprkuog7HMIvxa2v/JK/p+z3oyuredNe3gmmIxW3P0fQeDRrXDKT/6ALeuBUBTrIcVuPZRcaCHH+4z/2ffcH83P5SflklKxy8zg7NAmdaVHQ9NujjnOy45wL9fFiwLfhlNdKzdYHsLVV0rDocOla7HJlDNmd9ftvhWdq1szIAGtUAqZ+aGHCHGoxzw4wUKodscloB/PFCEBIu12YbjkMGpkZj7LpXSL/hGCLUjw6GuUcLLFuL7yiAj2qY51sxWvqmT26YaRYE6YDKfpfmHUA0RK8k0t0IijAcKoKah2tt51c5noTI9aBTm2OU2/76cVVLKEQBxbcXwMTAsKSRkihOaW6UebSgWmoNrmLHtljr9aNuxRYiIjgI9yaFYU6tPETEXGKOyM91ox2vkx65z15zv5awsq0nAFpIJ1axlNQDg+YJ/yg47mCFn2ZTpnjoBojogSQTpfqGVSSItwlGOt1ch8hWuE9scv831HkZERfWY+vc38AtTkCyqNITNzzUkyhKg1kAB6eHxWmChaMXcPXbIzouFphgwVt8Jv0RnQ86g3cEGIuGsYQCPfGDYOVaxqHuJ59zS3LQJdtvqPtFHKIvK7bS6ecUIjbanktUBaB1yGB8vNo8dtijeTpuZn4ZpmNVDkp+Ir1hT7KDAO/cON8oH67Bb5c7IVeByVkDXioYwIoaqBKoUENSMh48F/HSJF8t947MSn/28Px95rN07Plhm1Dob2y5FkTkxvZcgImRSjDXPq6mgrAxB9y1Bw+S4pxUDysM9pYF1u8O4lW04mZxDBxWHOwMszqGPCNlUyxFcVTiyKJr8ZwcgYNTqgxZOeB1Pjonee2HR1FQqRIykQcOzgTRCOvqcu7Ga154ijB1LYNOhkOSn3CUSntDFUo4PBVVMmWCsEywQnZR7piFSMJESu9WNJBqslFTblgxPprkmrBLx48SG1axEL6xaT4QHGcbMFJuCl8AFonHUfnZ4Sb05lBMUB2UX1VoUdYUwPstIu9L/c97g4VQdwQ== 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)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xjYZ6WfKHA+TimKFH32BJcMglrz41zmAYyByE692tmhg4DoF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G7ZugS+zxkgMowmOGrRijcd5cXK4EoE4B1zONo62/zar/8dGaJjmRgbzwzasNvBGZgqOXTzmdZLwO7LOwjeJJPxWncUS57d9GAP05OXNUvQWj+qihUSH+BgbBYgpqaglK7v4q2nW7FyoQBADR1b2+Tpl1M6+Xv5YGSqDfsnGO/iBQt0PY41oHXB2xYnMhR03+gJOMff+Ef3cFQ/Q+t3lMq1UiK3ihKuxVlILd/iwc3QV9hWOJGpIs+X8p5VaSUUwry+4U1pMlulglqSkW3pJLAlQ42MADfiHI6qf2QhwoejFSK029b1bFUqGT5wwh0g/+EB4zSEARoxRKocOAT4K0WtEKL12Skc9f5sa1F/QG/sgT6Q9RDxtFDNXU4ZsnWs6jnASkzJdw/mbJoal0b76OvgZL46Pl6sXl5FQ5MOOTcZt8E9nJ2A90zqu5VMihYR1hc3h9eVc+A7uwzgH6cjDFW6 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6a3557c-fca4-47e3-138c-08dcc59dc339 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:07:36.0616 (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: sD2mCVsQ1yvjK96w43/+xpNLYsJjLWcNEXurX8OOmzTL3WtzLGBLu4rlqstqTRs21bQ9tVbR/niSEJdpOtfmUQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB5847 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/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..3be00227a6f0 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