From patchwork Mon Aug 26 11:31: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: 823007 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2087.outbound.protection.outlook.com [40.107.215.87]) (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 D6835140E37; Mon, 26 Aug 2024 11:32:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724671948; cv=fail; b=sEspU2HA6HzklMHFGHGNFaUw1FAd3UxnX+QVhUXBFhueUWaRKPCs0QV0PrkLochq2rfLB64CLaZLMtBpvy22u8kCSB8xC7DK77FkMgm9PxiL3giET6oY3PovkEQVG4iuVfS5/Kx5WDrEjaGrlVggQLU3XY8QwnXic92YJrRBSnE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724671948; c=relaxed/simple; bh=wMm/oQM7P0LkblRhoyx+iiXckizejswqoVP1NOs3Gcs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=TjCmJSWkAV0w4ZS7Yx+U/1Fm1DCB2EnCw+feV8uALrSZeihPz1FnH9k0xZQAfnc1HNpi1/KTJgd7A7y2PcDAOySgcOa1shaT12Ee6c1w5lkbE7eZerJmHUlfFUU24s7kt62HwQUyTX2IKrfDVcRjNejEQ3ympV9qKF3Nz3kL0Qs= 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=DoOj3zjh; arc=fail smtp.client-ip=40.107.215.87 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="DoOj3zjh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kPopCI9FhjERPH/YEqcf39RhlmLvpLOvTgglZzQDGFfr6ENMYTURHDArDPTgtS5HW0xhBCYHYEnN64qkqEDomzXeRgAkI+4r4UEZ2Xp4lx+/jTnNF8K13Dhk0FUbZS1TwqLrwRN0GwOr04Ahio7AhTTqwTi7cyx5swU0ZOel0R5LwfAbBW9V7fammmYgrUiIkwFrlNiRi6+3FokOwHVTj/2BrkijNNfTGzCQyEEqjdYv2HEAkGb4OxymjSuZzzLc6ep0h3FIjMPXlo6LMxaON91PnN8pNO93gSlmJfNm7mWqSCiff336h7p2yZH4zKZZ8/J/JcX35YFgmGdWYcHFNA== 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=SuRyEXqBmwxTsibF/YQbovWPMiCujuWu93lLiT/1iTo=; b=OWZSKxLT11jwe0rzQhlqiSElIgESGvwgE15qgSQefEH4HI8E0UxYIjn7R7QHP5yTGbU94qIxK6NLdDyiPGk5r1ZvF+vc/PiuY8TLJPVhUY6ip/JUTDCvJo4+4ksoQV3qlFtD3MnCEmIZmQOndLPFq0OZmI2ZSOTR0ku9aqJiBitENa/kagpVvCQn5FeRVdyoldy0qvxjti2PegQk4rITgePqgrCYlDL14029pSgdeUFERQmI2U8Iw9cB3yWqF+8hr1ycA3bzv76dXURcoFOTF9L0WzQXnavKBWRjz52As+BZQvu/pZGtE4mUv9QrdrWzJ1b1DdaSGOVZIWY7Hhrcgw== 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=SuRyEXqBmwxTsibF/YQbovWPMiCujuWu93lLiT/1iTo=; b=DoOj3zjhu1D3z6HPJ+InlM7ftysF/rh6h0KxdVojp7zgn0aJWWwxwmQPbjh0Q8sPEH/JIKN6IEL6xb5VkBYmVsjsX7GnQQfXnCGbjOedoXE/bMrzsuDe0NQmBM338nABk/3XkT81SYSZoXzwFpuD6ypxq7jZ4myZ96sU0ZPrtO/5RISEVwAIUDdl/lc74Am4jh/+nk5BDwi+jeM1QVqzAflL17aYbf3ZBgczbb9gCBPYYy/9J3VaOMXVJKSG/+alph+L1Z0WpkuF3VOxOTjHTUhOr/1Zkkhsmc9j6aVpev2UXmQQPWv2I0i8/PLCB2Rz7P5WTGf3pi1eOxT/A2DcOg== 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 TYZPR06MB6466.apcprd06.prod.outlook.com (2603:1096:400:45d::7) 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 11:32:22 +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 11:32:22 +0000 From: Lei Liu To: Paul Cercueil , Greg Kroah-Hartman , Jiri Slaby , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: opensource.kernel@vivo.com, Lei Liu Subject: [PATCH v2 1/5] tty: 8250_ingenic: Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 19:31:57 +0800 Message-Id: <20240826113158.7280-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240826112933.7249-1-liulei.rjpt@vivo.com> References: <20240826112933.7249-1-liulei.rjpt@vivo.com> X-ClientProxiedBy: SG2PR04CA0179.apcprd04.prod.outlook.com (2603:1096:4:14::17) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|TYZPR06MB6466:EE_ X-MS-Office365-Filtering-Correlation-Id: f0af154e-a901-41b4-b84d-08dcc5c2c091 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: U/OJhCvve23H0hYIC2ChVpxWLvE69scql18KqoQxUk/TEZaMEseLT8dat+l+5TCxQhJBAxR+EGc6Y2cs3mRX5U7g/5d7RfXykZcTMjOKiXE0bM3K7Ck5veMSi2xk1tDGvkbxFZOzSIHmj3DNCKaXcqeJR6YHWqSyhbdJa9V8FfbzRAqLdcLxfXfFMbosp7JUbJ/HMhrAqooOm7khaiTXojq76c7mNCnwY454ulxm5rijwDEupuY/9a5B98h3VEcd2UR/W/8uQg0u8eyVBuVMq0fe1kpqaAVw9SwPJ8kxvfy9aGm7YUd8NOIB/oyox/Jmmr6GHgvVtiCjIWPxbyr4fpJPBM/t0gU6eJtwPA1MB8fF/m4gwPaHWZlEZu2Vl6i457ffn+be8Bn9Evt6DIuY3gOmb1YABNkPUepMzixT4W1VZ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ZPR06MB5624.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JL7Aj5y/+gpcOlnSQOPUQ2skVgr565IV294MC4nruaAavKeYs/8cjj1xtgHz1P/m6ipiZh8D2ecqi4NNAZW8OvL6f+vFocmxokvNzYF8yZ6/Cen3fnLwgDxZhsJPw7i548rjtTREkBHM5ac0e+k4X5hRgQuLOcVT82o5+chB1exlRqsZi2I08cq6qSLw8BUx82cqJUbWUCDjzVkBCAjZbRpY2AHfHIghg+9Uhf7R6f+b3SONDqc/pshOy4PSHdd/U6qfBgvRqqU/be3NO3Pvm+VpAF/9ED1LV0tnPw+7t2ejJmrvVH9XPnqzaSAjLK3EFLMPylW54c2DWWLTmgMoxH3Q1e4NEMOPhevaeLT0dxjtZGLYQjd+lMn3eypip6b2EnSP8r36SqD4Cb9/X+qN96Ka+a0DEAHHKiDSg4IDKBRRbZgwJKvBVM/gWayp1wPq72Q/JEtF+PAbYbX853FR2FB17TaNj/mGq4b8ZpplYQdNefZLCPaUgZztb8Agln0zf6C3kRUcuzLQXEc6wW5CQar0ypQkEOgyltaApq5MDKhy+PCcOBnNq3madxIqEfBkq9QXoYl36ChF5gwMxE1s6QYv2epbsMqJ6AN6mo2kqTFvl0fp0IQET073rMe6EFqVQZRUGub8Q34oBTJ0nQgeq+lWFPtp0rkHCPTu5jb7YmB6ur73Ji95LiQyUjt1naU655lQCEblWEKyNylCgVlf0aNwGHI9COPOX7xTojBgTl2O2ceJ7zJc52Bl+hMxOLtBV1LoKcVzOwzjh2dax0aWczQURYcQBtJkfED+lkZoPkeMTd9Qx5ui/3hDK9A2W3/FUJ2RpISmUrjJfzgE9j3tBYxmLWnA5tF6N1GqEXcyA/JexayYjrXofRdEJFt6k+g2kMGCivxx1v0lSreWQxFdAo7d9fCLvjHMV55v9CBEXMsERq9uAqt8iRxeRrHksfiNTFgSUo4c7Hqo9Ytn13E8xaNUkea6t5t4vp1TsttXQLXz6bcHQwA6GGIkqqDeCzfync1VfyqPGBUS10JKBtUYTek0WmdAGf1EZUfDhPzHDO/EReQRTr9aOGyYL+cR+Ev4OrZ3kJvdPGlkY9bi9OSxqknrW7XPhVZW2zhQKe1N2YNOIsL/LVkmBTu3F8SYx8rZgnL4pcDKkFDpA+D58Vx/mbxAB611C0Bv36QB/g5jeTISwIFjF1YnlHJ4hGfxc84TR+s3/pTRKPLQprZXSNaC/WdoJnbeEKVenSinoD20/aypTwNwnM9oB8C55rod4rLyujtl7aNx0QiBQ302lfBuJ/TLVGPdo13PsX4A9ZujIT+cbhdKQkL9k4MYBHwhHoC+xoORIMCITvALwdvRLI2Q/lL32r6aWAKN2Xhk+j+IFqFmIVesMEDJ0bxcXSb+oE178dNQSEANTQC15mKRs/P6qYaoYIYjbV72qIdjV5obEO0UUpwZKWbFKEC0brxh1mQA3R0dTwsxJA+Es7e1mI3DexwDZzWEWuhDFP+wtBdZo9VoLjbd6NfwsO701k2fbX2gQ/kleLxgSngfiIU2wsUAwAUASh4dOztCJuP1CbZYcELHhcs+6kXI8hBrEU/ipTO0 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0af154e-a901-41b4-b84d-08dcc5c2c091 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5624.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 11:32:22.6728 (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: g9nui62tK9j2qTXJ6xPpZTiykMWtPeTsr2iz3mTP+h2aQjs9AoM0e2KLH1LTssAGBMZ3KjtJOrzbY7x363oc9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6466 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 changes 1.8250_ingenic modification directly uses return data->line Signed-off-by: Lei Liu --- drivers/tty/serial/8250/8250_ingenic.c | 27 +++----------------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c index a2783e38a2e3..b2b7f784aa45 100644 --- a/drivers/tty/serial/8250/8250_ingenic.c +++ b/drivers/tty/serial/8250/8250_ingenic.c @@ -274,44 +274,25 @@ static int ingenic_uart_probe(struct platform_device *pdev) if (!uart.port.membase) return -ENOMEM; - data->clk_module = devm_clk_get(&pdev->dev, "module"); + data->clk_module = devm_clk_get_enabled(&pdev->dev, "module"); if (IS_ERR(data->clk_module)) return dev_err_probe(&pdev->dev, PTR_ERR(data->clk_module), "unable to get module clock\n"); - data->clk_baud = devm_clk_get(&pdev->dev, "baud"); + data->clk_baud = devm_clk_get_enabled(&pdev->dev, "baud"); if (IS_ERR(data->clk_baud)) return dev_err_probe(&pdev->dev, PTR_ERR(data->clk_baud), "unable to get baud clock\n"); - err = clk_prepare_enable(data->clk_module); - if (err) { - dev_err(&pdev->dev, "could not enable module clock: %d\n", err); - goto out; - } - - err = clk_prepare_enable(data->clk_baud); - if (err) { - dev_err(&pdev->dev, "could not enable baud clock: %d\n", err); - goto out_disable_moduleclk; - } uart.port.uartclk = clk_get_rate(data->clk_baud); data->line = serial8250_register_8250_port(&uart); if (data->line < 0) { - err = data->line; - goto out_disable_baudclk; + return data->line; } platform_set_drvdata(pdev, data); return 0; - -out_disable_baudclk: - clk_disable_unprepare(data->clk_baud); -out_disable_moduleclk: - clk_disable_unprepare(data->clk_module); -out: - return err; } static void ingenic_uart_remove(struct platform_device *pdev) @@ -319,8 +300,6 @@ static void ingenic_uart_remove(struct platform_device *pdev) struct ingenic_uart_data *data = platform_get_drvdata(pdev); serial8250_unregister_port(data->line); - clk_disable_unprepare(data->clk_module); - clk_disable_unprepare(data->clk_baud); } static const struct ingenic_uart_config jz4740_uart_config = { From patchwork Mon Aug 26 11:32:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 822623 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2046.outbound.protection.outlook.com [40.107.117.46]) (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 0DA8314D6ED; Mon, 26 Aug 2024 11:32:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724671973; cv=fail; b=j8PoDaNgCyq7LnruRywl4M3f+WOJdRomcXKatbP7uiwIqqdsV5Iu8RHhxsUzRN3fpEONiTrewANewt/AcxIhy0hoKQqH8sWI84SbBIDs8t6rywiaGdBM8QMRUnR/TE7cyirG74W39ixDy7K7Z0v6sMdrHUGob8em2Zui11O+sFU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724671973; c=relaxed/simple; bh=nOM7btnvCc9tCQzeA939Rkkuf2VrxuZM91QnM4vUz8E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Sbj5mQLT9q0sGuZStchbItPbaIDc8lw6mZACqSGLfWe4hf9YJ4QRB1m4KFJ45yjjVxF6f2mOhKPGxyZ2RkJSUpI8Xem6GWs0E1YNVGbh/kiWkvcQFGVUEyJI3djA6csenf5gmcdtgMNEOiB/1eN3pHdUF8I+VL+7GcorE6mx9y8= 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=Vi18/SrF; arc=fail smtp.client-ip=40.107.117.46 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="Vi18/SrF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JXqZIaAM4hHnzD0JBrra5XIP/kyCZuDjRAB7pYALTsFxksnbozegQOZjIGjgxWyx4bHwOw2OG2c3QUS1piOs2j8lO/E44O8SfPJnbQvU+dBzxr5Q2WiBYcUh91Haed4gmB72dp0U2D6L8H6/b9maVSR2PjqjC6iARQYSJOoH7zTpVQ74tsWSraC1h+Le/kAwRKWKpP1vF9h4LSaqj+aDzCTbtSEHS4qCN5pwQkXpdzSdcno+d1GGxR8qcjEBNthJ73Tm4ngKor2ecdKY5XjAx6AHHPEkFPS9qOFo7F8qXIKb1sXy4R6McbV8xK8tJE5pB8298eKKk5NcHSOzo2q00g== 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=CjamqCHlt/IsYhaCOY3/l8jZ7Oo4ifgfqsKsfh2wVt0=; b=ifJEBVIpN5ipXXA7iBmF72nPuByfyGXxUe3MpPyjMmzj+buxAlrdIAv8xPPz7K3zr6SZXEuTE1v+nDBUOQx72V2AtNDuRJA+qfZcIEpqUWK9mSqBRNWgwADowpbwFgMp4sladlIYrK2cJXTuz1N3Em5S4v7WvMnegg55sDDcDx3xQ4SyR0QO4ddO/E2PWZNJXYeSJg8INB4VRhs1/gwYdtLo7sJZNreWN0B9SjMjvYnNcvlQtsd82UKjeDeMC6A20AWHFJqbKaYTm68KdRJNPuoL0Cu4ZDhBEi38g/jyCDw5vybKtks4KcSgcsKouqmErOqu08jzsnlI1q6r0i00LA== 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=CjamqCHlt/IsYhaCOY3/l8jZ7Oo4ifgfqsKsfh2wVt0=; b=Vi18/SrFqAEls7fNnQ7nVbrSlku0arV+2Ux2VXoIjMkly4tOq7mpZQFAYjHEmBRwhJDoR74vi1MPaNHPzcadIUOrAOMHLb9tUPWzyIqBSKQwbsaFWvtk0H5cCa2Up6snrHOAcZNHuYDMRKz7aJ92Vene/c3jG0UFvWrsohMNVPfBsn2KqdKOqztzyaidWJug+c4NonbXRqWLeuJX22fnqWvn4IYCh2hKpIQg2DDGaPES4HeiUXPne6txhlH8kChk9KutzyhN+Vl4G4/rbrCmfEAY7n+1RTZlp4AiOIDm5mX2Emwi3qt4lymhGO+kudoLmhuViooIz/YlcO/iiQn6kQ== 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 TYZPR06MB6466.apcprd06.prod.outlook.com (2603:1096:400:45d::7) 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 11:32:49 +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 11:32:49 +0000 From: Lei Liu To: Greg Kroah-Hartman , Jiri Slaby , Thierry Reding , Jonathan Hunter , Lei Liu , AngeloGioacchino Del Regno , Andy Shevchenko , Geert Uytterhoeven , =?utf-8?q?Uwe_Kleine-K=C3=B6n?= =?utf-8?q?ig?= , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org Cc: opensource.kernel@vivo.com Subject: [PATCH v2 2/5] tty: 8250_tegra: Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 19:32:28 +0800 Message-Id: <20240826113231.7300-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240826112933.7249-1-liulei.rjpt@vivo.com> References: <20240826112933.7249-1-liulei.rjpt@vivo.com> X-ClientProxiedBy: SI2P153CA0017.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::10) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|TYZPR06MB6466:EE_ X-MS-Office365-Filtering-Correlation-Id: f51e5370-9cdc-410d-69b2-08dcc5c2d058 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|7416014|376014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: /gWUYHxY77HCQKqJSd37K5Mv92hYaTiz6XrWCF5duaVLBFYgS5nQTtSnLQHcozIK5F+j4cu5XpqiOxcBcXALcFq51//vk1F5vQJ92dCh9W5ivUy4ORk+NKEMeNP+5c35sW1ov31u+YkbrwdJhn/MRSK0B7o52jL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eSS8cup61AdYQ5FwopmL9WZk3zH141Y2P9YUli3OPUJIXXtZxuGTnZAG5+xl45d/rd0wliq/a2PAr6PxicI+PEUopb+fTHJhaIGeIPtMO5kQYIvGQf9LKf2banEo2u/Ctbz8nqBKT1hPzm2kB+OBI6yiOClmbBMYq/RWRwRgwXXVYloU8NcsUbAeg1xSGajhB9w3VnHqC589480fUC7pPdk= 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)(52116014)(7416014)(376014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pZxHkqjtrexY0CDtlyD3F7apbULa/4GlddrDTaSInrW7+2Kak4x+3hpYnoIc4esyKc3g1BYgYa164AwMBT0eBRm7Uf+5znxn0HgK1MSDpUWxqA+B8CpBNdtA52uFicAMlrakKp2tDi8sBbSeUgmDFCnvRfEGM2UeL68sk2zzHxCvfMcx2GQaOdzf/usIYuRbziHLXyl2F1eY0yIdigyfVQAl9LWXxmBGwOjPq+GtKwwy549LEtSBiCtBxSWZhmAJsa0Hiv78XQMdVyM0y+m7jx2CbJLdFY0m3AhsLlemiUOrfVBuWLnqfBgYjCTsw+eJs4+MbqWrjNUyOHAA4zpLpX8qMm5NcBwR4JhxHVYZmXWWTDTc60tytnrEd0sonCqwN43p7MPzISpLzQcuEuEJLFaj0Wm1y/9Rh0JpEp2hkScbN/yQw1ZJeQXopStLNMCMISEffexgsgbyCUj2tITIeakZ7eMp813O7XvOcG8QhexklKs7mSPDiJ40WXxtbeL0z8CfASgK8XmlSYfeq2KGHMJ7fTCqzZvd+FcpM6cqSNKAiz2chlcYFriYNid0v96iAnJCgZRok3Yp+MzNq1bLA5nq3QZd3MSwEF493mBRA4PgPj5IAwrtelyTaw7Yla5P8bpBGNjyoppPo8fz1KvOU6EhqcWcmRbI2eI45HONmtldjnG4leGB4Y2vxJvqXB8N7KUbjsaHvAZwmrOA0/cdG9J9GEEtY57YTqUPDtWMhWKwGxU+ePKmq2A6TMg94fqQdNq/l18cv2FUH/whkCcQGRFSeMNjczNb7oX9kzumMlndTO7uWaW/cICGdROyW+Buq6jR/knjwyb3Z4zSGcAXcPZlYVY+MjclscpWczFiBx4IQy4K8hcKpF0cH0rWviBbE4YJTCdpvpZMErGN3aRimrL/MfZxzvVm+2ZZABjQngutEqY28NZ/uRXAKmBYkccRlTaMALOxZPK1pWe+EyfxMwY0/SWGQR/M3+MMw6R57Mchw3ltYu093A7tS7H3TZg1u+hTfeR7JzlLy9KPGKJhBUi1mDqTuw7xVidL6ANClKWV1zGZaFH+J9OezaiKdD59mUTo0OYJ7jinxf6vc2D3akC53SJJLHLHS5LjBKEnNNEIQDau1AYMOevcUf1WvrULtz8USWQCI0xH+VfisfxsI8v3e51HErUrKh9eG+WJXRivum+H2NKhCj6KRtz7uZk9V33H465EkygpgWgVCIzxODZzsfVYBcUJs/epYxQvode2R3flITF/Bm8/ZZGC4AQrktiK9nHaS91ks3KXXowV5jbtanKTFqc1LnxcWIubqlWBuRN7RhNMGQcE9Wsx1/tD+K6Hmc1G9TuCkNjL8q3z7JjVDThdSu7tDHmDe/Wa37xngTAsiB4yKfRbNZEVHobQyaiS7BnFtfvr1UI5wCZKTBRBdBDIBdwntIyhFn/t0iMEgMBBx9+cMfvVxU+9DkjSHBZxJuyWoSBSR2chw0f48vtLA6wHeHIIO6owlZsJKJ52Ha8QXwHn83WKoUn2kXlM98Zi0zI3tifQd1ue9/sUGc+N+sVD7R6Rixv/RAmei/Q2FWNTdbrPOBkM+xg4Svnp X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f51e5370-9cdc-410d-69b2-08dcc5c2d058 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5624.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 11:32:49.1446 (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: 8HYfM+mKNOQQTemRlEwC2vTB/L1HpafttKNYZVFV2PE9tS1OeXhamJ09XUdvN/VGvqHNgJB7OmTWHMVyiJTbew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6466 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 changes 1.Remove redundant label err_clkdisable from 8250_tegra Signed-off-by: Lei Liu --- drivers/tty/serial/8250/8250_tegra.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/tty/serial/8250/8250_tegra.c b/drivers/tty/serial/8250/8250_tegra.c index 60a80d00d251..79e5765a10f0 100644 --- a/drivers/tty/serial/8250/8250_tegra.c +++ b/drivers/tty/serial/8250/8250_tegra.c @@ -86,22 +86,18 @@ static int tegra_uart_probe(struct platform_device *pdev) return PTR_ERR(uart->rst); if (!port->uartclk) { - uart->clk = devm_clk_get(&pdev->dev, NULL); + uart->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(uart->clk)) { dev_err(&pdev->dev, "failed to get clock!\n"); return -ENODEV; } - ret = clk_prepare_enable(uart->clk); - if (ret < 0) - return ret; - port->uartclk = clk_get_rate(uart->clk); } ret = reset_control_deassert(uart->rst); if (ret) - goto err_clkdisable; + return ret; ret = serial8250_register_8250_port(&port8250); if (ret < 0) @@ -114,9 +110,6 @@ static int tegra_uart_probe(struct platform_device *pdev) err_ctrl_assert: reset_control_assert(uart->rst); -err_clkdisable: - clk_disable_unprepare(uart->clk); - return ret; } @@ -126,7 +119,6 @@ static void tegra_uart_remove(struct platform_device *pdev) serial8250_unregister_port(uart->line); reset_control_assert(uart->rst); - clk_disable_unprepare(uart->clk); } #ifdef CONFIG_PM_SLEEP From patchwork Mon Aug 26 11:32:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 823006 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2040.outbound.protection.outlook.com [40.107.117.40]) (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 B91961482E3; Mon, 26 Aug 2024 11:33:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724671989; cv=fail; b=hF5rUL6jwRUVUycl9spc8JAAVdVQGE9Zvvp/IjDbQX3wGmd0ZsDwKg8snbiXy47JdkmCeJPbR6ZuFSZEIv9Cutn250WKLDorwpevs4zwTKiQxLlSolezOdpFQ1XGhmFzJIdy0tdnzTSQcYuMy/rvYLVwXqH5GahH9oWnMKuFE/o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724671989; c=relaxed/simple; bh=t5UYAg+IcB0hC4Pa7chpX5zN1uloccVyugy90eBVd1I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=qxhPqh5BRKh/Jo75VVHn5Nd0UrRPNmjA/n7Z44o8lOah1g1gkxPKJrLv7l+2rIQzuAC6A6GWcsuDttE2cARvPjXt2uDg13s37JJMpDNViQhlTslo2cNmqBc+H+TfYCpnSABI8iAoyBkkvhcFGY5yommo1hJXAt00/4zUae+tN6E= 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=Ky2X5paH; arc=fail smtp.client-ip=40.107.117.40 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="Ky2X5paH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kExYuXNiW50Cqmx5vGYV4gfnQYrDHZo+fizarpeK+u1lWuX6KY5C9qXoKAJNwGCI+dFCl47Lcn/46VzxPF7YMCDcnZ2yWcWupRTaRXg5MsQUhQK57JzWct9osKM0ilIrQiEzfueNa2xTITJAKAeq7fJ9c78Us0bF50QMTJejW9JkHxc/cTauYznQViLdtW6r5m+Xs5JKxlKy/UwspZtTlLFHwTD6GRQM4NxefG6CRb22lXNNkHdI5dtiFaZkKNfbuXNrGo0Man0xrXYMD4NE99EJj/5Y6M0k0Sdh2LTas6Wi1qFyBAlYIOKi+lo208x96Flbimk2rNcsg4pINU01hg== 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=RpF/ZRXxznWXnDGBAojA1le7WyXvlVDIX3kKIaUGpxY=; b=zMGqi+KHrZHo+ljdjroUB0WHWeHWMm0caUM6zkYo2C3Xsp//19S3dX6Np1gf1q3bODyDxu9Khx5mZPvnWGbZVfAkyj6VCSwmOIAAN3tzJXLEGhFlaHENcIZ/dBfW0xMTrJ6CP2AdJHjYawmaB6l4LzdA37maMnClnTqXtRaZYvT64frh45m0Tl6Y08Mm57LAW5CmZ5RbOZauxXt6UPw5rzAx5OJHYhS8DsF1aniLxiYhp4IbczxjuLqpN7UZDUTYn4iWVPm61cc/J2j/wgGQZPrYh1U4TgduxikBKabI1KYQqXudFvueRITbdcStEmvAznRe0BPuCupDK/oAWGvqDw== 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=RpF/ZRXxznWXnDGBAojA1le7WyXvlVDIX3kKIaUGpxY=; b=Ky2X5paHFlbVDeJ9RB9nfOgE4QJ6hgMUNQwVSYNi5HdVzB+Ywkx/BWTUJMWqAOrdFzxXhAxGYtDfhJByxeoOZrK2RHBMsLvdMDvdpB83+hjdZ1JE5PbnssEFIyI4Sri1GgxDLYhNJv2VMDu+ueUkqnKXocSL7tHZnxhMpa31O7jCA80V5/I7K/tkYHOZByky2d9Rd+H4RAhFp0cgOgaey8gH4FxXMM03Ywi0g2DNoQTcZNo9Hv5x80FPq17J87dvcweZGin/URmrdULkg9k4gUNgnEqNimtljj41Pg6EfynXOUAjJGGym2bXIQJL+DNGcMl+2eMw0swwbgNpw052LA== 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 TYZPR06MB6466.apcprd06.prod.outlook.com (2603:1096:400:45d::7) 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 11:33:05 +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 11:33:05 +0000 From: Lei Liu To: Greg Kroah-Hartman , Jiri Slaby , Kunihiko Hayashi , Masami Hiramatsu , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: opensource.kernel@vivo.com, Lei Liu Subject: [PATCH v2 3/5] tty: 8250_uniphier: Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 19:32:53 +0800 Message-Id: <20240826113253.7322-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240826112933.7249-1-liulei.rjpt@vivo.com> References: <20240826112933.7249-1-liulei.rjpt@vivo.com> X-ClientProxiedBy: TYCPR01CA0180.jpnprd01.prod.outlook.com (2603:1096:400:2b2::20) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|TYZPR06MB6466:EE_ X-MS-Office365-Filtering-Correlation-Id: a6ba5c1c-94a3-496b-3822-08dcc5c2d9fe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: ZI+FieCya0yX6eMU2iZ6JftJ/5BYq86l7dHwGp7kA8o2xsT4Bt+ARih7eCzTY01CJ74iIO4OeobnWqBV31SgA0ma1aq734NUQo89atXkcfPumXnnvcEbHJaY9kAW9b0EQhaIYIuE9NlAcA2HhG2oI/wfLY2qvOiZnhfSmwZIMb2c7adpvLkF2ntYHcD45QLySFheTQKJZ9o7WAxNwnC61hVxD1D4JKvlsZNjiuAsymoPaXVHCNcoB880pD0+CfRMONsJ6653Lp7E4j2vJrUJncRNVGUj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jOZBHF/0voQ0PiS3zLwqBuMKUEPLWjUAMzXWlNY9n+0ZJo7fUEoABCZkPJ9lV84QppcbJG95gQ== 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)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Sibkuop+GhPvhnVzWjHu7h2e6T5oMmZ8tWgXfkb9cVX1HbRWRfVKPmAS576BoR/nkvSRafMRdVUizIbcKehPsJ2VO+6ddwb/8KIAtxyN+yuB+64D8Wf6o2NvotE8wSOjMDKLefmiJVUXQ4JZb8vhkaBHfNaJcbYfhsVJJrysX+nHOyRiylonKRDGUAmYLiPhjZC/PVu3RL1oTdxvRZLGhUHoIuygJISQS8GQo+NgVn+t8XtN2THAiXfb7ImU6EaMTmtZ5q87KD9RKRpmw/v3Uyb1vi9ghAAQQakjhmOlXHyQGUj+W7i0/QdGvUDRlQyXYxaCQc3TvdMRGlhvtYrZIjsxpThECq/mUUUQW2kYjRx93dSma6C7ilRLvz1HnUtKfF8W0+lbs4h6/kIQ0Hj2sCDrAi55aczO2y0ORbspNzQ9SPF94c+5huMf7Vm6PMyGUSDddfy5rVe6up0hM2oOM+TCx7ESdLlYkMgSp/JOv3FLUOEXa+L3b1sa03YrOZpLyuKCeFoxNW0BJXHYyJrgnrSieEtHBv2vzeln8o/VKATMkpNu/XHl1iq98qxOzdHxnJr/in8kadsifp6D7kPQaharQv+uPvg2kppvNoTrf/SxxVkTVWIATkwbGJIGI2USC7n9BFUkjb6vBK9JDev1n/clA544rmJjIJ/oVfFX1SBWdIP09VZ+cNNW/4yM+TGLpnkuh8wuff0uwbKYCjs9qxsnY5/Hq3AeznQT63sna6unQyJJWVDBzId7zKqqfEIMgKrlrgmdrCle3I0boub5ET+T4cwrDnL8Roci7Jd++/NZRR9IH23NQLmzRm1/a8tszlGDdIA0MlXZaWKsLuS5z9P6JEHzOupCrJa7Y1XKeRrOuJdcoE2173avmtWHjeAA5XSUNvII2G1GDzNNsf5K+yroDN+GWOSviEqX4FsXpaOtCRMioTcORKkJ7ig2Z03FFuR0iH/+OlB6BRIGzq0XdRo3qhRcr6oYZFURDhVvGNdDFO4qv1DXJUUkb0SE2HTsTABQ8UYahN7bNLZLecbtU9BhIOUO7z3IFwqMhJ4RdkHrrQ9jdUy+1cGO/vG9NawqwJ2Fi6IJKqyvujB5DdBcazipwquU/vN7/Qu45Ix9V2Kuv2vankcoDMbcf1MjVLvIPOu4rB3yVgFqQ8148kC1fnzDez19beX9U6TxepOUfAqcBgfUAQqsvtmn2S3yUqUv4ceWL5yT6ybCH2VlIV3qTpP63mESdb/Iv1TEpixIft3HIHxgdhGBBzrLjAfYt3LGryZ3eRec7R0WOVFbnJ7WX7CDhD5L3nOBwemHmtlsKfGaLSqrxJzJ+5XKVy/d2rcRBKsYUWmbHd8IyoxJWqmz5SH1nOBuXZxA8nzV+dTwMQQnA/N2Yl9bfwDF7wakhhS03cAmkfigbH0HaivQ9UlXQqcie1te/YNh1Dtqqn6dLUSyg9/0vs+ld2oY5rBv4xZCPeSof/etPJfOvqIDDPhUyA8iE3uM1CV/mpKn2fWjj3KitgdoW0ZIeSztFtJ2SgIFX8ftVJAbThd2YxxoEMK2Z+8PZNe8TV1MUUMXKH8RGmqvv6qGBgw2OGQvusSTEK/n X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6ba5c1c-94a3-496b-3822-08dcc5c2d9fe X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5624.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 11:33:05.3412 (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: rMlnouqcBYAXPB7O7QfZ7tGed5V4/cGdiAL00Mb9rQljtcvQHiKyAVKwXQ69Lbe2TohXCZwcbAiC4xDiJbuo3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6466 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 no changes Signed-off-by: Lei Liu --- drivers/tty/serial/8250/8250_uniphier.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/tty/serial/8250/8250_uniphier.c b/drivers/tty/serial/8250/8250_uniphier.c index 670d2ca0f757..6ddc4262d22b 100644 --- a/drivers/tty/serial/8250/8250_uniphier.c +++ b/drivers/tty/serial/8250/8250_uniphier.c @@ -180,16 +180,12 @@ static int uniphier_uart_probe(struct platform_device *pdev) memset(&up, 0, sizeof(up)); - priv->clk = devm_clk_get(dev, NULL); + priv->clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(priv->clk)) { dev_err(dev, "failed to get clock\n"); return PTR_ERR(priv->clk); } - ret = clk_prepare_enable(priv->clk); - if (ret) - return ret; - up.port.uartclk = clk_get_rate(priv->clk); spin_lock_init(&priv->atomic_write_lock); @@ -222,7 +218,6 @@ static int uniphier_uart_probe(struct platform_device *pdev) ret = serial8250_register_8250_port(&up); if (ret < 0) { dev_err(dev, "failed to register 8250 port\n"); - clk_disable_unprepare(priv->clk); return ret; } priv->line = ret; @@ -237,7 +232,6 @@ static void uniphier_uart_remove(struct platform_device *pdev) struct uniphier8250_priv *priv = platform_get_drvdata(pdev); serial8250_unregister_port(priv->line); - clk_disable_unprepare(priv->clk); } static int __maybe_unused uniphier_uart_suspend(struct device *dev) From patchwork Mon Aug 26 11:33:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 822622 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2079.outbound.protection.outlook.com [40.107.117.79]) (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 993F91547C0; Mon, 26 Aug 2024 11:33:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724672014; cv=fail; b=GEQd8/oiLDxlcdfK7uEUZc8WNo/F/y4Y4gJGvHzUkBI1vRh15hm7DvRE0W0JfdWtSZfi0YIPI9/8fIjh1YatVykrEOmIalWuFDVzMbLsUgyk1MhFGtzxzByDBfAKmO4Hh686kCuhAulFxTzCoC47d+8S/jq8BoFD8X3V4FXqcEY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724672014; c=relaxed/simple; bh=rBsKszEdz8YWkjvcYDrwI6cUFR8vqo8+oYNDhUWaRI0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=jwn+ujdVgrinyO8Z89SLHWezDfPbUaRicWvHYNg4VkQS7OQPz/oB0WGdVmy81j/gJ7IflFapJfraqsY8RF3alRlpDS8IODxTMSKn8J+TgrJrORzmhr1X0WPBTCTTYLWvbgO3VVGg2jtBkX0kOjYkbliFBc1uA6Uw4CxrclMwhrs= 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=j+Oim4jc; arc=fail smtp.client-ip=40.107.117.79 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="j+Oim4jc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EIu11gDjliBrNvtbQGZ/SbIVa+PEK46joxgrj+aCvMIbHyJBGuGTgWXCIIPDxRUaKPdDn3LYybNS+yglIGAffXrpyJxmxmqDf4i8t7FcWlI+oJjUXCT8W0im3eaqPnx+1E6BVnBt8i2SAF/OshgbAYOUeSLXuu1LhhokLQoIxw/sfYcp070RROzFzVED7sjIL+u0HWxEiR6OlUPmrAvAKobsJm0dz/JVRU/C4rcbeqCrQtTClN2vtoHK2SSG0CXVF3uT0lfNckY4moEIMXtQlGvNXfSLt2Cfj7a1SVgrS/8eZSSCFPQXcg7zwEdoRIIbNjo2QZ1ze0hqCuMW7EiHGg== 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=Z5F4Z5JDNEo2PMJrYJBGtWIRDfs1Ke+lcfNrt8WbmNc=; b=vRdzopIBRKh8DCu/iciQtj9Cb8NDeBOQsMEZYf6xmlWk5IOrHEkycWqWqXUuTPOiUwm6KvxhgZzHst9OjBgALpcpr1UAzgjy9BLN7TNc2s6P1a7ZX+HaXDOdL7eUxlCu7zJ0WvGt5jn8NlyLffV/vbN3PejlD8zr2c7gz6T1MVmRVpFBRo25R91mc8wkyCacgQwTWs5SOnb75gLHCKuur5XzY4Dx0Ag3BxQV8x7KrEl+BqJTZrOUnPdTDNFNzoPysng9rBZmbAnm9Pk1ZaBQWoIRIAz2R4hD0emKHZy5ReElRTPp3dsn2kO5gXbXLXAq4+O6oxJIvur3pts32KO4/Q== 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=Z5F4Z5JDNEo2PMJrYJBGtWIRDfs1Ke+lcfNrt8WbmNc=; b=j+Oim4jcWvvFu1JPuIKj1DKAN9OECfchXhzeAF7z0YnDgm4yIX37H6Mz2GprHPoDykvNkEWnBERGgZ3CD5gzRYD25o/C21yYX9HqWePcL9xmc54tmaKa7Pl9VPuB9n9vnMSSDnG7HbVec0ysVzRvKsCTuRN24GzPqUTEAv7+SMnvW3t5cnVWyujzhFT4e3TZ9t4SXfLnVF3QuGIc+HkVgF0A8mTlvHPvqvkBRCDwDzcVGoI8MaycTac0504vz1Ym/VpBQ3j1JnHfbrnQ+EdnRIbttLIBrMFsSHjut0iVhAEp+fZ83LQpvmW8LkG8/gMs92qF4rLgYbtvZvpfYbrKhA== 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 TYZPR06MB6466.apcprd06.prod.outlook.com (2603:1096:400:45d::7) 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 11:33:29 +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 11:33:29 +0000 From: Lei Liu To: Greg Kroah-Hartman , Jiri Slaby , =?utf-8?q?Andreas_F=C3=A4rber?= , Manivannan Sadhasivam , Thomas Gleixner , Lei Liu , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Sebastian Andrzej Siewior , Jeff Johnson , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org Cc: opensource.kernel@vivo.com Subject: [PATCH v2 4/5] tty: owl-uart: Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 19:33:14 +0800 Message-Id: <20240826113317.7342-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240826112933.7249-1-liulei.rjpt@vivo.com> References: <20240826112933.7249-1-liulei.rjpt@vivo.com> X-ClientProxiedBy: SG2P153CA0026.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::13) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|TYZPR06MB6466:EE_ X-MS-Office365-Filtering-Correlation-Id: 4bd6da83-8b19-46da-3715-08dcc5c2e8a6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|7416014|376014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: Kp/lhTrH5e8Kq5+ieV3brmzfZXlxx9aVf4Z/4h8ZrbkhfiLXiHxMK+Msc8nSV7G5BEemAwkef/NfrnniA4s2HLizE7K7b0Oy2qSvgh97W0gJdoAJTWKyXvNqYQCX04rX77+aeKO8/6w7zJcAjAfMkZbc0+GFkFdPR3jgVZepAB27rozmRbHreZk+Mlhjfy7YAOGcAu+PlIZpqGOeY2cb8T+Lu0SecEXETs4/hFJzRg5fVfq3NTlitRPLS4nuReEvz1VSIIPYcoUY2Xw9Px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h4g1aJIZIZDDUcjMef9aTYCdlcC04342v/0zgNf38grshUBEB4qH36JyqooskXBRJH9Xid0h4OiCzueajQCr0bsdnlMLFQ7ce4GA3U= 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)(52116014)(7416014)(376014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ou++PQQU7cZhsMi5wZwTm+g5umsn3izeMGoQevrZhkm+BsfD4axP3mjJuZDt3cO36+MPSXH+O9EQd9rITdXejiN3fbWkp/P55nqFotQZzaa0jbR+oGfP/zRPWxyb3rWXGTR3rutWSy2TLjQz+7pMTwUU0wgrEF7gYaUOcDbVflwz0fannvel4sa6OUBy5U634QuHBtyg0Lag8+RmbxnH/pdiEROK5GWfVftvFy9htNsVF879ODWotgFSm+FBuzqWqxcZmnjna93O1fsEN5ulqXTqqVKrzbS7Z+ZvyTQtRYnaMK2yCn/cGLkrdZTgi3l5u2LtYFZND5OUWbvUIMpbN6Ui3F8jPpw7OPAzJCUWH9zaTzLmyOcPx3xM1ZPgXWRmnxK+guT7PxppKwYGYHYF5pDug4ffNec6mIwtQnogGnl5DNYrXQ4y8tKLCtzzUzyGezgShGl4GLl0yf96Wrs6VsFmSI4RlfqAJc7DmVsS4l9EfLDAEsTLD6b8p5a9aipx3A3HZZCuKxunb90eJH+KcwYtAmO18B5sQp8FRbYzLKYEl8XgSD/BLuIBDdxpsMZ/A+25rlJAIqX67kjrtS6Bix6fcspQF2dm4pVQB5/HosIg6AVqvQyoXdfe9lvLV7dv+1H4YtN+Dg91tCyZ6y5enE2g3w4P7hfoiEy8SkPtIz0dvBUmAWEpPvTjh8txMypOJuTRUnd0lHWGwpLiMEq89evGHfeaFS81L2iYiQ94UYyQjOcQ1dOJ3y8Wv9fj0VZxurjotCxOHUqinhEFHItI8YAhfkseIw7iRLg9BihDKywqoDFUMliSL88skDnyfLZJOoQ8fCbjXgTQFkUHcg1BtkZCXvcMSs7lhTwPDXCW8DIR0i9LDs22LZqa8aZqmwOXK8S9QdzP45s1SwBA4JvecrZlgla1PED8kTIW7co1DwoISY/+pnkjUhDtDFncbp5AV3k69WaI++KlvW6Yomq5hBpYK8+goshfFyYWxvAmAr205B99lblnDqxOGyxQzQUt1Nm1A+qldswdNJW3OmAo9F52eOC20Vh9ZZlor6c3cWIQa2GcX4tvMNOLtMKDcc7H5S1XR6G/pw/QIdt82omWNbkzQjdjwE9HtWFWuJqFDATOW2jHL/T7CgkpoesprmFC3fQXRZXotrX3TroOU337qhrKzw+DPmezh9OjQP5v8c0UcIBfkDUTqxslaue5tuczDgDHP3UXfC15vmdqiJxiEqUTg9yyC6TelwbQ+3huG4kVanqH5yJSdZaOuPUaIf7Ir4I2yY0XCWS2LjLHxxxO+r/K8ukOmFgcek18TnLxbB38m1Z4XRm6Ra36u19/5bh63q6flJZb1/lynV8SEkgqYRrKBL97pnhe0rip8Nak3X1aiC5djgZmg2r7Rs4K+nLwVjkRb85d4GXgnY+ek0V1wjmjhRv8NAfMrHLO1zulqKKJSkJPJLREFxaxyiCL+Tn6pkm188RebXTT3ZohsfjLkoz5QpzFT5ZTBzyTSZKELh+0z9mMDpqT9E8OeziUaePm3ffIEtyJ2J3GAplHmZHoUI80Y423u4/bhnG6hVsRLoJfo2h68NOkpTO3Tda640oS X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4bd6da83-8b19-46da-3715-08dcc5c2e8a6 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5624.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 11:33:29.8980 (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: IRa74sd6vrSWIpkCXS/lEh1OMoSnIYDaaJDv/S+zM/2W7rfUaxCfuBIYIhP2N67pcTmuOxCkSVSFHLteDCU1kA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6466 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 no changes Signed-off-by: Lei Liu --- drivers/tty/serial/owl-uart.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c index ecec483d4d59..28c33cea6b41 100644 --- a/drivers/tty/serial/owl-uart.c +++ b/drivers/tty/serial/owl-uart.c @@ -680,18 +680,12 @@ static int owl_uart_probe(struct platform_device *pdev) if (!owl_port) return -ENOMEM; - owl_port->clk = devm_clk_get(&pdev->dev, NULL); + owl_port->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(owl_port->clk)) { dev_err(&pdev->dev, "could not get clk\n"); return PTR_ERR(owl_port->clk); } - ret = clk_prepare_enable(owl_port->clk); - if (ret) { - dev_err(&pdev->dev, "could not enable clk\n"); - return ret; - } - owl_port->port.dev = &pdev->dev; owl_port->port.line = pdev->id; owl_port->port.type = PORT_OWL; @@ -701,7 +695,6 @@ static int owl_uart_probe(struct platform_device *pdev) owl_port->port.uartclk = clk_get_rate(owl_port->clk); if (owl_port->port.uartclk == 0) { dev_err(&pdev->dev, "clock rate is zero\n"); - clk_disable_unprepare(owl_port->clk); return -EINVAL; } owl_port->port.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_LOW_LATENCY; @@ -725,7 +718,6 @@ static void owl_uart_remove(struct platform_device *pdev) uart_remove_one_port(&owl_uart_driver, &owl_port->port); owl_uart_ports[pdev->id] = NULL; - clk_disable_unprepare(owl_port->clk); } static struct platform_driver owl_uart_platform_driver = { From patchwork Mon Aug 26 11:33:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 823005 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2060.outbound.protection.outlook.com [40.107.255.60]) (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 801E11514E1; Mon, 26 Aug 2024 11:33:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724672034; cv=fail; b=YhqUhgo2z/uKA3+jkafu677YA37TIr82BnSGGiNGcrLNoNw4ytgKjk/oaXYM7PZa7uH4I1pcXwN4gQM6qHL5MsYEJLGFSXwWXvJAZOhoybdUV156q6L7IyeVGBGQFfAMsPBtnsmU9P4BzTWeqtifn0pyty6WRGK7FBPkscmVwH8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724672034; c=relaxed/simple; bh=vNbZKf4U4e+PHAd6+9JrpGKM2iwVFiH+LR5x9gKbluU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=oAon+LI1ybhil6kheL3U01CYS4B+DC44KFMeZHv5yt+T95zWBcNhuF6u3S2yrttCrH15HbCZrlkuyfkBZGTpNPZCiiCKrEd+zVPLlxFPaH9JfgS8x0TTv1NDWCFeREvdqKUnTN6pNLfTRXoi+tVERBv9eFWYfv4twwk6f06s4mU= 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=ljuFRkeF; arc=fail smtp.client-ip=40.107.255.60 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="ljuFRkeF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZLaZ00cg0mjTe2t0xrnqih9N/3pmYpgB9CeCk+oWDuQcaz0zmhV9cnhF2mC2q7pBPIlDE+HRk7ClybV2qFk+MYFtOxMwvDGVCBm7PKAlvQA8rDG1jHpFIjMQIcaXOCK6CIpCUL0AfsnBSOp/KzFQatDAqvmY1tzB40kIYSgfqR5XFP/3KMmIUYtVHbKP0TDXvvhwPDaa7DL9gXmCDdo4REHv28e0nHe9DYqSFMsHf2TL+asWklhzQIkSjRcmqQGow7djC35toBul5yww44V4+77ikiYo7+BSuzV4Kyn8GJa9CBAfIlCpEY5hFWkHPqRcAHcqt0WJ1oNBh3/7Yyub+A== 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=QsMgzjnnY3ZsB+QmPl0tL0sbVOWt8kUn6YkHnoiFUEQ=; b=sSRfQGFVrDpriAtxo/4eabebHMGGx7tuVarnd9kaB531WtkQ198/y9aNceJ3SOEF5Funghj8e43ShLlrduzvVU5hbuEiOJDTEtbyTfyLbjDTfzy+MdXkYxhIB7Df1qIyV/FjUVrEgg74qNVxOIjr0x1TgAXfNaX5KKrakxoBaOHvgqlVVEB02h8xlWW0df1bus7B0f9UQi/EwKAlaioUueYtjMYPDePptnhGuIFlycXHGhsw/lyTgtJDzXbR//qLqJhqZWENvvTtZvvw4oZUhUoFHiOv7qDJHJL0AWACOgmseJeWOAuowkEBSOWcGkMx9TwQFIIfYf8xEFYlrTER9g== 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=QsMgzjnnY3ZsB+QmPl0tL0sbVOWt8kUn6YkHnoiFUEQ=; b=ljuFRkeFsUGXW1PTkbh4+qRFFDUvgtSItxX5z4c6CIr92H9T8i9txzgYYRRknE+KpxYB73xI46pKXlYQSoZrE2+41Sl9xOqjEaBcN9szs9AhCMXlfLGfwjVF+ZZcIB+vCcg2slVBiDO3bE3GHfF9hZhQzPQBFtrBlBHXDtIWoP/goZEh/J6F/3PvppNCHqWQYhcH4hvJqrKuzgk/hLB4J30062tJQMPou5lHoWni3kiJ5BIRM10MFI/4+8ob0Ojvlk95JeMDIqNY+Uvnlhi32vcAAwE9x3Qe5WVf6bIJpGPfDubcJ9yz0faqtvI0PHft15WTXHK6xctymadglMncfg== 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 TYZPR06MB6466.apcprd06.prod.outlook.com (2603:1096:400:45d::7) 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 11:33:49 +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 11:33:49 +0000 From: Lei Liu To: Greg Kroah-Hartman , Jiri Slaby , Maxime Coquelin , Alexandre Torgue , Valentin Caron , =?utf-8?q?Uwe_Kleine-K=C3=B6ni?= =?utf-8?q?g?= , Lino Sanfilippo , Erwan Le Ray , Lei Liu , Thomas Gleixner , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Cc: opensource.kernel@vivo.com Subject: [PATCH v2 5/5] tty: stm32-usart: Use devm_clk_get_enabled() helpers Date: Mon, 26 Aug 2024 19:33:34 +0800 Message-Id: <20240826113337.7364-1-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240826112933.7249-1-liulei.rjpt@vivo.com> References: <20240826112933.7249-1-liulei.rjpt@vivo.com> X-ClientProxiedBy: SG2PR02CA0020.apcprd02.prod.outlook.com (2603:1096:3:17::32) To SEZPR06MB5624.apcprd06.prod.outlook.com (2603:1096:101:c8::14) Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5624:EE_|TYZPR06MB6466:EE_ X-MS-Office365-Filtering-Correlation-Id: aa68c48c-b378-451b-cc58-08dcc5c2f455 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|7416014|376014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: sDZBrCzfXv03pOXKz5JiKAjlFUHAxq62yofPj1Yvjfub9QAKe4xVZfgLyWiNN1yj3fkXaIxZHN0Mfn8YVBxQMieyq0zk3fqvEPvFLsFzegcAAKzOyGET7juX89lISwj9u3sEQIc1GHywCm8uIms1OHPbBPhbI6qT5rEFcTxJ71bbTmTt3rXOgR4YKB2hb2DR1yQuRtvcVEF+u/49hOouBXpBiA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wi6Qd+RvUINaxkrKBrCQdgZwxRSUgnYdRS0tfErx7lUcH9dxZdhtHZGTpVwKVfn6yxsDbhfvSCCMmVyTNBMP9mX7OE7YJZLRwfEiNEKkghjivHU1qg2AJRUzsLpAbXuHiiaA3gG2deTghmijg= 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)(52116014)(7416014)(376014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: a2/fVkP6LrUQyVu8DpbmXWoEbVX9NR7xldfER5m2W7EdaCfpqXSoNXvEaD/RASq7eqWLnCphVIVy6p40F069kKMjVcl/dwIOGTjlbHoDg3XTgUDIs22OxZfHhiIb8CSUZasH0bizM+YD/MvaTXWP7YB/sYkM+pTDaIrFlJX6B613DIJsLp1hvbek2ZQeVfs7el18XGk4RlabKk2tVB9auoDQvOb53UXkHzNqXJ6z4bNRZStcMPpLr6NVCukFJfoSMmwAkJ29rKT1vME98tToQ3GtrE7YWIAOvEMyR8bk/SBniVcH7sydTKEVGH5ZOQ0Exnn35qbwHdkEAjQLjykQhwcJGvXAq+3+PlB4d1teOr3JzBHRK4iKXa5h03rB9WJ41uITEepj8MNr3+0d8kNWk0tCKojL0FlWG37Rdkjel/WrEdn6breNHH4w8ZYlxfJOyfOOHU/cIRnleILJ8WiKoYhPJaFoAyZqOBYMwHR6HWRrXCsab4leRQxfDdPBYhQCeH4rjC91sgldNPcEzcZz1EjceQaZulClFdhW0+y0nrxSxa34A/BjUXtIc5ZhTLjsgn9c/d+fSE/SN624NWceJMZpiX7NZgULzSWO3hU3oo2LTU2gosCu7Lefv127zBW5AyNOT//cRsntTeL4Pdzr8BpiFfFL2dXIbEzO4GjWWp/Z0DO1T5vY5gkgdKQMPQ7IvCXM0JurnDCCLxVeZwlDUgNtbJRm2LtreE8tl8axaG806Q6GorUG0natgX8M4hP5xu6TdjjdO/SeByY6lR+n0Rk64KkWJaw6d4RwrWKe4QnNqM7D3ZmGNuC3PjoYCON/UptxwOR3rfi9wo+gSQR4kKmnujhj86JlOIQkFuunpLfv/hqNS3Ms1MntkegZMsNzowjRB9fSEekcmncg/4nsuYpc3egfvr705rVtg0hX7+tystKgeHmRd5gexJhCi3qkHuTlSNmnLHNfJT+iCYHSzV1gABE9bXJ4Lfm4KYTDiZXpPgtwASJVHCuKjFMbXarwoJvYFcxd1wR8SbUSX6MzrFlS9ou8ZmMywja+p7BKmc4T+jswSobO9I0XlvO4IY3xfYVJIFq3aIZTsdu0OvC54wEVGS2J5nEFWQbUqRES/3X/TwCpVtONZdZU5fp9g5HlFl/4ANpadQGnROBw3Fc0ydvyyPyf4eINfKRcBRsQ/qM6+YTw3IKCg4cWxHUzo893hRoe/nvIusjo7f24KiVoeyPmUimCAJAMQsQAwB6Euey3f81XRvU/NW6CVbzmKYcgW6wZOe5cs403VYHiBG/cf7TRMU7IKkAZ+DmNYQWlgnFW+shEh9sokeJxCfZDtLk0ri2mqehgLuCmY1FIrOl+4OSTuOpyGBF5LbtujHfxS24UUcDgLNJAB2TLY7DgvqpaAq4iTAux45KFR6Y2s/f8hUPtUJ5qB1p0cDaD01RUOj4bkNqfWpqNSPXDcKyW7TzDPvmdLxnGEtl00SlKmfF+1i7gHnOUx17xsHtbt+fwKqkBt5mHvnE4O/ZAIGoC7MRzUjo4AfGqpvqiqZLYJF7TSWH0Y/njCg2oo35dy7ZcV7LA8Jec1v5Lz2f7x50iPbNj X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa68c48c-b378-451b-cc58-08dcc5c2f455 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5624.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Aug 2024 11:33:49.6173 (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: pLWwhxL73+glbqItvUKoNNxFDmZfiSRXv5Om8unZxjkLThnDAHxEArmDUP9VLCDhbPqvWAhLEe/oO1wR5O8toQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6466 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 changes 1.stm32-usart modifies the return method and removes unused labels Signed-off-by: Lei Liu --- drivers/tty/serial/stm32-usart.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index e1e7bc04c579..559fcc2659eb 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -1550,11 +1550,6 @@ static int stm32_usart_get_ftcfg(struct platform_device *pdev, struct stm32_port return fifo_size; } -static void stm32_usart_deinit_port(struct stm32_port *stm32port) -{ - clk_disable_unprepare(stm32port->clk); -} - static const struct serial_rs485 stm32_rs485_supported = { .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | SER_RS485_RTS_AFTER_SEND | SER_RS485_RX_DURING_TX, @@ -1599,19 +1594,13 @@ static int stm32_usart_init_port(struct stm32_port *stm32port, spin_lock_init(&port->lock); - stm32port->clk = devm_clk_get(&pdev->dev, NULL); + stm32port->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(stm32port->clk)) return PTR_ERR(stm32port->clk); - /* Ensure that clk rate is correct by enabling the clk */ - ret = clk_prepare_enable(stm32port->clk); - if (ret) - return ret; - stm32port->port.uartclk = clk_get_rate(stm32port->clk); if (!stm32port->port.uartclk) { - ret = -EINVAL; - goto err_clk; + return -EINVAL; } stm32port->fifoen = stm32port->info->cfg.has_fifo; @@ -1625,8 +1614,7 @@ static int stm32_usart_init_port(struct stm32_port *stm32port, stm32port->gpios = mctrl_gpio_init(&stm32port->port, 0); if (IS_ERR(stm32port->gpios)) { - ret = PTR_ERR(stm32port->gpios); - goto err_clk; + return PTR_ERR(stm32port->gpios); } /* @@ -1637,16 +1625,9 @@ static int stm32_usart_init_port(struct stm32_port *stm32port, if (mctrl_gpio_to_gpiod(stm32port->gpios, UART_GPIO_CTS) || mctrl_gpio_to_gpiod(stm32port->gpios, UART_GPIO_RTS)) { dev_err(&pdev->dev, "Conflicting RTS/CTS config\n"); - ret = -EINVAL; - goto err_clk; + return -EINVAL; } } - - return ret; - -err_clk: - clk_disable_unprepare(stm32port->clk); - return ret; } @@ -1853,8 +1834,6 @@ static int stm32_usart_serial_probe(struct platform_device *pdev) if (stm32port->wakeup_src) device_set_wakeup_capable(&pdev->dev, false); - stm32_usart_deinit_port(stm32port); - err_dma_tx: if (stm32port->tx_ch) dma_release_channel(stm32port->tx_ch); @@ -1904,7 +1883,6 @@ static void stm32_usart_serial_remove(struct platform_device *pdev) device_init_wakeup(&pdev->dev, false); } - stm32_usart_deinit_port(stm32_port); } static void __maybe_unused stm32_usart_console_putchar(struct uart_port *port, unsigned char ch)