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: 13777683 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 14525C5321E for ; Mon, 26 Aug 2024 11:34:22 +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=RpF/ZRXxznWXnDGBAojA1le7WyXvlVDIX3kKIaUGpxY=; b=ZbtensUkT760gtXOfCvRtwY6yw aP4yHRS0FhRaw5VZSKzrgDbCMWHcQa3McRdD9gebmQ7k3bOpAogV17ksMhuP9LGdV4Z81A55FNpLK djs/t/XMVy0/fArfHOLazAXy28VIMBPkZwYq1z2WNCxVNWcEdewg7cTYUiUaO033+gKoat1xsppS3 4/j9Cv0ATWAFcMjLBI3Zz+HPBvs7UQQWqFzKNR79hFEibPztb0Sb1LoVTyw0DPz+GFHo84248jUoQ rYhT29gl9dE5uiwPvxW0E6rI6H9QaXUzUniA3yVgWOU1/zOX5R8BK+BEikYk4SrAuseDF01HkNiBK wT6bUYmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siXzA-000000079ls-2wRr; Mon, 26 Aug 2024 11:34:12 +0000 Received: from mail-sgaapc01on2060c.outbound.protection.outlook.com ([2a01:111:f400:feab::60c] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siXyM-000000079Zy-2Tu9 for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 11:33:24 +0000 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) 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+CfRMONsJ6653Lp7E4j2vJrUJncRNVGUj4r5PjYfALRKB32t+HXQkBCCwKIp9uwyZ1xTeUUeb4i81Ip3BUW7So++TWur+tLsM9q7wHRjEV4so0i2XmdW2WnO0OMHXXcIiSi1oUiNheUO3QFxubvYOF5txJ+qmzOQoDVohaAZCfkQig2F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V: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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_043322_643179_7EAF0424 X-CRM114-Status: GOOD ( 11.38 ) 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(). --- 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: 13777684 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 22BACC5321D for ; Mon, 26 Aug 2024 11:35:09 +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=Z5F4Z5JDNEo2PMJrYJBGtWIRDfs1Ke+lcfNrt8WbmNc=; b=s72r1qBSqeYWqY5jszpe9LgOC6 Lqh0RD1iSdKtALG2OdZvol4ujEyB+yFu287w/xwWoZn/sc2lFA1t+5DTHp9dAE38Y/5+Y5xEdYTzc 7kNlm13t4AY9Zn6C0wo+nBqThDq+fNvNPNw842UuZg7HyXWs9IpOM9Ugd/hz8Up9xci3ZnjPPrjJL RDxrgKITn3YW8ZZqkpyvz6UdkJ5n4QUC8paQdnWHjRs+y+BbnxPY9ojvft900CPGwfE9rbuXfRI4/ mlIscjed6AoJVRG/Qqz06vzSmA4iOH9fTYkyiNXGFiY4CE4ndRqiYO7w2XQvf6G8A20sk2NyW5o0F 1KXFs3SA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siXzt-000000079qq-2Rhu; Mon, 26 Aug 2024 11:34:57 +0000 Received: from mail-tyzapc01on20607.outbound.protection.outlook.com ([2a01:111:f403:2011::607] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siXyd-000000079em-274g; Mon, 26 Aug 2024 11:33:40 +0000 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) 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+GFkFdPR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1p33z1D4OLn0RMlpllWOSfAZSv04ITrbXGONVXibY2TAhRc7mud9BOmHDsCV7pTbkPyijua0GS39wz/0vtJ4f8kLj66P9wtLepfd6fbwXPSQhiY2YTfSvgh4g1aJIZIZDDUcjMef9aTYCdlcC04342v/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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_043339_565080_34184C86 X-CRM114-Status: GOOD ( 13.22 ) 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(). --- 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: 13777685 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 28401C5321D for ; Mon, 26 Aug 2024 11:35: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=QsMgzjnnY3ZsB+QmPl0tL0sbVOWt8kUn6YkHnoiFUEQ=; b=1sMR5B+K8WFstD5bdzkEd8vUGE Y8xeqJrw2XMoEGznmQ5RDS4bz5bOOlnbefhOxFR9B69vfmMueirnJotyUNa7FOAjkT7Vod+Unykdb PRx03/7gy+NoiaGwJyIGu0H8YwlyPVLxKsEwc8r6zduFGyuorsDsoo9y8xTNoMtqn1eDSom4EVMlV fASTLgqALwoIOwnSIFg5fjQqm/AhKw3h67/SovFoovmpdVErDly1zd4T+P1rBJbIzeidKo8ZvOwWy sVe/DwNQIPWSdGtKXXxKjK7zc8z3ZVfXlcYsbmFNHVdz5t8aTqV6OFSx9bdGfsSRdf6cBNVfHGEUo cOhaQc0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1siY0e-000000079zq-1Bxu; Mon, 26 Aug 2024 11:35:44 +0000 Received: from mail-psaapc01on20605.outbound.protection.outlook.com ([2a01:111:f400:feae::605] helo=APC01-PSA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1siXyw-000000079ia-1VUA for linux-arm-kernel@lists.infradead.org; Mon, 26 Aug 2024 11:34:00 +0000 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) 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/49hOouBXpBiAlE5KKS74Ew4PZ6zcqfKKUTS/qaww+PnEYRuT2m9c3zK/0TWSc0s6YfrcLZT95oFosr1wlu4RvbWoTw7hiqpgCk3yPDu0BfXwxsdMiIm4TPfklF3pI6nBbrM4zzT/dKj0cdStNx/3+FnYJln4kfBweijWRPXDQlLazmSZbq0qp51CWq22RMuRC90dmrNQ3pmwc1ptpBJ0i4n71vrwfdhMcBscoZIdEeQ8Oo34+nH2031fwctk38sPKhmPtRH+yo/jLrHHL5Nz3Kb5tsfpSU0btWYj/sj5BK3uP4/KUvhjKwQ/KOkGBLDJ2fcitfJ3cImUvWa6SBYR7YFMEpQexRqttiQat8HHuPSJH73l3zx+qMgZf9shA8Ip1gbLNHTBizaTGNqJ7oYZHV7tZ5qKYrs4u0QPoHzFPrSxBkiV3tyd3O4CXOdmLBvz94sCrTI8RYidNHISv+WkLubRW4B6xelQWrN7UcItg+oniIrDJq87eAS+tQtlv2TZVP6oo0HceQD11pUjB1isn9VFVjl6vbtbTFvp0CX+lniGa2EqCt/SJtoGATZ16XSwoq6bRkUNg6EhMPjOAvdfUUMFNcFiPZVchvSyfE00fe2wMiix8sfW0BcdU/gmir340TiAKhYs895b3F6HlK6HYM3F2rR4JMrvpggr60QR48s5GdCpJs+mT7aJGQJMncZZCVDG95JOT5O/yQEAfjzmG1M6VUlOMzH94ufudCnBhMNHJYYb/oTELFEfaWY5Sy7ruWh+KkiojgtnEE020CIfNBhq2/Cu9Faalb/DS3Ti5It2okYVAG3nYdEt6QYSQFavZf+4FGPj/3RPrl9IWedPSp3JFH69+PJid4k32Bv/9k3ApDnsv1i71uteVUCvw6o7Fp0riv002yKOdLhbtVECEr0we3f+8LiHtTLv8YnI1Z96QQayflrvrjZo2CrOvXbM5VQ1yr0SVL0hUpyD2lPMgmMaAF0lvFdEclZAyO59lQj0iThUQDgPmzdTSEg8CEbhiicWgduFuOOuyfkS0YSP+A7pflIXdO/2SUzmvkMDUgvPKAat+KzjwpA/MKQhr0WuBaRBqBOxsxK8Wi6Qd+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/SBniVcH7sydTKEVGH5Z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qpaAq4iTAux45KFR6Y2s/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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240826_043358_877727_35AABEF7 X-CRM114-Status: GOOD ( 13.61 ) 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(). --- 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)