From patchwork Wed Aug 21 12:10: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: 13771286 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2050.outbound.protection.outlook.com [40.107.255.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 908E3158D8F; Wed, 21 Aug 2024 12:11:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724242275; cv=fail; b=Ktw/KXY9WfSYlqKn4YtbRXHbfFwrNeLvviWoQvriDeaxeO/avTd7hNo7QxMp4S3rhgfc1ox0jA1lx2Oc26cbO7LjJjTjVYjyeDvjYxseYURUcqcIx0DfhvT8psFDwqLsRChCvwWco7Vj7i6FQf3mUhxxCs0b2aKpLQqoy4iEPsA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724242275; c=relaxed/simple; bh=YVBSjMz4xvwGs2PRVw+m14n4Yy0III8Kgb+kgRG7l0Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=DAQHcN9Bd453qaiEMEtAgTQbbG0hVBGTyhFwFB/5GH3KijLfID/4swq4fuFROSdrb226KAZCJCFR9v1sARrRC0MYIKPEgblWGm7pt0d5gAKj1PXMcoM+DSvRPKrb5hhUjcYF81/X0Dj7nKRytzuwg+oFnC9tTiKPn5C3qpJf5Ew= 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=OoZulL+u; arc=fail smtp.client-ip=40.107.255.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="OoZulL+u" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eIGqMSQI4FtsGeQts0B9orMyMYNvf2MXqmIsbBdiw5QL/hjPURES4rrELABbJSuZGD37hWnIvPk1PCTY3ZhTzk/FWKVqlWZ/K1pB26gUtt2yThV+IY1wQP1ZSgYjOiwMQgYs8BTKaolLCo8iyHD8YMfNw1cBNkrJiXzUQfTlzFAKXRH5Z/HJOgzTahr3Nol8d4K1X/Uk3HCqSbQWRp+YArsGIbwE/rn+2/LwmI0F4WhE+w0qlLbFjleOPNcYLa69tpJ9Tr20DDBWb7X3zHHoS6dAZqD2d1EuGt0vpeQAxijYY1DzuQLEtL8i4XG/8nMHtvW8eholfzYaHmI+jeAIqg== 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=vHN/ogeC7NPigPHNFMwmD+7g+lXjDVzBjR4stMgTzNl4OoOJlbcozGVPNB8KtB8KUJfD3Wdqfc1vpCiQz90Sm581vsoLuEQKR83oi0wU74u3dIQZ17xqztCtlULAo2lD7vXbbPC2cVaWuyIRyrV23si8DEsf/CskKG/bQOjq0jDMpTFnS+FNaFLy8rq/UIh2XaZ94hd8BvhZYUCe1mzE1KsgpZo39ptjOnKEatTHp3p+jlJf5doGh9gT1Ah2nB5ZukN5jA7ojhwrfWtUIVgTTPREUXzHoAxM6AayGJjXu2GF+tGyXPN+su2dPNr3xrqthUmA1EAtZQ32cZ4sspGXcg== 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=OoZulL+uTWumfWc8HzV8MHItsOG5DAfgskbfniYySl1z/eo/5C6HE/52cdGtGQDD/IZEh9F6MZ4RG8Z5JzulXjL0LpSbB5WTOkoP5Q9KZVonHiC0/2E0t2nDNGBs7/nPJGsFJLFSmI9/j2m683f1cHws0bFR3aLopbBZ/qBrtYchEuW56oLS8t7CHfwMyULG702YEb0q+bT8NDjRmALbosxkAsYLWzdXqgUBOL5QPC7fkkhjtB/y76+nNfMz78xwfbJ8jyy0usXdHIL0PuUwUuueypti6RSIzAb20YF5pJAmDkP53XyVjmZL8psF5iFi2LQ3i8pEnSDoVovDlrdCig== 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 JH0PR06MB7128.apcprd06.prod.outlook.com (2603:1096:990:8e::5) 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:09 +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:09 +0000 From: Lei Liu To: Neal Liu , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Conor Dooley , Daire McNamara , Bin Liu , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Lei Liu , 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 1/5] usb: aspeed_udc: Use devm_clk_get_enabled() helpers Date: Wed, 21 Aug 2024 20:10:39 +0800 Message-Id: <20240821121048.31566-2-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) 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_|JH0PR06MB7128:EE_ X-MS-Office365-Filtering-Correlation-Id: a71ba735-f780-4049-fe91-08dcc1da5765 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|52116014|376014|921020|38350700014|41080700001; X-Microsoft-Antispam-Message-Info: YgW+4BWxsATBQCwZ28GjJ9yp+yM0cJJNe0IR2XLv15UNKefH60xFCxdmy0NhG/hir6K4E+KTc1qulfim0/Xb91f/5wGZlSdPKXWNqe2U6OsOA4RMXzKeGzhI0X8b5z2TWB4GirqfDCkeEY0lk6b0//m4HO69KDu7oSG8qwWY585O+OAhYRPQtk3dD8HBe7XO438VAI0thc055N9H5VJGLuqnRu7AVlNrjN8v7ZWFojKlu9rVGZPgiVoSMGevH0j9g1XCw2lkzcU47lIO0Yp9pnYVc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66ocEKjemaxaJqoze7KkBmy5MYOx4wb0pbgK1YZ294jKTY5fSjNkU5mRx6a3sJD0HltWyVszf25miq0q2vsae0eohq6iKBmgzAyn+aijJ 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)(7416014)(52116014)(376014)(921020)(38350700014)(41080700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: h0xa+xf4L1iQ4W0D8b6CW6didjiJeL2U+nkCobc/SiyKvpUnAR7cnU/I7fOJX49OWfwFI7IQmT1NQCcXxN68laGZYxIitmOnG9MaJYMG0lnGzkhZOjYv3+TEXBxO5Gt7eVtjyYXLcZm5G62VWG2mgYkYuF0d9MNIwB1vMBOt1TLZ6pvnT9+pfCl31/gdXvCx1hkZJVu3U/Jaz8LyTiUx2VoD59PnfpA5Rplu6EbILJyvlYxv0MyOZV4DE859GmPO+tcRySJIYO8hMem+cP7tpVmFVgPOt3tAe85rjbcVXXcoGbpql+cPl7INEC38LNPfnI5ftQtVQm1hJo+5YQiFr7ByCE6MfGK8qRPah6g3DRaqjIMUCtS4TJdPG1U8EXxtm2aWN160nQlw6rTriTgU/oc1L1wfG5+ghHQkn94IjqDqO/njSOIrRFCyfcy8FGoehqk4LVIchkyzGTTsZHAsUYKFy7PYu5+Q1JdyO9Z5dhvPYe6yMdxBws+/WGlYx/zrZalBgydblPQsVAx38PENOR8OBaNCO8gHZpAyxEXYqK58b7Zf4igzdYC58awKgaIlq9yxg0rpq2KX1xrADH5NFMEdp3Y/nEWnmuZpKMYAri2jiIenU2l3FpSOR+AVu3EWqPIQWR8BY8Ly9Dab6Vysi8n6s9EKGaZA+H1u5OxJ/lp5PjuH/C/2unVleIZYwPluMmj/Ep5X2CIvElj+snf+XTKJfzY5hKlEvOkGUChhpKrnOKdNaXVOM7v3c0W5dE0Ri6pFwHCo6q139FNA6AE0gZFhLuJy0m4uUWAp7nAP38RBiF7T7gA0LUvv+dWR/XvctGthlJLuVlYJRznXNICW+Bc5bXUfxYQ2egEUy24XPWWCDlz9aBJzW7BqOWStQV/IypO8JCgxnDMf1DJ38W8bsggFOP0zaWyKzMLhkI9ScKSve3oi+EbUuWqDTMoPXhXJ085Xo3bNXw/Qc/cWjlv8r0VH8Xi+PylZaoGj2wPVfjEVas2t29HJIau5uzmjv0+XGPeceCRXIch0aYpJdK8cx1ENTarConiiRe6UDmlo3LUdxoIlWpH4PAiWmAL8om8l2hJVLuUQwfk6i3cNdCW+AEqiqDKt62bgglGcNZYjNBpbMKjF8g/jzikIKlaad2k2bVe9hn+xA4G8fVWPvI0E8BoSjZuBaCesI4tyjbP/bOeB/q8NHeXtHSvQxjsiuE/gb57cX/3KEl0C9fbTqW/2eu23yT8DAWOQpLquhYVX8Q6CYwMzeCqprxjC5wHkXkwcbA3mLc8adMqygLEsGyswYm/2CSSsnnaCuC1UBkjWg0tWxC+WrKSTjFnoDBVUicjJsmWKdPB6EonAgzTT01Ox/G7zmIcA59+Nq5cNL/cO8IzcN4PcUQSlYYGVrDfNOEZn7GBzL7taOCVLb4zUG7goiXVT3atb05oXB1HbD8uZwFvGET/G+tnlDwJ9zR2rTJpXDYTqm8nCidCpyWufGvzCkJ+cxhtYtcd4h00VUy41EiuPsVHbh3ury9Tr/Dpc1Evd8ULayGUN7ESNIkHmsMnQCS5JOheVDNTYb8GAE3BPKmVblBlQo7MTU36mOn0+4wR0 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a71ba735-f780-4049-fe91-08dcc1da5765 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:09.5550 (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: qfcVD8M+Rdf7enup5eShrMsZIcs+ONMRfLlK6OH24CnafequLQ2VguOBzPxlyo6YgWPii9x3vr7qpxdTosHYQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB7128 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 Acked-by: Andrew Jeffery --- 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 Wed Aug 21 12:10:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13771287 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2048.outbound.protection.outlook.com [40.107.255.48]) (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 2A0AD18A94F; Wed, 21 Aug 2024 12:11:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724242280; cv=fail; b=mgc6Lqthqn80vUQnZtdvQE0p+9H8QnJfgYxbNF4hZJhWp8CXjowDsiG+uZff/3AyZZqqOTVc4dVS6Sn9/+GLklsmMnRcY7keAqNiuT5Xc5rFKCM7KF3vtQhua2rPoSwoVAYwZsSaVWmlbVm9p0BLCScwvxYq+edROyKdzrh92I0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724242280; c=relaxed/simple; bh=QbQd0cVebdCg6hOjuyzEtFWQa6gfy+hc/K47uVbCoyA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=P1+8kKZ6XMdNGeNzii0cdZAodkOFUXw812D27OHT7elY9Xo6vNlkgBNCu23UrPHtSSCKhEYFrklAroiDc7Kz+EKhLupxCZMwaf1MZ4Jqu8uIB1ZSI9mG/QmA5DROxYbmTTpTXs6l7Kd5rsISWP+uIj2WUnBowbhRi1k/LZQ8PW4= 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=BYm4nkVw; arc=fail smtp.client-ip=40.107.255.48 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="BYm4nkVw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=b2BH/4odMp5N1Nlt8AQNcS4w3TFfNWMMCSJvh0P8a9qerxOBPHFIL4VQ4fOUQ06P3PRmYK2MZHoJscQPYQ9B6qyYNpTNnsh/XX0WXyudp95b9gNAswf9G4zDMbD3p9g6gP0zsfQ4CWHDTkI4Mt8AhjbAGDUmDMiAFslk3vNN8RDk4NyL+2Zvi+/JP+fe3iR/hxrR4h+sPlu7Qr34/xxdI6g/fgFiN1IpaO+TwzOqaI0FkX0Ds95YQ5SQo/WxUL1KjJuLFfDfLN2z1o43wLiznDQsSb6SKuZfPeaqDiLOdfCkUGdXV15qRlTHSkDcb26lwaTCH90QgpkPjhQfYagptw== 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=bBLc1uGom2+Ec7CsEI6xiLjlWnYrDRNdD7beWn6v33o=; b=ZrCnZB+QqLaIUWSQmUaBwD6BeLVWtxFF5SYPYMUoAy6x0II/mvtRrhymc79zO3wzZ0d0dhxeaxwXHgwe+FpaZG74MFIWhXXLXFaKRLP2tN1jnIWYzrbyB8x9w7Uw1UFYEIbmho/YEM33lDILK0Z3R1cxHMnC/03uhWNqVMrY0uXREqWwgzMvzpjY3Gs7XNfeaaxvkzQzrAWcNmGxuBd3/AqSC8hG/uxA8BqKQeHc9M7oqzwcNHB7y8jM9yYE3nSswKyZ2bWPfG990f45xduxwbrf+3fpx/EG6/HhZ2JvWpiIwQD/u79m2NYGdggpC9m3HT3i0xDrEosiCV7y4DQRsw== 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=bBLc1uGom2+Ec7CsEI6xiLjlWnYrDRNdD7beWn6v33o=; b=BYm4nkVwgHTwFWbc2+e6Zs7UMgkp8nL0mofeCT6tMDu0GqhqorWoPuA5vitDX2VEUgD03uknfJF70uHtF67+GqhoCdEoc6JtdURFeXGG0hYF+pxqmGOveEkrRfv9p/42MxwFp6eTU5KP11sT3Oe0QgJ7rpi19wn8w3l2iYp30Fa3ToB54FGG0OItlVJbxT6T+Y7cnKWDeBQBRVOXcj78j2BtYKW7xuRyS/i4snkILnBEDxDn69YI1IBLKZrQzJe/u3PWZa8eAVbCoCsPGyIRDP3yvB9odSg4AYODbZ84E6rthWuQendNZ/qNgZOFF4fK7jsGD7hRq/4xPMK7pgHqYw== 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 JH0PR06MB7128.apcprd06.prod.outlook.com (2603:1096:990:8e::5) 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:16 +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:16 +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 2/5] usb: pxa27x_udc: Use devm_clk_get_enabled() helpers Date: Wed, 21 Aug 2024 20:10:40 +0800 Message-Id: <20240821121048.31566-3-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) 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_|JH0PR06MB7128:EE_ X-MS-Office365-Filtering-Correlation-Id: a8499f9f-c4d8-46a7-30fc-08dcc1da5b4d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|52116014|376014|921020|38350700014|41080700001; X-Microsoft-Antispam-Message-Info: 7WRG9CcCciQKRe/l1OhZyVkEc7+43XVM6AnuCvl62GCu2aRMrt4tE7tNbQdZCql/vi91xLdU8/3+PxGT+wa3ehUmev6BTufZVY2NEyhG8thxSLYJDNh6yHHm8moB/jrRjRb/eTpBFlqW+3zB5He9rZmt3y+Do/wIemF/6LIktVAGT8hx7eA3D6TO4wclcleT1HJmRAQ+Np6lP6W/tQbLLycYCsCbHvOqIVZtQxCz4Qi+TVQwtaBpJwhcT5KDLVljJCuSrUp7J96RKzkWY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5KfOQ2/kZnGnDtQNU6elw86fwOsD7mQLWCk7J/L68/W4ZxC4nlKcA9QEqLfuc548WkvNWmBr+6dCCNQAmhg0OeFVEKxAIDa8qwYPgJYJFQV/HM6yZg5la150uA0sq 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)(7416014)(52116014)(376014)(921020)(38350700014)(41080700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9fL50Y0CQUpcCPwtF44Kj8BMAd2JeaPowzNTh6JXuC6zBRCOvqa9iG9dlT1oGJpIrhSQyVPLN/bAsnBIb6Lv0WMdZhCtRv8zF0jQlsgvcG4pk439XdS9JGEQmreByfLdQS8dNV470CYK+XBqZUMoHP9/IyyfbVVHjIa7V5DY0z/6uC13ylO9kbsxAFLQeAkRHP15Otm2YnXh5fCyFeVNGa4qGRC11i65wFbvuVycincHNzqaOwTICpBT6Pjh5NrVJekyLbmBEBq7IM3SZ1rtX5hC4WdTMbWlDik7SXAylgTX7qj5iCHinQJkGEKP62SjGg4X1jkqTpjFrEMcT4sq1s+lsONGL5THTPDjRTHoWo4DyFl585Nnuj2zTPZ3x3YajJzZymfQs2md+DpVzPzxTeetOnROb91jbDphibuZqaxEiJROeek5t8ospNxOWpVQqYFRM7kBx7+r/YMczAcWCusu70YzcGrbaJfVv8TTS62IwKOPBHotSlfPD25GVJs1w+5X0WLwRe28xcg8FJbPI2xI8F3aoVjuAHwPiyvyMXxaHyhdd/k7ISqeqwk0ozg0GIUQWq0G95f2hOm+jdhOtzuyGZxRVVpav7XlBsGHBR7pQ7GcSNw3Cby9DzHJ3f848K/N31W+XH912bT6VWRtZiDh+GZwobSPDv2zKKvLKTCwKRSs/mhCEx7QxvVdOW/EeVqhVIJihGR3B4w9AD4ojwvFIx/gbkvcn1NgggPi6JV12ounnkEF/q+9Mrk0uTsIISxnPXPvppLl75ORFq7A5lTgqbHNeM0JIS4vc711JLMnrhwf9R11UmN8Q8CZjzs1m3Vfdsz1w2PPiX2o/GJlX2n7breLlrEzADHR4DrtOApqbF801wizP59TEciTqpXAoWX3ZtIj8H8XHJVYUvfxssHJfXXJQQScSXNQjmjhu3VxJoqm030MT3QxSWAM3EaGJWdgiJN3UBQXAnltH85WZZ1p+6yvLhqhxGfW2vDv8N+12vjyOXbd7velk4N/qrbJu9pC8CdFNYw0lCLQeIEH0L/tSN3bBrCUzEpTvH48QJjD+u9rM12/ZY95SteVwRFmMmVCcvnbuhRavWJ5f6m8J2UJQmoiniu6S1qQnEUdM0O6+ma+e8kcsuyWp5cNO+LL4QJSQDB0gqqZ/JPbHTP1ZxALoAmWapBKQfPz9yytH6zzUIo7pLtDSzSt0aBWcNOR4/9Ka8zKsM/RNpMlwFaxqIAYfgFS5cwG1BFyS3DHRoovVvupgR4w96H9E0J17vsTY1N6heNCGnhcagID3+D2DrbRRQcNchpnT89Y8dsphS6UONHk1u6F2+2fKBhjOydl9UaQLnas86j2vlUVRDU6kG08WVsJ6fTbCC/2QLkyIYgOq2EDcbZrdJCOMmRMdnc3fj6qMaPhedrP7mXAOXvuuTU3fiVNpzKQiNBPogvCLQd30YtrQ8cdrdRFjio5EVFHE0cTAQBjSH7H1WKVb2fCK1VfpgmYUdRlfLUIJa/zq2xadX1SddnGFEWO70Ck2FJfGZEOxSmRt7lxo1pW35h8UOjoqQHAFEh4GSAuZAeCxg0uOkVr4YfoDF40eYqgzitE X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8499f9f-c4d8-46a7-30fc-08dcc1da5b4d 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:16.1087 (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: GJTKQUcd7Sq8UMJHMpp91olaq6Z2dzT8ME8uJxBdl2+usresG5qzHs3WL2pfEvds7Yz2v0+4ylkfpT0bjnYKsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB7128 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/pxa27x_udc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c index 1a6317e4b2a3..6e99e75f1acb 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -2398,14 +2398,10 @@ static int pxa_udc_probe(struct platform_device *pdev) if (udc->gpiod) gpiod_direction_output(udc->gpiod, 0); - udc->clk = devm_clk_get(&pdev->dev, NULL); + udc->clk = clk_prepare_enable(&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 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: 13771288 Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11010045.outbound.protection.outlook.com [52.101.128.45]) (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 30B0A1D1317; Wed, 21 Aug 2024 12:11:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.128.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724242291; cv=fail; b=iD/2kf3Ow5QyTlzsZ1JmJIgtD/rKehDbgPaXFPFLHCX5CxodaX5mrTv/insiP0WtWEdUsmcOCkG2Rsn5Z+oSXUrA41eUrOk7y7h6wkVfNqNfqPt/3yWspJNu6wdWFPtYnR5hrN2mlweCCJFkfpSZr/M8N+Z/VRO/8YyU4Gpr4Kc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724242291; c=relaxed/simple; bh=4JEh5659lE4oCzyGydPMyjW1bqFusCVtsG62nasmUeo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Z7U5MJoMhUjsN0dsTY2sYWr1R4eYqlldPXC1n+W+Zk5UV7awV7qfyBqWIaS3sztwNMxFIr6ItdiUyAm9gFfUTYTPDIyq/GF1WyLEh6/0LbSmvxalh4mt/6CM+u6Bdn+0dF2j4AFfsSMJt9R9qoISyxi+jM2In5Q6fMcYZ29cUG4= 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=pfOYb3OH; arc=fail smtp.client-ip=52.101.128.45 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="pfOYb3OH" 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) 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_|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/ox3KuGBPTPCdvUycrGXWHf3XmozhB31JrAqkX0ia9Kwg2P+B5MUaXGGbSe/JUyri1eAmFh8cdV5c1voy9bV/JuwDqgyNO2upKMjNKa1s0ttTN3q6tNZ6JnzdL+KrABIpFD9KYdaGMEteV/ep84QW+O9HSwQ8gn56mgESxkHaT80QmzebrhXqKJIiaZeFR/j9YFULIr7PeNc2NkuVr5vOYfs05QqYaeFWwQFAw1YVjzgnqjCk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FS:(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 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 Wed Aug 21 12:10:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13771289 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2088.outbound.protection.outlook.com [40.107.117.88]) (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 AA1A91D1317; Wed, 21 Aug 2024 12:11:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724242299; cv=fail; b=ARB1z6JrYeMhcsCcp4UDjCskB664symUUlR82BztrUOAdP0e1A/4lRK250XxAdufZpGHHaYBcFpe/ykUVNmzX8sfChWOvlCEYicBHgobrt0xEHhrbzIK0eqDZI2LmAfwHC890P1qP7IM00Yey5wJIKnSTvuwc7qphNqu71RdpYM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724242299; c=relaxed/simple; bh=ezbemOPagKdSPF8hynV9cV5A8MPYmNQytEx6q4svV0Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=HdKb9oLemDdMlJL4V+DOWbYkBc3jYAtm/3D+p0T7jJKouEmHrPUnwaRQ8hYXn7PhzZSMNFxqCrUbqqSfG+RG+RmaAMN85PczlkVT5CVTQHMvoF3n+c6kctlaE5nP8ezQ1XUhX2ZsPm1GXe1hYetZzIWa+6N21CEN6rTaJ1N7nIg= 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=Fb5vbOLm; arc=fail smtp.client-ip=40.107.117.88 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="Fb5vbOLm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VWn8B65voyh3hNIf/TReIGjFqMc1hkEMke5msiVy5fXKjEt4FE1okyk0vKGbsBSIscTT0SXykrFBRhlux/vGhiHss2X8Ua1Yp3MJHXKXrwnEM0wRVOtM0c22ZGY+b6bN6E+BGHMhCJ29MDi0AMhC4Dys22uCxJKHJQOibKFyp0kXgjhqr1SklWFDF0JlsT7AusjxjfUBza1wYNRovYueZoyWDsBekxJbj0AMiBwvHjMz4IQJI0LXv7y3M7OVZzTiH6QRXZrLsx53Rg1wgqXgB3DQBUfSuJkIE0BFPT8G3nfyYOkb4aKNCGx2Cz8CWGvPDslKnY1T3LGgjKZ4753o2g== 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=dsWSeDLZchiIY6ePE2w9Udp0YVknhkAQDbpJe39jeVY=; b=B9Q+KTNAxmPgK6aEx8e2u6lxaMEyguP/JTPWn5J2CR0/dRN8e9lgPBjBEe0CKsSLdA9XmbWs+fl6ouSa+mKjkF3U154gRRDGpOCo3dSXr97Xp9xTUBdOk8ee4uJIUxNjU6I1XA575jDLed3mrZyyIUtGW5JoNNNtW43zbYQr45LUIidxUnTr8xUYDg59Z58vpNn8XSY39lqlkr8TdDhXPtoG6m/Ch2BN0ZtTqhmqTiNaK9xFeAyl6Wb7D7F35jwFVPU4uZoEK1rpQvjTbzXt3cQ9cguyhiInDQCFLzWiXOuuE+n582PmK+9ahcwKdcslsSvMHQAaftlVkiUK/O12qg== 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=dsWSeDLZchiIY6ePE2w9Udp0YVknhkAQDbpJe39jeVY=; b=Fb5vbOLmNBUy7UsoIbHx6n9EY2O+0MxJ8k5eNIqt73DaI+fHQI7Cqqbv0lSfw37trbiVR5Y/+l/1r2AxKZuYRZB+wj1FWMGrPLt79+wrgziRwiJYmLnlv/5FtVXepIlRBQCP2fam3wSxjiF7kEWyxVkZnJcme7yT55P8U0IoIpmawoo1bZ/efOsecxEFiK0zhVK4X1xMX/9y92MInFeuPn6rJa/dCkmvaP5/Z1v2B+vb2VFm0lCjyBGhreDhd2q+AeeSAxf99yJUXw8JCVawz+mxO6navpk9IQ6qNInr+hVOzmtkMHjLaNRkjm6kq44tzUzzMqZnyXkEfONVncKigQ== 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 JH0PR06MB7128.apcprd06.prod.outlook.com (2603:1096:990:8e::5) 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: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%4]) with mapi id 15.20.7875.023; Wed, 21 Aug 2024 12:11:35 +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 4/5] usb: mpfs: Use devm_clk_get_enabled() helpers Date: Wed, 21 Aug 2024 20:10:42 +0800 Message-Id: <20240821121048.31566-5-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) 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_|JH0PR06MB7128:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c75f13a-b1fb-4630-6566-08dcc1da668e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|52116014|376014|921020|38350700014|41080700001; X-Microsoft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VUiPCosDZgpRUpn0sxQeDfhKYLBYLRwrA5qoEQpxbjCE0jfjzZD9bZKGU10oSmbkuhU1C9p6PPQp+cU1a+5M602MKts0ecKs1CkEltqJ4M7MuvG82/+UFK9uI/3exrqn46K4rWnh+MUkl3ijJ4JrlShSBfF9pYcfkgl82bJdZXTQxFtKTfaad4yqqJ/wKWxpDfa96zhmXbPbn8yuRhbv0vYkM6TdnQHG5pyj/D5/tflwN4fGLH+Mp3M/MDcBfNec5GECkUhmI6lcgdUxskIY4vnJLJQWHimDWiXMh4eno3XcQ8CDW20XpN7Kf7pMfRw0csfiW2wUwSRnDAbzxpSoookjSwW6fAoK2iUAsp3RLrbzrokkQlplVTM7HhPYUKSRhW0qXtCMPxWZUQZYzLiZVPkMlD2Mt 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)(7416014)(52116014)(376014)(921020)(38350700014)(41080700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B7rw34+ly8UBlm4Zx90hT82dUiyHQbGxzy6DvMt1ifwOBXgG9URZtqJUWKSiHwFD4gSVoqB4JHGCJ47mBxYvITjqK5OKbNVWHw0lm/9w3m3Yi70w7wTHeO87hGVcamLeQb9qgmV4OjclFzV6xZm+rtfY6TYiZthSfUxqN9WP9vK/Bl6I2MALqA72rdvdl4jaHncFbPZjjC149GFwdyx+jY+/11NPJboziCPoLtIJLsh8ojnrHbpYAH/n8i58w6UINttj0khuLdfCCcAA80TaVA/+Vskqe5fQ+oARKFRai75mFws5HhaDS9OeyqLBuJjE4/bm6a7+qmAvRGYAbRNfOVrBDfRWJ1sTr+PQEgoPYlIb3imD4Qgo4P2pkQdoVQxf21Jk0RTnp3fBpgVpWo0WTS9Uo2SbVwcLvudYYyV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/ktKdmgBo46ISiRg48afLdkYdxYzgyd2OATHHH4hHoghPlOf9Zv7oIDHqd8WKDZE5jpGgoPn5ndo4ZQpjkv24BhQxAor3/fA0xqryTSksd56R3u1pNiI X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c75f13a-b1fb-4630-6566-08dcc1da668e 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:34.9206 (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: Ntxx0EBxIUiEERee1aCnlqRW/GQ7BFw5hwMoSFe0zI0mvTaKfng3UJAvMuBRGZ3Y8DGsW13m70YQvTf1Y6OsqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB7128 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 Acked-by: Conor Dooley --- drivers/usb/musb/mpfs.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c index 29c7e5cdb230..06faf5ab22e6 100644 --- a/drivers/usb/musb/mpfs.c +++ b/drivers/usb/musb/mpfs.c @@ -159,19 +159,13 @@ static int mpfs_probe(struct platform_device *pdev) return -ENOMEM; } - clk = devm_clk_get(&pdev->dev, NULL); + clk = devm_clk_get_enable(&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 Wed Aug 21 12:10:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13771290 Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11010010.outbound.protection.outlook.com [52.101.128.10]) (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 DC1E91531D9; Wed, 21 Aug 2024 12:11:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.128.10 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724242310; cv=fail; b=fpKn42PshBQsnsagVFbR7EXsGKGce6u0ruNDvVBQKbUDGOolJ7dp1pTG+n+4t7NZvX6Ww88+pDHKBHhJ9AnvhqIAUuzmM267albkU/rPMe5vOkyTfLAhCantUeUA3mZdGhqa+fcpyBcBFKRWNNT6KsLN7G0WWHf3ea6VKqB4IOg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724242310; c=relaxed/simple; bh=fGZ6zlJJOxFZIIjCCESUTydWXH+oyDtX7zal4/ijdjI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=AqIDro8O4nUovwL2MjwOvIbAsm9YpNfYMW5XbROjKfsghsLEdjI4VbpfmHHhzUoW9h6clxVDKvwZS1Fc/LgkhgMD+dH79dZ4jHKmv7gZsm4qxeRaHAn0MLTCqQuiagIoQRRyFTvemcM2M+wq2f0naSL5hi3chwN1uEtf3Wne4Fg= 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=SZrGqbuf; arc=fail smtp.client-ip=52.101.128.10 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="SZrGqbuf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vc1/QBXe6oQiSKNiOSxtV31B84jLxxp6TKvCqHSj5l6LUTwZLGhU1L8FSIF5nuVTEUC4sM+i3gYcnxkqd7kxSGLWOGs/Bz4i2V8l7hqWGwy6BtbuHwVTdIgJ6YVZb7X3udJx1fJ3AcaK+uFE95syT0jKfEIfgJVuy3CpxG7ZNJBPcRvIlbEbpGcn6jUDQXMch07MEXTu7DugQOnfXEkyMVAIOCsi6jQBe3MQeZXlQy7o7iu1k6OJkVKWXoYw/r4pL72hOJ075nKZz2n2jLJEwv5Cue6JqiWvOIeZ7MMXOzBl6bQAev9IIn3qArTQcjpdrMFpOgbqEOgsaMuN5Hh7KQ== 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=hr9lUsUOL5FatKa34vJPp7XDyXAr3LjTXLog6sd0XVk=; b=YW95F2HkIbVXuPhfgMjoIxaa8hBds61akX8I41WRM6vTxov8t2jlI/sr1XZYmKMFkmvfsbLDO3Gynl6rlqJJKl6BTt+iB0k4SmSvnjmwXDF3xRm8CWV8HOeikw2jq5BZ2DLWvEhxYlmMHMkj+zAq9gwu32jtRtAtjUZXpPk2dKlnqN/V3rjkp50Ki+WClX7IRtgaZz9MijGETTwCcwjFjFdaJrVLBzcwit+ctZPUQHI3H03kRa0Y/8OHJA30zfJcFT+o5WNaa1Z1X3C7BFw9rPkITJWdw7Juop6BQNJKWse1cSFdUcJaQpTyw94+VmS4BKMj8HlkdYh3cjhnEBtoZA== 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=hr9lUsUOL5FatKa34vJPp7XDyXAr3LjTXLog6sd0XVk=; b=SZrGqbuffy/nVZMIoPf9Trbkzz08PfizSFmnSI5oa7ibV4oINKT/YYBDBPpjndxG31g5F49xw2QbjiZafxbQLWRZVW713KiZPZJ5BrauW497xy7zK+KAmrudrRnjTbljXdxRWLNpIx0spJsyQ2gyZGh0eMnLZ87SskdK0wyjv5Gjj4NX3OtGj/fZ0gtof2iJH4OcWvxxOPplVIxapBy7xjc0pOxUSf2IVt3PoafgS4iCbLPfT7p3lZ+grD1FHI/AA13d0lTCgGEUpwuV3DG1EzX5bECqElKDq9m9GhN5QYgvAl2ndaLf3cFvZaq3TL2IeDy50kkPwOgHUiPBsCouTQ== 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:43 +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:43 +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 5/5] usb: ux500: Use devm_clk_get_enabled() helpers Date: Wed, 21 Aug 2024 20:10:43 +0800 Message-Id: <20240821121048.31566-6-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) 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_|SEZPR06MB5667:EE_ X-MS-Office365-Filtering-Correlation-Id: a6ddf385-d6f2-486f-c42e-08dcc1da6bb5 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: 696MO/WVQtxEfg78n1QlffVBNcABEXvumbU+j+ngDD1/KGrMkVlTpC7J6F49QsngrYK6BtAf8lt32xfrb2d4mFTRmI0MoT2Bc0ERHF3t+JBSs9iwwgX4fCgW2n5iaIcbTkUgZJUbmxPi7cUStO77V/4gwCHvQ9oBirU2AGedBY36OSw9evSjuozw5dhcWupDgap6LnS4eyY/B5CVEdC7iX05WMDarBd902zQ5B7JihqLQKalX1QY3eiiZq+ro4pFzCA/IKTee4pqAoQi+z5R3odA0y21DNLhnEb/3C1LtC/b5ZWE684cTQEbmpokkWnsq8+w17+7ReDIh/tQslNzOTmx5rtRtogRq6Ndk9OsuwHNbytUShEXMNnsdl6eYpNqmigof9fRO/HKLl0bZveQ4dIQdB4mhs0e2OlbGambsv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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: hg32QiKcC9kdOioPCQm/oq7phMBuZ3WB2FD34djLIRHmIEoxVmEOTmhawK0C0Hu9R3sMhsvXeF0iXG8rsrDmvwH7zj1hYiP1EDvRBVZ+7Zsqy/h5+JDNGz4WM0JoDAYSmQ94+F5rj/siUjK1gJVWQ0OnnPpAKugFyT6oxMdGsYdQGOKdole0Fmd3uXXl+We8u/L+NNkBf/qOfvJFiW89M4fHgS+058r1BOhV0BlVGxPBYBLurZYoBVUyliDLwjCpYAEi1Kphd9LubZBhGp/Hq7cpzhoFFmdW5JYEw0w6rmqZz2+3xX7yFvu+r0/qB7IkWKOiy8CC3wb2Lwrey1Qd/H2ypZAJpca87Kr7WMBdl/EDpaC8FV44aDtne4OWejAGUqFw0GKqLQ4BJAwkeCgLNGapPubX9hVHCtTX034zOc/A6ceJkAwMBD2QGXPG5TPCDTAF4gACq08viuPQEvTneT4BPZQC0a2uoMaHB6kf7Ocq8Sve9XaPXJ2+jhNwWJwtODn3J/jWoIJPtpq9ooN4i7M8VkFh/HjMi830pZKhVi6GakFCujlpP4kw59lNgq/wmhBB7y1TyGAVZy+ZqNBSo81UrJ1DhjOEZazMFKkWfshp1JleXPzq0teyLPwbkQKNWNoFu6+fwdw/pXZgQXqnI1R23kltGI4DP20FwvqI7aUsfmsKaMLIE70sZziPIIgTo2BiJwd+L2Y8hyaZ2K1lL3MP6YUM71Y3jLK+8CBesdbyMf7fggasa6oyUz/UvPxTYrTU5TM9wc0MiD+e3ClVFtepN5EVuo3N1UF7yVxgGj86MUhWuZM9D8cdQqOKnfyzAIEdVKdVZCDWsKJGZAt2dABmr/YiNHeCqY/xxTT8dNDCi7pBZFAL7ZxHl0z/r1wfnxrmb4BbDTcn48wWrNwLEbYAbYO7l/CQXq3byz9dQDmBbAD7Pl5uYcTD6ksnv6+Nkm+Xyyx6OqwNOXL29muFPqi6mU+6r4gFVSSnECmI+RmNHN/fX3gbWnKdi9/lUak/Q3Ra5TsCEMfEiiNkdB/x6OnigGK7CUdxr+cr63wGxAiKxehbgS/1s/FHKubiVJlkg9GDOkOUC/H+eOaGvAjsMjVRrhAGoY4AjOLosE/HQBMwkYq/kRAEQuLJUoZkf6Lw/vgymcIzy+D0+MRDRqBH6Tc/naEtxYuuR55K5ZyLxYBR8dubVm2POkntKgMfVhDe/pKabmquF/HpQVmmHDaIFLCgxYL9Eh7/mWmkJPvhcnFWMkAH4YV3e3s7je4ZvvuTLT90240O5N1Q54IOilfTIRoAmzvewHeOGy+DNtryVpOPCy2hFJ5IZTCsDGKDltd8SgUGfOPUCoWDodoVo0pBKznvl7xSs/39X49GjZnJaKClY3G6Hruzz2lLrjUDsGpdg8fVHIagfFMZiqQ595cIFmT78PSjTaMvakZQy85HXpFJrBK057Zu1IxQTG5BBSVGx1Z6ae/jeLpKCDljm28X3OYPKFYJ2cqGWP+QWdYuo4ggUzA3nCPq3vU1s7cqKH5uovEe1Yuo/CIl/1iwUXUeJnuUFSTt2KwBGpogQzfszIij1S40ZNqIVZjp/zvXnnZO X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6ddf385-d6f2-486f-c42e-08dcc1da6bb5 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:43.5801 (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: 7En1z/iJdBdBoxS7EU6Ga9CUDZLSsNVTSSetRUu1g++2hPH4/8ys4RK0jTNP1XiKQHsfRgErpBsTm+hSbHlFdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB5667 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/musb/ux500.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index c8d9d2a1d2f0..51ce67678c0c 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c @@ -246,19 +246,13 @@ static int ux500_probe(struct platform_device *pdev) goto err0; } - clk = devm_clk_get(&pdev->dev, NULL); + clk = clk_prepare_enable(&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