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: 13772970 X-Patchwork-Delegate: geert@linux-m68k.org Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11010023.outbound.protection.outlook.com [52.101.128.23]) (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 1E14717DFE6; Thu, 22 Aug 2024 08:32:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.128.23 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315577; cv=fail; b=Ctg0uHbSlSjuM5ztXyixIobBL1542yy7QQW8uHd85U5zW35cL5VfxX6CADoY9xoKW3lsyJxRzvq29QLTBo+pVBoqULklEWpxUdQuojOyKY3+FDQu1qkb3j4BJlmAs5IpUVlkGyTLbUbikLVOiD1jQyNx8V92WBR4AmwcvNDBxjA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315577; c=relaxed/simple; bh=bSCOSjEz/rydInwi6wkL0kzgSk7IzS6wZ9TVTel0GMQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=a/Dr0Du24R0bA64TCLYZwdt2Yq/rRhKRTmrKLg/sSxpMN94h6mjmLbUi00qE+yu0YgVbzYRZ/MVLk6fqyDgp8aoWT0Tc1hSolwZAQkRGZKJSM2qznJgQfjwblcaF9/u5eeozR1IvQulew8sty3rh7ei7KW/zDo6xdIdbaEv7bEU= 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=q3mFEKxd; arc=fail smtp.client-ip=52.101.128.23 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="q3mFEKxd" 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) Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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/86JObyvZrWfvq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IOQvaRgnY23Jiv6hYQzl6Nn2C4tTi5+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/W6AXvrm24jFSVvMuK7biCB5aSbmOYv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rossTenant-Network-Message-Id: 2fa632f3-455b-4003-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 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)