From patchwork Thu Aug 22 08:47:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13772996 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 1EE71C3DA4A for ; Thu, 22 Aug 2024 08:35:53 +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=8d+6h7KOTyM+MD+Oybw2j6gPuao0KsZVAKxbqYJhA4c=; b=Fe97+iRNpONajwt40yVycKcuYH QIpAkPZ04JLDPMO6qfz6gwOYCeXj8wnkedwxeXNvsgqtmhk0isaUpEnM5raRDhKSpmU+xGEc4mXtA vRPxEZQ4mam9vSjjl6gUuUkSq+bEBTbyvj6OvImVIUQWFBGGJSQvycmjxQgMCUKUPPQ5bzdotgZT9 7CVKjPHFqMaob5LhR0ikaGS/BkdLsGuc64LeZ3xZB567EwHmOLPouPmicSexDBTnaenilNVJS7Swq YgZzsuEblw6eyXYo52/7Lir00f/8BjWbTT0z/HOhHGadVbwHYKWwU7dxhMZvo+hbbjJJzZ/NvHJaZ mYBoN+ZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sh3IG-0000000C5E0-20tz; Thu, 22 Aug 2024 08:35:44 +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 1sh3Fa-0000000C4LB-2iR7 for linux-arm-kernel@lists.infradead.org; Thu, 22 Aug 2024 08:33:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yd1NuKQWdm/nNRA60r3ZZ70Nj5Cd8ENshaL1CwJIGSSwXsKeN8lvx4SclXajw0410pMSJG+DqTNiyF7YUE8aq8rfXWQqOBo61eEV7i02sIncJjehlwp0evPHtMvXpWDahQAyq9Qe7Qw9fojHdvc9Dnwar8s4k1DduQWOumboPohYnxCUBrWwbZBP2dd0VS4dUQkaJHapSRz9gYzGkeShmyIA2UyGVLuE8zla6v3GWXOMQQEiWc4utnOf/C0U7xfFOfMom0J4SQ9S9BqPUSf2UfeU4aKx0VrpxNkSs5K8VbLiBL7He6H58sqzb9EGblEDmA5/8wmlSVhKdg352ulfNA== 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=8d+6h7KOTyM+MD+Oybw2j6gPuao0KsZVAKxbqYJhA4c=; b=GzTGNUCihvDjPb8l/Hg7pWDPzhCtyF9FnNhHzYu/e5h5Ds92ToWqFAj+2Cexhlh0dhC4sJNUxba1LAqz0lu9SzFkckJR4KnJSDUuINMGQ46bYurHzKdXtRLf4C3uD0Kc7dcty59K4m7cZSA5/aDbErPwU5Vv5tc4QbzhlFKyKsDtu4a61KMN3BIK/d89aBXcnkeJxjEVYh5LKJ0ctY+9mcLNGcb+8YhtaRrjbAL1IIpPKNNoYjoAPlK3qPyWXsQNREbuHpQxcmu+WUUp/xY77giUt3zBaAxxWOAMwBPmmuphlYJKeDOq/jLIqHsyR9EzPmQvuRbwoWgTAQxIDtMksA== 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=8d+6h7KOTyM+MD+Oybw2j6gPuao0KsZVAKxbqYJhA4c=; b=q3mFEKxdImf/6eYeZWUjbKwYpq9ezPOqM1hybTalNObyg0kD24pRH5yS0KE+9d/Ub3HdcapN8k1PXOO5/gmedFM9qwTSghEtTmAhfOev8SORgxk/3ta2Sw/jGfJQGTm4bOP3z+LghZDikzcsHHW0ipa7TDisYFmaie01TMZXcGs2EEvMKAua9IG+nIhfC0ux3wQvpMnJR2JvZ3czvepa7iqAQ1Huyo+/w7Q8muyeBbEazGaKta53vOHXiWu8zuTt1vR3SEoh81mP9LNvLZ8aWbN4l+uP//8XDeCK/oWg9C0pIcccYSGAXPBymSG6eY5d04zKjczfbUb7ROXsQwNWMw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) by KL1PR06MB6259.apcprd06.prod.outlook.com (2603:1096:820:d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.25; Thu, 22 Aug 2024 08:32:53 +0000 Received: from TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1]) by TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1%3]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 08:32:53 +0000 From: Yangtao Li To: clement.leger@bootlin.com, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ulli.kroll@googlemail.com, linus.walleij@linaro.org, marcin.s.wojtas@gmail.com, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com, hkallweit1@gmail.com, justinstitt@google.com, kees@kernel.org, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, horms@kernel.org, shannon.nelson@amd.com Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Yangtao Li Subject: [net-next 3/9] net: ethernet: cortina: Convert to devm_clk_get_enabled() Date: Thu, 22 Aug 2024 02:47:27 -0600 Message-Id: <20240822084733.1599295-4-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822084733.1599295-1-frank.li@vivo.com> References: <20240822084733.1599295-1-frank.li@vivo.com> X-ClientProxiedBy: SGXP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::17) To TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5275:EE_|KL1PR06MB6259:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fa632f3-455b-4003-6672-08dcc28503c0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|366016|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: 49wg3UAqXAdcjgyGqiM5CvanMqpsgoy1Aj3Dfet7QzAFp+EvFixOtFB7LSt2fsHNG7Fn/zNsKao/KSoMM2WKn77c6sR/86JObyvZrWfvqZRog3m/ZO1Vzg9qiWFeBblwtK+4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tTi5+I8c/kpDQFB1ISaKwmJeXaNDIj3EOW3kfJv5jd9BTM/KWk7mZHe2Jnqf4/5Maz5rnZ7HcGc4PpAAP2hXcDgv2z/P0qkwK3hwTAMgs+2mtenEFfCBBAqvB21cD+zrdO9vkTa6pTHwzwBRuIc9PAsa3VyFKFNvcLLYQ50PopNCPu/3nS3KHy4SnAx4t9B9IVow4wEMfH7zRjsIsWBF/hg/xl/dcL6NaVPnlxooixHYyzP7KY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB5275.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(366016)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bJ/FHPcCHc+qeGCrGfJYpa4uIKcwQdEQitF+MWUuMJEVq95jboLLYIevUmGSFlVwcBTgl86dzOeoK9ut9KgulalPUyh+5O0AYP/7Q7zvoBu05PlaMA1O6OFTCZb7Qa2LgE8Un5SF4HGt3jXm0O9qmoXGTKg0NNxAffXDOmmpA7+SfLlnjilxOyUmBWydUAgndcnRzpAsAQ5GFeOwgLQiI5Q6stZkKj04MLVXLHdb+51Djz1AoELAS122kS0UR9P68XmhB4Rhe/irNJEqiWd1fYLkK8joA55xKJ1sNDh01bLd4aePyH6hefsY0VSg7iXG3njgEOxyEu6Z0aQC5IUvYLHLL+KvREW3GstorX40p4Go/8kHAQJmjr0ONQZN0GdeiyEf69kc2s8GhdSKWiLOinFguFHti9M0QK1RNAYJYwMKDPp5VV3mkWp/hBd2F+S3cIA4/rPoJPvQ3tFUmvgDt3076mOhAy6Hvb7O7wPs9OgNAZte1aHy1SDxvrQaVeo6Q+EyFToSH1zTHQpoOgGcnA/W6AXvrm24jFSVvMuK7biCB5aSbmOYv9B+7h/X9hCSnCmZLlIxjDM9btKy1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003-6672-08dcc28503c0 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB5275.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 08:32:53.0329 (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: k2tmFtKJKIbkTWWWb/FiwAKHYtuz58CO9GlqU/AHyQ18X5oYw+U0bY/2Xuf23Y0SeSAvaGwvHdkpiH1LXsT5Cg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6259 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240822_013258_719619_B4522063 X-CRM114-Status: GOOD ( 13.60 ) 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 Convert devm_clk_get(), clk_prepare_enable() to a single call to devm_clk_get_enabled(), as this is exactly what this function does. Signed-off-by: Yangtao Li Reviewed-by: Maxime Chevallier Reviewed-by: Linus Walleij --- drivers/net/ethernet/cortina/gemini.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 73e1c71c5092..90a14e03a782 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -109,7 +109,6 @@ struct gemini_ethernet_port { struct device *dev; void __iomem *dma_base; void __iomem *gmac_base; - struct clk *pclk; struct reset_control *reset; int irq; __le32 mac_addr[3]; @@ -2326,7 +2325,6 @@ static void gemini_port_remove(struct gemini_ethernet_port *port) phy_disconnect(port->netdev->phydev); unregister_netdev(port->netdev); } - clk_disable_unprepare(port->pclk); geth_cleanup_freeq(port->geth); } @@ -2403,6 +2401,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) struct device *parent; u8 mac[ETH_ALEN]; unsigned int id; + struct clk *pclk; int irq; int ret; @@ -2453,14 +2452,11 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) port->irq = irq; /* Clock the port */ - port->pclk = devm_clk_get(dev, "PCLK"); - if (IS_ERR(port->pclk)) { + pclk = devm_clk_get_enabled(dev, "PCLK"); + if (IS_ERR(pclk)) { dev_err(dev, "no PCLK\n"); - return PTR_ERR(port->pclk); + return PTR_ERR(pclk); } - ret = clk_prepare_enable(port->pclk); - if (ret) - return ret; /* Maybe there is a nice ethernet address we should use */ gemini_port_save_mac_addr(port); @@ -2469,8 +2465,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) port->reset = devm_reset_control_get_exclusive(dev, NULL); if (IS_ERR(port->reset)) { dev_err(dev, "no reset\n"); - ret = PTR_ERR(port->reset); - goto unprepare; + return PTR_ERR(port->reset); } reset_control_reset(port->reset); usleep_range(100, 500); @@ -2532,24 +2527,20 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) port_names[port->id], port); if (ret) - goto unprepare; + return ret; ret = gmac_setup_phy(netdev); if (ret) { netdev_err(netdev, "PHY init failed\n"); - goto unprepare; + return ret; } ret = register_netdev(netdev); if (ret) - goto unprepare; + return ret; return 0; - -unprepare: - clk_disable_unprepare(port->pclk); - return ret; } static void gemini_ethernet_port_remove(struct platform_device *pdev)