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: 13772602 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 CE5303BB47; Thu, 22 Aug 2024 03:40:51 +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=1724298053; cv=fail; b=oCJkiqOAB8mXwGUZeO8/lGenBzvku5H7GcFsntV4byfNlBcc2l7pUXrXJhFPrWvzqj8Fc2uzAKHIpng4b4n3RHaEs5uQCK4cRGXc492jBQ/bt4JsTudl84beD5LkbiUMl4EDwOon7SiDuIZhGyErK2U4GcCKTmAchge/pxLUn4I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724298053; c=relaxed/simple; bh=TJ8P7fIVLltB+piqkcmiTiDn8qW4f9Z+LUiQ8Dt3xDI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=I2tUMWVcPRAXH81JktW/VUKp7gePJM3qvA3SnJ8f3471aYQc4zjGEhhBpFjA+C2EHIsJO9Zz0CoYKyB5bzLyUpac/No8Kmd5V0Rn4DPQ3I921SGgLEeRxW1gS9IJGSSiHWfsaCrZWyrOCkEiKKfxk7Rynr7Kb3G/FZi1COEcRUY= 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=B/ZWYSg2; 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="B/ZWYSg2" 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) Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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: x1IovNe46QwJN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7NsDBYO+kOcF1i9jP4KpjhbVT8XQg+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/bFRYtRL2hU4FWRacqMAJ35U4yJk5v8FmN515pNGzN5R1wq9OJIflBxEk9Tx8NBopGqqjkBXlveP7qriOF0woR44t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dUdCiEAIkbt5NmMBpLGfUwwBsc/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 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;