From patchwork Thu Aug 22 03:39:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772614 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 78FF7C52D7C for ; Thu, 22 Aug 2024 03:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding: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=TuVPlrCnGOACyppIwzEZUACeNu4uBImXg2pp/U8N9Us=; b=Oiy3SMccrleDb6RFnLDX4KZ84S b3c22jfZzHaRV4jwBgBxBbENlOEIzzhGCpQ+1q3La8ExVmhOUUS8pT6M124DGCuPc0s77xy/+cGXP 8FIFQ6xFwWLdwXmQGyBCn12jdNHiJ8fdK5kFPqIm+e2eC4/gh1XqMONGGEyrQEpUFKvApme+IZ4ef 4ubzzFb9u+tJX6+sie6EvaciCQdAISowqlmxXoQWV4mTvImddSJgD/d5/SJHb36/0VP4mpdf7T3C9 vVgoBAjts8dIL435r3cxiklXWkXMmxb1x/WHntPXHQiS7uHRuad4Lankw0mmbkrm5Vu/9hYlFUQUI mxjWOqzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgylZ-0000000BGJK-39BY; Thu, 22 Aug 2024 03:45:41 +0000 Received: from mail-eastasiaazlp170100000.outbound.protection.outlook.com ([2a01:111:f403:c400::] helo=HK2PR02CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgyhM-0000000BFF7-0of9; Thu, 22 Aug 2024 03:41:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=v5Q2P/rH5AjYvsT2uqRL1ZOHOvP4IRr9uV/r1jLkIdAsFighwPyB/pgcMx8CiLs/ufAwr2AjOyG6ptMJo+y9WxDg2NmHEy1OUqp1e/lqB3ERVpxvQDbb2ja9texL2fVq90FFPhYKT141/HZd0RhrpbGIZdnTar2bV/guL1xXXgesg2kS6jCsiSeDX32CmEHxWSIbCJyp/akZ2G5eXD5n2NWno7/hbnJVBfGtyIiAAV/rKt+U3N7+2J4BnRFapix+jG6PBHWthgFnPuy1in5pS13xoEzPpCUCW5OOKIjotl3fYcOD6cs6KQEY/1uFtNs0e32xEaWCLEpdb9Hx71eMsw== 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=TuVPlrCnGOACyppIwzEZUACeNu4uBImXg2pp/U8N9Us=; b=OKRUm8nmHqBMGp3qNVCdzxy1NuZSNNn/dYbnzOdlyW+qQ2XZb71tDtR1Q0dA/qDFeAjVau5hyoS7ouc5GWBSTAtFqp3YGfa7cQh3xYdUbwO1j+K0r6B7i73qv+lZn8PwjKqQCDVrc/Au/Eutgi5s7B7VHhNMdereakmdAr8uZbd5dBAisq2clKuG58ivGu22gXuGj223oIm4QIqj8heWPia55krPwECbNbp0u1c+Frc/Auf6XxvlFUmzGJ0tZCeDeriag8KkU4xBa1StDbCV87dd+PjEEx9A/TtmG0hpIXFSCAgamSL0tSiQMC7+V9nsl6VxTbnSPApIJOqMlUcaTg== 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=TuVPlrCnGOACyppIwzEZUACeNu4uBImXg2pp/U8N9Us=; b=ZYXB6hUHbnG5p5k1oMotEq5EeUBrSmmk5fYyxMXDJ6oMRY67myJHWuHgAErsc65B/eVlcSy5Utn3z7iq++ZUzS8zdo1LaaUpouQB7zULAFMZ5haeoCHws5y8jBxnROu++9PuQC/8QsV5gEsO3KUsBl0QpbPEbs6hA6dQbo30SQRelm+lMN6aDQBkdWJ97u/jKaLa+MV4SuKceAaUCz6ukPJbMCHsuDNF57mW/pg6B6ho9yYK9mlJgnamvU8+0EH2mqckI1l1O2Ds+zMkXG08UOgeO2VxvK3IGaK0AZcaGQLqT5wHNYfMHqT8xkiujKPdZif/P38anF8rYd7YiCqNYw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PUZPR06MB5620.apcprd06.prod.outlook.com (2603:1096:301:ee::9) by SEYPR06MB5892.apcprd06.prod.outlook.com (2603:1096:101:d5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.18; Thu, 22 Aug 2024 03:41:06 +0000 Received: from PUZPR06MB5620.apcprd06.prod.outlook.com ([fe80::b771:8e9f:2fb:ee83]) by PUZPR06MB5620.apcprd06.prod.outlook.com ([fe80::b771:8e9f:2fb:ee83%7]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 03:41:06 +0000 From: Lei Liu To: Paul Cercueil , Greg Kroah-Hartman , Jiri Slaby , Thierry Reding , Jonathan Hunter , Kunihiko Hayashi , Masami Hiramatsu , Richard Genoud , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Liviu Dudau , Sudeep Holla , Lorenzo Pieralisi , =?utf-8?q?Andreas_F=C3=A4rber?= , Manivannan Sadhasivam , Patrice Chotard , Maxime Coquelin , Alexandre Torgue , Lei Liu , AngeloGioacchino Del Regno , Andy Shevchenko , Geert Uytterhoeven , =?utf-8?q?Uwe_Kleine-K=C3=B6n?= =?utf-8?q?ig?= , John Ogness , Thomas Gleixner , Sebastian Andrzej Siewior , Jeff Johnson , Valentin Caron , Lino Sanfilippo , Amelie Delaunay , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Cc: opensource.kernel@vivo.com Subject: [PATCH 5/8] tty: mps2-uart: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 11:39:09 +0800 Message-Id: <20240822033924.32397-6-liulei.rjpt@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822033924.32397-1-liulei.rjpt@vivo.com> References: <20240822033924.32397-1-liulei.rjpt@vivo.com> X-ClientProxiedBy: TYAPR01CA0108.jpnprd01.prod.outlook.com (2603:1096:404:2a::24) To PUZPR06MB5620.apcprd06.prod.outlook.com (2603:1096:301:ee::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5620:EE_|SEYPR06MB5892:EE_ X-MS-Office365-Filtering-Correlation-Id: 552164c2-1af2-4950-022c-08dcc25c40a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024|52116014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: iIFecgyzDXSXkOV3e4eGwobLGy99JhYYzbK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UE/KpPs4pfUbrU3fFi8YrXQh2oaTeV2qPRBq30kMPk/WCqYcSkgvMqH6C8r1oiNk5DvfPTxdBF8YQGps+P/4YVj/HWHt3P3+gY7ucPJztK2u9qFh8XWCQuIaxh0rBp7vzw3WJEoB+wjcK0uhigxBxVi//4a2J5p7p7A4pZuYCZ48TK88kY+dKjL5kQvDXO2LkWI2BRbbjL6vXUUSYZJoaLQG1Xk7+1JOK8cXzOEw/IUrf34WMLsq0Qbl+++La+bcOoSfLQ/lTcoV0tdjvQC+1YwVy9ROqaaNPbTVKSCLmytCBdd4jH+uBtIUXmPaUfwMZ2KJezHpq+edhCCjbztA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5620.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(1800799024)(52116014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MFcSmUPqHCNMQgcPH/Pe/aQ9LoQWdeXuX0v3t6e2AOPbUmkS6DlWr0yFMqZxW9ZEwQ4aUD/jrpw3lmiWx0AqvsAV7quuapuzb8to1ZZL0tu+iHtNgPsjBhZ8y1AfknXsULlJ6p1Na/gEIabf+8X0ls9rVB/fEf66XeoCSnA3gzfUypFSuOLHkGYnHwX3NM8RlGmeq+kvu+TGIPYKABpNr7czk3luCosxJ2uIdJGl10er5PLaVQuvWQHWUKi1ria/IwYQFKi2fvEN1rsmLZJviEWpFYVwuOjWvyGbRQza9uiiHTEZeoahfl7UvatM7t5O10AqTkPcVun3zvLajKDRA1OrL16ftWpJbD5+4qZHRr9OXNP4MrgRvOR28IEr/rOF7BYq1Jm/rqtx9J/Zw0+WvD0lBWSxoJ3Uns9ILT3zuLiUNem/NrQUlHZ7exI+I8AtJKfReQZ989jBXLU85ft0bNUf2slRog8TF2YSyxkl/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CPBrOX3TdAuUyIUiKbJWH1cZeTejHOswIKrq08JWgWMihf X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 552164c2-1af2-4950-022c-08dcc25c40a7 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5620.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 03:41:05.9052 (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: 7vZGft7/0eMr3U3Q5bwnfpeg0mQE/FyoMvLYB7c31Ixzmrv2/Fnr9r5D71LBZSV95IH5TUOTOBqrBbOUPe9yEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB5892 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_204120_261100_13CA54E8 X-CRM114-Status: GOOD ( 11.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The devm_clk_get_enabled() helpers: - call devm_clk_get() - call clk_prepare_enable() and register what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids calls to clk_disable_unprepare(). Signed-off-by: Lei Liu --- drivers/tty/serial/mps2-uart.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/tty/serial/mps2-uart.c b/drivers/tty/serial/mps2-uart.c index 2a4c09f3a834..e582fd6c4632 100644 --- a/drivers/tty/serial/mps2-uart.c +++ b/drivers/tty/serial/mps2-uart.c @@ -550,19 +550,12 @@ static int mps2_init_port(struct platform_device *pdev, mps_port->port.ops = &mps2_uart_pops; mps_port->port.dev = &pdev->dev; - mps_port->clk = devm_clk_get(&pdev->dev, NULL); + mps_port->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(mps_port->clk)) return PTR_ERR(mps_port->clk); - ret = clk_prepare_enable(mps_port->clk); - if (ret) - return ret; - mps_port->port.uartclk = clk_get_rate(mps_port->clk); - clk_disable_unprepare(mps_port->clk); - - if (mps_port->flags & UART_PORT_COMBINED_IRQ) { mps_port->port.irq = platform_get_irq(pdev, 0); } else {