Message ID | 20240821121048.31566-2-liulei.rjpt@vivo.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show
Return-Path: <linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D5378C52D7C for <linux-riscv@archiver.kernel.org>; Wed, 21 Aug 2024 12:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=w4dioiYKcgfzlnlXflPaEAxQtGqqHlevygGpEC2SAf4=; b=44wY1WUA+Q2/Bi vXL80cwp+dldfPaAILeE3Spv3IByinnI/2UaTKpTCH9JcrKwjfA1peMtkq7K+HIVyMZwRdDJ2BXFd I+MGXpEfKCMTOg7WPQxAB6uJLwW6gUpZUvhqqQNVlqC0uCwmPu/l783euiv+bwYrjLKBDVBRKV7YD g2/0ckWGgBvL3G55PtnLHuflLHwceRAW58Di7Sf25kNNH9gWubFIy/+6jE8oMEmSuc4zKlKzQKwaz CfZjuFHwUMMhgjwy90HWKI/jW928nYPgs9EvMhq56ceeUCcOAw6XYt0BXEWXzBzjvIxTb9/6mhuaG rD5Wa/alxH4IFUqFnUwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgkDh-00000008s5a-1dtR; Wed, 21 Aug 2024 12:13:45 +0000 Received: from mail-tyzapc01on20601.outbound.protection.outlook.com ([2a01:111:f403:2011::601] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgkBO-00000008rJM-2uyS; Wed, 21 Aug 2024 12:11:23 +0000 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 <liulei.rjpt@vivo.com> To: Neal Liu <neal_liu@aspeedtech.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@codeconstruct.com.au>, Daniel Mack <daniel@zonque.org>, Haojian Zhuang <haojian.zhuang@gmail.com>, Robert Jarzmik <robert.jarzmik@free.fr>, Conor Dooley <conor.dooley@microchip.com>, Daire McNamara <daire.mcnamara@microchip.com>, Bin Liu <b-liu@ti.com>, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>, Lei Liu <liulei.rjpt@vivo.com>, 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) 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/5wGZlS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Xu6Q9o+PSmDuswsK+/1rtsXR4S7la1+uKWtUkGq/sVnIqahD5alwA45cmwv6PKVwnKIjUIBsVR5e8pX45wwyIz+dgjt6Zs/84DN3EVW4ISl4Ud2ZZFi9+AUYQ7bQ4YBbTOjImWq8IlYhT/QBzJXhd23tmzb89I9EqyQVVggH9Qehrs32Yj6z66ocEKjemaxaJqoze7KkBmy5MYOx4wb0pbgK1YZ294jKTY5fSjNkU5mRx6a3sJD0HltWyVszf25miq0q2vsae0eohq6iKBmgzAyn+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/zrZalBgydblPQsVAx38PENOR8OBaNCO8gHZpAyxEXY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ange-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_051122_761740_3DDFDCB7 X-CRM114-Status: GOOD ( 12.25 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-riscv.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-riscv>, <mailto:linux-riscv-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-riscv/> List-Post: <mailto:linux-riscv@lists.infradead.org> List-Help: <mailto:linux-riscv-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-riscv>, <mailto:linux-riscv-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" <linux-riscv-bounces@lists.infradead.org> Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org |
Series |
usb drivers use devm_clk_get_enabled() helpers
|
expand
|
On Wed, 2024-08-21 at 20:10 +0800, Lei Liu wrote: > 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 <liulei.rjpt@vivo.com> Acked-by: Andrew Jeffery <andrew@codeconstruct.com.au>
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);
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 <liulei.rjpt@vivo.com> --- drivers/usb/gadget/udc/aspeed_udc.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)