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/hFJzRg5fVfq3NTlitRPLS4nuReEvz1VSIIPYc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hiY2YTfSvgh4g1aJIZIZDDUcjMef9aTYCdlcC04342v/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 = {