From patchwork Thu Aug 22 03:39:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Liu X-Patchwork-Id: 13772611 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 51AFBC3DA4A for ; Thu, 22 Aug 2024 03:43:51 +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=kGVFJ6j7VvGl76/0BQtiLrQS1eP9sDog5mlt9fbvc4A=; b=WdrCYclPWo5fhRcTAZHZB/ApRZ 0eXXDFiWe/m90PhJPea7vUIkbLsszvuujEOybZtM3Ak8yOZdzhIa9yUlXdMUFccTJ6e1D2iIZHcIT Qxnz3rnl91q9Peq7xYbkV2pheLcJkQtLa97zXihS19z6Q6A3HBwGHazsP8XTq50uqpzkigWwBfxDE AoVfNcVTra3cuc2JK93swRozZT9aKYsYZ59e49YojExxyKYHJ9cw3hOJS6FYFQ7/kBS3+j3TKOLh9 Q741J+Ews30ZsuVjtydcu2XJMxRJ/ugvPUy++ziB65/WbO6+ikjxV5FTo7MEbyFP396xKSBwY3bfZ qJkd8rQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgyjZ-0000000BG1K-0hCu; Thu, 22 Aug 2024 03:43:37 +0000 Received: from mail-psaapc01on20600.outbound.protection.outlook.com ([2a01:111:f400:feae::600] helo=APC01-PSA-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgygz-0000000BF87-0IU2; Thu, 22 Aug 2024 03:40:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DacGC7QqnLr2EmFCeu4Q+3ZUzw4QlgI5nwzsAEZF/rPoG56lSEsof+s/u5nBJ0xt6cPjhRK258WSZ9hfP6xCdiKETwg5o5qSMAVi78ACpfzjhXCFkEPYLbgdy6oaQEpDdWwp6QyVmri5OId3W8Q/aRZ7BYHvr84THJwAwrD81Nv4YCJgC6aqoHu9U0QKymxcivj2mEYqdTfrjG70mX0SQwvmk+zls5fvegldluj/Yiln3rRA5/Rpnw77djiygzZrXOvPuSHXkr4DFZGqHcI+d9ABDZyWNvDh3GnqYDNMNG0mxO031FijoozmNW3W2WgK14sJTYRaFBbpHig7fDl53g== 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=kGVFJ6j7VvGl76/0BQtiLrQS1eP9sDog5mlt9fbvc4A=; b=NUzM50E2wYO520ItDqj5MOQ7Iz3DgKhZ8CGZox72dGMDBg1caONX4gmArjzk4IV8lNKnGDvQ4HKhUoKRJlh3hXXZ1uXXn/Rhl++OOOF1PEesBJsLTcQYNZ2dpC+w8HlnFSrLmMPNhKhrvy17iI0pmxmwTpdIX4M7Nz9b4hNzp8sPRKjWMg208WvTnwja9fGE+ST2cg3Wo96fJobo2eRBqU+PllkbLhBhYhR4ou8prkxE9kAFvIhM5vLRT5mpD+bpNE9M3XCbatUqTc8FXNEVa/Fs5Yc3zqHN/B4p+/ZO/1k8aawW1Q5BsCx/V51JuHh1GkDDTq7lzJkXWUBEWbb49w== 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=kGVFJ6j7VvGl76/0BQtiLrQS1eP9sDog5mlt9fbvc4A=; b=B/ZWYSg2NPOHlna/9LY07edUX5KBRvoYhNVt6IgV9FkYmgqZAx8FGpShreDiK1GzZxJN4E78Txow2hjuJe1wD6t9ox17IUuZHTl7NxAO7u0pIZXdYG/p2j6dLZRZEABk05JAztEJAAPx7qwXYmLXzQT3kYkPRwVXagESEb7eKwJ26H9hpL5oAvvAzs0wqsVvMvpohQd0ECAXmX4zwjTFqijT7+74PPcrLDRdiw7R/XWixL0ZL5DgX2BcxrnsEAJOCYa2UBcEC1hihaGeLSQcyW7jkFVRZlXt+Me03eSH3kWh1o5y1a7UuoU0kn4KonuXdivG5lC7Xq4hWuDfnEgXyA== 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 TYZPR06MB6565.apcprd06.prod.outlook.com (2603:1096:400:452::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Thu, 22 Aug 2024 03:40:49 +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:40:49 +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 , Andy Shevchenko , Andi Shyti , Florian Fainelli , Lei Liu , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , John Ogness , Thomas Gleixner , Jeff Johnson , Sebastian Andrzej Siewior , Valentin Caron , Lino Sanfilippo , Erwan Le Ray , 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 4/8] tty: atmel_serial: Use devm_clk_get_enabled() helpers Date: Thu, 22 Aug 2024 11:39:08 +0800 Message-Id: <20240822033924.32397-5-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_|TYZPR06MB6565:EE_ X-MS-Office365-Filtering-Correlation-Id: b04d88e9-88cd-4564-98d5-08dcc25c368f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|7416014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: x1IovNe46QwJN8FA62+4TkYtTq+TzZMm/y7VKfZolO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Qg+3hwsFzTRh8rNcsAhZMikXt66h87r7Wx7KRuPmazj1qMxjn2kA7HXi+F5eKZQNi5ThmcISYmJK71wYNu/UdEykP18fCij7CnUUng+5OKSyTnRRg23y8QaFxgqPF9VczFGycEZp5o2GKZX27Qk2J+tZNr7DztxVS7hP34ch9ydz1hwOwwNi3LEou3pKSjOYnmsTd+ZqSoF8pSW8Ix1tS+ZO1501/0McNngmvAccsu3jGBikUQ8TfNCjQVk+yRYx1R76FGJXk9oDsv9sPTrzJysMIT31e0MwPJUU9tjuuUqiyO0ASmY3nNQZZsHUlQrrh2uZeXXk= 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)(1800799024)(366016)(52116014)(7416014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nkLN/DgxAImADRtAP4TAn6JKf/liJsbq5Z8IHmqZvs7cEsjnuxHsQuMEzx+G44ChA2JC9JsB4gng2MT0wqr2d+Hc9cSrNxyFeWoki77YxjyoQfeuwBRdvwlQGBPXDjhAtH3JLj+FLGagvnJNL/6ZLevSCjfKPHKXC2/sklwyBpUYq7w8rU1kxQYtwf7IojH6c6FX/UxMv5Wu+FITJBeXinGDGzAZkqcMuqhROcothNymO/KYGkR7I8OU+Ul5FudJ7AHoNrqccdkxHg0z/Kt3p71wWgPmvL15sFIHz1fvOcPGHKDbRLn8MZyUSGKUKA7fr9Wf6Ii3gdI9jhInC/3gInQeK+qmLgbwT/BWhVJB30UHb4SkbcWb1iqvavEyidCPVp+bwML6lLXXfMNjGicD/bFRYtRL2hU4FWRacqMAJ35U4yJk5v8FmN515pNGzN5R1wq9OJIflBxEk9Tx8NBopGqqjkBXlveP7qriOF0woR44tv4sffvuK45HIR9X8IZQxtQkqYdndqV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qefa X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b04d88e9-88cd-4564-98d5-08dcc25c368f 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:40:48.9815 (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: /5takiTZWaj+4/DJu7CulBPrkuIgM8b48Xma3xK5tUfy7kYEHobF8VlUcPdJtY/ArNZ/VcLaxOQHIOMV7m+/oQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6565 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_204057_143366_4435AFE2 X-CRM114-Status: GOOD ( 12.88 ) 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/atmel_serial.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 09b246c9e389..209f3d41a17c 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -2910,14 +2910,11 @@ static int atmel_serial_probe(struct platform_device *pdev) atomic_set(&atmel_port->tasklet_shutdown, 0); spin_lock_init(&atmel_port->lock_suspended); - atmel_port->clk = devm_clk_get(&pdev->dev, "usart"); + atmel_port->clk = devm_clk_get_enabled(&pdev->dev, "usart"); if (IS_ERR(atmel_port->clk)) { ret = PTR_ERR(atmel_port->clk); goto err; } - ret = clk_prepare_enable(atmel_port->clk); - if (ret) - goto err; atmel_port->gclk = devm_clk_get_optional(&pdev->dev, "gclk"); if (IS_ERR(atmel_port->gclk)) { @@ -2968,15 +2965,12 @@ static int atmel_serial_probe(struct platform_device *pdev) * The peripheral clock can now safely be disabled till the port * is used */ - clk_disable_unprepare(atmel_port->clk); - return 0; err_add_port: kfree(atmel_port->rx_ring.buf); atmel_port->rx_ring.buf = NULL; err_clk_disable_unprepare: - clk_disable_unprepare(atmel_port->clk); clear_bit(atmel_port->uart.line, atmel_ports_in_use); err: return ret;