From patchwork Tue Aug 27 09:57:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13779145 X-Patchwork-Delegate: geert@linux-m68k.org Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2067.outbound.protection.outlook.com [40.107.255.67]) (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 110B819CD08; Tue, 27 Aug 2024 09:42:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751740; cv=fail; b=KnbEkr927X8VID2rgp/IHUAQt/4n/JnA6H0yp2IHrAWRY0PumNOTpY9uy3pViahf05x5DI5WuLM/2ocRzf9TEHPyTuDAt/XSjdIofPEFkNKngZWDEa3WKJ/QSIYeVvkjUkCBJd6cJH1usARmjnKiNtOioL5Y5/yN84Rb46LiARc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751740; c=relaxed/simple; bh=iJ643tR7zH3ZBtTySjCVJyQlQQK4LHdROae4Wbgdk88=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=lzLNfzBcY3LNP4XNe2XTgUj9OUlY1496RiqIVKCrW5SYhTqpAVAI4MAXdnOecZVOIQ3RWhoINGvv7G+P3OIcUGIAYGDFrWykk4ObbxpxcH7RjzOejmzYm/olxQ+ujdyAvn9DThdm7SYu6Qu6U9VqdmZg5nVB/Rm3E+qMxHgz37Y= 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=EEwrQFCz; arc=fail smtp.client-ip=40.107.255.67 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="EEwrQFCz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rg3tRNzRfCGF+wktlBltOoKmcRuD1K2aHp4bIIzSBUdWrbHUxai3FeepeiZw2oJOppOD5kldnvxRIJeuB+wZzi5vwWLBEmxF4Q+4kDuwR81iEv0aRuWsTWUuxFbGSSVtGvVRD9I56uwQL/1wTR8g9fNs3UZE2s8xahdHz4ehAGGi/xhUbQELjjwlyeqtcqcwmF0VJkSC09HY5mHhOj26wXfxNeIe03rp6szm3EDssUFqIMPuSRFt+V2qVUw/4wSbm4vBFEcdAshCyFAKNiRkWwY45ApuLZEqx6wALfI7iFOwTmh0TB6OWVssgTny41dEhZgvtUdkISVn87F/oJQyPA== 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=NIMUzEZdqDpYsZCHo/7JuWKu2sl4AMxMk+gt1puAWYE=; b=R7VopJFEezMaFlB3+HeL/nPaom1tanOnkXMacJ1WbQVrXfULCscj7weWjYc4falxSUhTT9BSdm9kf5FBY5wEvu2kl63MyOw1jGN/mGQ3bE3/YUG9sLWpQ3wBBvXfOpRyl0O5EXsuQEjqfs1zqX/RvF7yBSXfyBraTTWvgwarBkMh6Gp4/kk9nyK6OkEFzlftCvd5eC7NA2PadoKvwACDXdrS7GNToNDwYvIvlG5igaEHYBxmzlNnulNW5jX+ZNprevbUPSAwznanV1HSXwUO2B3J1EoKidVb97KyRwGAnynD5x/YmEiQ06KyhispiiyqpFl1xhw75UL33K5thRUjcw== 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=NIMUzEZdqDpYsZCHo/7JuWKu2sl4AMxMk+gt1puAWYE=; b=EEwrQFCzufPhNty0gzzCWEFJhRadwdS9PH5fqY1pClBRTcqBoCwAaK7SdBmB0XT5qb2BUw72eDQr+p5AQ/kpooCd9GhkLjll4ufOofHtIeSM8WdBGsweiUWeWDPzvPiMUCmO3HUcBBlsPx7HEzmqbWijJMaJMV0B4kN0R5qxOSSrTD6Bn6DNSNatiTtH7rvzIX3uXL7yuJpGNfszZERVC4caLnPfoVp97XI4RWC5SWCNk446pEN+Mfs2BpZ4NFJXZbbx60EOmSe2Aw8RXp463oAsiSYlPghi/chdC8goysiNLDx/sVEsfe6GSpV7EvvgsASAeRNpuSbn1/DGFUhIBA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB5734.apcprd06.prod.outlook.com (2603:1096:400:281::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 09:42:17 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535%7]) with mapi id 15.20.7897.021; Tue, 27 Aug 2024 09:42:16 +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, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, justinstitt@google.com, sd@queasysnail.net, horms@kernel.org 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 , Maxime Chevallier Subject: [net-next v3 1/9] net: stmmac: dwmac-intel-plat: Convert to devm_clk_get_enabled() Date: Tue, 27 Aug 2024 03:57:04 -0600 Message-Id: <20240827095712.2672820-2-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240827095712.2672820-1-frank.li@vivo.com> References: <20240827095712.2672820-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR02CA0053.apcprd02.prod.outlook.com (2603:1096:4:196::16) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::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: SEZPR06MB5269:EE_|TYZPR06MB5734:EE_ X-MS-Office365-Filtering-Correlation-Id: fa1ebd7a-673b-4617-de23-08dcc67c890b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|7416014|38350700014|921020; X-Microsoft-Antispam-Message-Info: yGz00mUNiiJnj5C8nhWddEg0JtD8PllI11HXWtLBJ/uzXNf/tRBQF92+iYeBNOD1SgatSMY8qqCRzjgkALWRQ8GaOOJjezXhS43Qldn/5G9+kvaMhyjSzP6RmCyGTlM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r6cmUgVrB1vzfMg7OkKxjrwtvoGuy++YDH+Q9bZaZVO3wzPg1/djd34KflhXXa0SdhjK2rRd2LUmvNUyp4qo8rm+wQ4FMsatTTo5DcbXZQiGfolhl0qrM02l23LUhIT4GgExLTww6C/W6gDcfDmHvZUdXfKA95mEdAngOJ/za9eT0OfOd+Bh1/IytVPLNa8tESLbNEUPSNcw9Wno4aEftUlqokXMw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(7416014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xzG+585GghLmzoTJDhgs+Fhl2tILeUCR0+2vNg1r4p+jgKTpBWgnhvOzUpTabJwF24HmaWEd+Ohw0QnHTdy96AVIaicCFD3XXDuVPDlDLhO5BuddO+VqAsf/XUB0CaHRzwY6jPSNdeBK/SZy0OYFN/KBxe3PnK7Rd1jz1KmTw0kdpZNj0XpbDwBPmtllBzIvBizJ0oczL6SpDThG10Cydrj60T/oYqGVh2F/fPVDJb5GKxl16ZvEuHO42tfOzRdXoziDCEyi4J6cM2Nu7exNXeI7vz+A0awyyJQ7ot+A0IVO46Hv7pYZhX1j+p9kYkbo2fNihlO1Ff6BQ3KizU/VWXvZkHAVfPZAABQSZC5zeSATbNS6TgGW0zlPzA+um4pfcxW4TPGvrX+Yki94cfhVd2gE92h88vf8mNKRau4gbxVP8ExNiMUTVNdzSMPuwwdIcDl0iK12A9sdK2ZvWWKQxIdK3jpTr2JMvsd8BGqK8py4rBbfIDY7g1cX2jmSlyNFhKSbEzc4jMCjtUBwObpvBPRpYcqdaa4o+aPPbwYRtnol9fhjPmosqX2gxavSe04xoD0kCdMAfv5qOdleE1Z8tO3SNqthotXf8kBYXGHn3ZprNyVned40skPO67SK5rxUcnfwFmC296Ys4qGYxvExii3Vw5rbKuJ9zhqoX1vJjUSu4xuuQAtndlM6urPH5349XnHhkFJyyefqo/qu6YXwcGgfG4ivAySmABsb1ulxFQVYJj+qweJMLTqfQ8aSzpmV37d1meyVW7KmWv8Zy+srcW9tfgW1cyLosia7eIq9IxzWjYVqVRzhwHdYRxPI4IqZfDA+mjSIT1ac8MAJA7ovPcl3ZPS6GYqkpGfaGaYpSRsw0KzNi2BeNfzF62ayE+4y9L9UtirFzomhXC1wF3+qGnjQD6i9UshyWlFnSn4AR0dVAz82DmQ/948zcQj95b1RnZLZ7oYPsY4p8TQrcZiLhmqPsVdh0ByvtHzAQtksbhR7qbU7RnZ2m+RIxWYhmVwmAFcDlDVU/M96bJhErTQ8mclRw0R0mGiMurhhvxwc5gdZ3fV4qpJpmitFx534TnVaVdiio9/DyT2VAusQfeWg2hceEBiTrPsmhSR8bzUWqcLmPogsF0vWaeGqwBDBTOdvstaZGbHwzlp1HJasRGqREFAesKQZa8Fm8HyVYZ7Ig12DnjkpIfKmZJvkOJE+sIIL80CibhAeB3c/ZLm8/HuHiqvVQNx7heizAe7jTKR95xTgugbzLar+aoKVOnTmjS4J7a5/T3/pcdR6jJv3VgSr4Y7THXXHizwVFEhwmf97AyrEvWRP9WrPax/GE9TsrF04E9cFYitT7KmpFxOK5e4md/kanT+X59pqGRflnI2s7Zo2jvaEcphe1sXhlO5RQg7tBDzr83QFAw4DOlNJ1AgiG/ZmM8pYqz6NC0vVlS8AnPzkAD9ggM2AY/z1uRcD+60+7fPmd3qVD1z2b4qnL8QUwkMVxws2QlEkIcfXrZsSBga2D80seCkAU8BCM7f40At8/W+qtEtM5ljiqsgmZ2WwIv03iq7fCinISnE30Mvmz4a+gH0bDR4BqotA04JzgYev X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa1ebd7a-673b-4617-de23-08dcc67c890b X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:42:15.9335 (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: D70F11+1TrOtukYzmG6WxNCwmEnYVqyK4MI8ecwLzwRV7ZfduWSxLu+edXbNei48jDgr06weq2oyY7WCvxhWkQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5734 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 --- .../net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c index d68f0c4e7835..dcbae653ab8c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c @@ -104,12 +104,10 @@ static int intel_eth_plat_probe(struct platform_device *pdev) /* Enable TX clock */ if (dwmac->data->tx_clk_en) { - dwmac->tx_clk = devm_clk_get(&pdev->dev, "tx_clk"); + dwmac->tx_clk = devm_clk_get_enabled(&pdev->dev, "tx_clk"); if (IS_ERR(dwmac->tx_clk)) return PTR_ERR(dwmac->tx_clk); - clk_prepare_enable(dwmac->tx_clk); - /* Check and configure TX clock rate */ rate = clk_get_rate(dwmac->tx_clk); if (dwmac->data->tx_clk_rate && @@ -149,20 +147,15 @@ static int intel_eth_plat_probe(struct platform_device *pdev) } ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); - if (ret) { - clk_disable_unprepare(dwmac->tx_clk); + if (ret) return ret; - } return 0; } static void intel_eth_plat_remove(struct platform_device *pdev) { - struct intel_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev); - stmmac_pltfr_remove(pdev); - clk_disable_unprepare(dwmac->tx_clk); } static struct platform_driver intel_eth_plat_driver = { From patchwork Tue Aug 27 09:57:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13779146 X-Patchwork-Delegate: geert@linux-m68k.org Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2082.outbound.protection.outlook.com [40.107.255.82]) (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 68E8219DF9E; Tue, 27 Aug 2024 09:42:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751745; cv=fail; b=oVYmysc/sTyl0WOwEJHFBqWIKa3bcbyitNUU+aEycnGoQKpsRcbnsoZaHQtkup916VOSFXkeqLV5PwglG1/Hug/LL5WLu8W/3EVFvxL7VESZwLklZycOfZ7UrhqSZh3NsS6vwV/ZsfZfT5B7gemvZR98JKZlzt4HE0XKYhOQx/c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751745; c=relaxed/simple; bh=+yl3wY+Y3//QW1QVJNi8d8JWyl/OXne4Vv48283jx+o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=c0JleW27V338D57ijGq45h5/DOZI0C4yFqo0/7d47WHcvIJKnLDwpHYNUVKUEEsphvXn7AlZXpgPFJkIGk8l3rN0N/j4syg5qnHHpAL59NUS6Bt0+qpNHzovpLp/WUm6mdRrnIXvhYjPC7X6u+8WflmribH8R6jL0h3rb9XpL60= 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=NBEb07pm; arc=fail smtp.client-ip=40.107.255.82 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="NBEb07pm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nPcg01vbY0EicVUsndhEU5/eDSdjsMqv887laLnFLeoeXeX0OVD+umnCDICxf6UeneCTvaMT0re59PPQaDc7AO3uOM1uKycIocYff70q7Xc3zJ1BBkRrBDM+dMSuNfnpfCovO71FzVhu2nQvGzOC2PWcxGUR6B+dmmGYZ7x5pB4e5wdJkfMcTH/EkYiXR67IDt4FLyAuMvLb/E3Zr/1n9X4MyQ+SX5zSu0jJlcLLvZUVj5lyUgqYk0RXlvP0bqQGueNJNdAt7unTlke62MDotC7OQxelicxMN2CN5w331g/btn09WE4aaGnT7DWZ2ghBP5x1SO9EM03OlK4sJSe/Cg== 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=DX76DWkqLyJ4WRX+FaO0CYX54Hi+W6eU3EBLAexE2KU=; b=dyaqzSuXNTWTSjrH4n4i3BMZLps3Al+G/f1doJ6rqxIvEhf5Ay2nn40NH5LqsfnN4HyGJW20v1akv0RPcq0M0VKcjh6+h8sGo+BnEeHU7AZM1flPN0CTcUZoc2px7IrJII5taXDsqkXChx3RyF85RhTAqNoK6xDReWM+WBTHZwjdB8LMxM5pbp1czphKZ17kQKM7bYcTZATdyMP+SNJRoaR5bhZVguZD3KI+GLXDCEA415I2Q1VzapwhtE4zrsq6KFTJM09BYA/n9xeYo2CcQi8vOdchart97hkJijsnBVp1nx84z00vzo+A357BB8rzct2fObiXgBW+eO0cZrpfRw== 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=DX76DWkqLyJ4WRX+FaO0CYX54Hi+W6eU3EBLAexE2KU=; b=NBEb07pmSt6/8gdur7ZbISsG956M/v7fMBjS6xbGKOQba3zhhmR3T/Xv0nbCLXnSrcMlCk1Od1rIpm7XnZSbavFGbMFYvKtnmwUAinhNOtkjfQxzq1SU5+TjKcgKYTKCgoaW9kRI+sBSCAGWDiyO65qk6P5ikGxt0oXCBq+tQsgbV798bD1WzP0ooBF76F02dsx4FgL/18Tl8XUhg7Cr1B4fes7jZD8WfB+jtL2gGUoriOE0cIgeYUVn+LeQQ//cya4r0ZT05tNIUUx32mLyXyO1k1WjH1OLpG/zm3l/Eh3qZms8mG1Q32ekk1ZGt9XAghBT4lDlCNyEt6DZF86nqA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB5734.apcprd06.prod.outlook.com (2603:1096:400:281::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 09:42:20 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535%7]) with mapi id 15.20.7897.021; Tue, 27 Aug 2024 09:42:20 +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, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, justinstitt@google.com, sd@queasysnail.net, horms@kernel.org 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 , Maxime Chevallier , Serge Semin Subject: [net-next v3 2/9] net: stmmac: platform: Convert to devm_clk_get_enabled() and devm_clk_get_optional_enabled() Date: Tue, 27 Aug 2024 03:57:05 -0600 Message-Id: <20240827095712.2672820-3-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240827095712.2672820-1-frank.li@vivo.com> References: <20240827095712.2672820-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR02CA0053.apcprd02.prod.outlook.com (2603:1096:4:196::16) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::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: SEZPR06MB5269:EE_|TYZPR06MB5734:EE_ X-MS-Office365-Filtering-Correlation-Id: 333c5851-47d1-4d17-37b7-08dcc67c8be4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230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QUOlySYrxejBagqeNKJ/RCwfsYfxTwMylVNLicy8DLaGRm/yEpC7M3xRvn839lk67jD6tmChrz0vXVRuparmeQgPVzf4dkQh2rMMpOYeAv02RmEtQA6OaGoC3lMoLYnoMLh7FVO1Va4UGryESDGKgXGFHzWQWB2U2fpFbuXW6eKC1517czpjTRULifj0XajAUaapHoD6ATcOrm8yW7hc4bUBsMWVEpwbKZZXyf2bFXZGb6afkCdG+gXn3boNkmt8gqxB+6pTLyiFxUCMcIgfzIjML+W/05F3Mx/KRh5c/8zxLUiCbdZZ7kwFwqUMRVpRTcx7UDT2eLMlyF/p51FfVwGHlvxoqnfXKg7O4zNkPYpDHdwEknYPaFSpbhSrHhgk1JmLn9vpOmQgiA1L22DPousW98sXsbRFV2/LiVNZ2FVhiftE+o= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(7416014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Pe2vHVmnplCW/RQVxiQD7jrvKS+WrOU8uzppf7TsS9hly/owsR15tPlKpevrYlsP5YiLHhgAmiWl5HwKjm/yLqtkny6gyDxFU2iocX+KoDF3uc/Qjs7ri2IOy586Wox1XytMeQz1XgTTFCbCtyhgQ+8eRWfHAb3CbfUebjXYA2A2gN31tbJ/H2kf54kANGMrZkyjAKLLfcizIjWjraPWGJGDI0nvCrKS6dqWAQOM2w2zBmeSUG51j54+ET8pQjlTv3r9sdorQXV7gZhLTO9RgkcIjVMBs19ffq4YciPUkNKGictzGW+hPNM/ytKn/z4Rys2YTSwiUV78wDjuEHw5nddri5lSuILa2wbFl90ifXmVYip/acHhN8r0qgnxpUG0m07T3gSK96oZd9BOWWbxRHNPs/IxcXOOZcmo2lYa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AkRqeaaDVGUvq/ji8l75JN4g6npgHn3TBtdJOkAH6oVsDeLuxXauKFmMJoAaOOnV74snAinRRRq9X1QLDVlupR8xirGv9QGM6hcjx X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 333c5851-47d1-4d17-37b7-08dcc67c8be4 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:42:20.6693 (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: NjZZmpvdq6/fwTEvuo316YGq8y0EOFZ1BP/GItu2aUaL/9Yy036sTSD49HL7YtTHgOOCKWUCsUtyQJa+0e38CA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5734 Use devm_clk_get_enabled() and devm_clk_get_optional_enabled() to simplify code. Signed-off-by: Yangtao Li Reviewed-by: Maxime Chevallier Suggested-by: Serge Semin Reviewed-by: Serge Semin --- v2: -remove unused 'ret' -fix incompatible-pointer-types .../ethernet/stmicro/stmmac/stmmac_platform.c | 35 +++++-------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index ad868e8d195d..4365afabf3c4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -415,8 +415,6 @@ static int stmmac_of_get_mac_mode(struct device_node *np) static void stmmac_remove_config_dt(struct platform_device *pdev, struct plat_stmmacenet_data *plat) { - clk_disable_unprepare(plat->stmmac_clk); - clk_disable_unprepare(plat->pclk); of_node_put(plat->phy_node); of_node_put(plat->mdio_node); } @@ -436,7 +434,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) struct plat_stmmacenet_data *plat; struct stmmac_dma_cfg *dma_cfg; int phy_mode; - void *ret; int rc; plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL); @@ -615,21 +612,16 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) /* clock setup */ if (!of_device_is_compatible(np, "snps,dwc-qos-ethernet-4.10")) { - plat->stmmac_clk = devm_clk_get(&pdev->dev, - STMMAC_RESOURCE_NAME); + plat->stmmac_clk = devm_clk_get_enabled(&pdev->dev, STMMAC_RESOURCE_NAME); if (IS_ERR(plat->stmmac_clk)) { dev_warn(&pdev->dev, "Cannot get CSR clock\n"); plat->stmmac_clk = NULL; } - clk_prepare_enable(plat->stmmac_clk); } - plat->pclk = devm_clk_get_optional(&pdev->dev, "pclk"); - if (IS_ERR(plat->pclk)) { - ret = plat->pclk; - goto error_pclk_get; - } - clk_prepare_enable(plat->pclk); + plat->pclk = devm_clk_get_optional_enabled(&pdev->dev, "pclk"); + if (IS_ERR(plat->pclk)) + return ERR_CAST(plat->pclk); /* Fall-back to main clock in case of no PTP ref is passed */ plat->clk_ptp_ref = devm_clk_get(&pdev->dev, "ptp_ref"); @@ -644,26 +636,15 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) plat->stmmac_rst = devm_reset_control_get_optional(&pdev->dev, STMMAC_RESOURCE_NAME); - if (IS_ERR(plat->stmmac_rst)) { - ret = plat->stmmac_rst; - goto error_hw_init; - } + if (IS_ERR(plat->stmmac_rst)) + return ERR_CAST(plat->stmmac_rst); plat->stmmac_ahb_rst = devm_reset_control_get_optional_shared( &pdev->dev, "ahb"); - if (IS_ERR(plat->stmmac_ahb_rst)) { - ret = plat->stmmac_ahb_rst; - goto error_hw_init; - } + if (IS_ERR(plat->stmmac_ahb_rst)) + return ERR_CAST(plat->stmmac_ahb_rst); return plat; - -error_hw_init: - clk_disable_unprepare(plat->pclk); -error_pclk_get: - clk_disable_unprepare(plat->stmmac_clk); - - return ret; } static void devm_stmmac_remove_config_dt(void *data) From patchwork Tue Aug 27 09:57:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13779147 X-Patchwork-Delegate: geert@linux-m68k.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2089.outbound.protection.outlook.com [40.107.215.89]) (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 A407519E7F7; Tue, 27 Aug 2024 09:42:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751750; cv=fail; b=HX625pQMf58duMgPQ1SSb0mFuXhnSye8RfCUTFCWfqtK35VRdv/dTihOVFanOeu5ggsp6d4Q11azKArHSMLyk5CGdi2G7zro/JFINv+hC8bvYvVVOyNlVmB9BN99ntyyq8YaHZCsCgboT2eRtw9duBcvzZ8ayedVbIKkdRhMev0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751750; c=relaxed/simple; bh=2P9oKmy+87Su0NGdNBPUoFfW7Oc0VBG5JjpcmgtSZEo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=PFTDpFRbc04gDOCnTqwG5hb/4JLonn704XozECRprlzF7DZuEoJtygMlBP9EF9qZEJbUI/GumnU+6N4QPKlteItAAu8tyBeEWnHmqcEv9wqgPUWoCUlJWv3l0JNmrV/XXgct7Y0n41nmt9gpx8HgYzCw+qFeFh+OwOu74sEvL8o= 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=kHTPxfaW; arc=fail smtp.client-ip=40.107.215.89 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="kHTPxfaW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HjVuR6sCdLLO9T4UDjhTD6m4bqh7q5kHiy40d95rghUY6W6dk1kY/AMB9cvOLqzpZ40xz1JIC7FqlzKlPRXsToQr9E9NtmtVMcRkIAwZ5pkuQtSayvG52UKw/7tupYXoScxf4SAyvPpwDMfhwCCWN7CuYyELGrVfyEWSz/Ad/72uzWF18G6pj6ZcZiWS7NgpSv4X0yO5R/GI6Tplwfz+b7rwVUZx1Tn5fJA0GYToulGJn9TIJCnq4JPA/10deWoRvgGSZwraFr76/9lqg5kH6uVhsSC/2duxrwS4HAt88mvRs1L97dOVCJaiMkWM08rJvelGRn312wwFI61Y6HtB3Q== 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=dgpFOx0bt1ATIznbVlAsoO/BVR+KVeU/GCDjhwa9Vr8=; b=lUjtVh/cm1hoEaEh+bmbu+CXRZdWr2SwmSTQRfr6qVEO4Ll2oCNvv6P9ap1AUPB74ZmRs3T63IMrRG3iwz910NoG7OVcBif0c5Sj1CqLK3m96fOkWtOvv1CtWXVBgAUDwULnUxep1ZUn1/4mb4Wxc3I3i4tommEaYSr8X48V2pKajC6fcQ0O02CB7ApGskXkeIihUjZ6j8Qr0dO4uqwmb/op2QeNu/Lr2n1A3bb6tTzQDzK+AENPU3FHMaOuJITnVKFAEWB8oUD94TYGWC3E60AUC7LTudfhs4WODlF6iPyQhVQBTtJY8cOqyg/Uu4dbYjCnjz2aK6ayLdOgx2w7mQ== 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=dgpFOx0bt1ATIznbVlAsoO/BVR+KVeU/GCDjhwa9Vr8=; b=kHTPxfaWgwlDFdov2RriuO5DbZn5mqQn3LK+go9CPpjp6lzUPC0O3WZhR5VleY53FrB+buBEGehtbM0dqTaVYX/tEq3nK2WDnYyE4gTf0aWVO2lHi4H5wOv8brclMPN+BAzDrdyq5GDs+HNAuz3CKM1t4G80OtB+Rloh98AVWbAh153HXv6Up7Jkw2CUkREgi7zkxhBpYUViV2GRs+m8QS00oozAwqVcb/s9+9HN7YVesiy6eryjVgo5MaCOOY+bOBrnJvzsFjCzqqzqIQkxkAiIs5ifBq/E+acJRzgaV0qR8zpUuewDHs1NsrV2UJrpO9CPDVmR61b55yXIsrSAgQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB5734.apcprd06.prod.outlook.com (2603:1096:400:281::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 09:42:25 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535%7]) with mapi id 15.20.7897.021; Tue, 27 Aug 2024 09:42:25 +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, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, justinstitt@google.com, sd@queasysnail.net, horms@kernel.org 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 , Maxime Chevallier Subject: [net-next v3 3/9] net: ethernet: cortina: Convert to devm_clk_get_enabled() Date: Tue, 27 Aug 2024 03:57:06 -0600 Message-Id: <20240827095712.2672820-4-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240827095712.2672820-1-frank.li@vivo.com> References: <20240827095712.2672820-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR02CA0053.apcprd02.prod.outlook.com (2603:1096:4:196::16) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::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: SEZPR06MB5269:EE_|TYZPR06MB5734:EE_ X-MS-Office365-Filtering-Correlation-Id: 299ab77d-7f62-4b6f-8a00-08dcc67c8ea1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|7416014|38350700014|921020; X-Microsoft-Antispam-Message-Info: aSiM3zqmc1b9q/L+fuuv4mSMoUaX6W9AXZ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8b+lQVhsISaRUN7HiB8Senzc6pFpG4jMq6neX0TBXD0Ic4d54t8hUhNY6vu52yeftfhQ5DNcqbm2JD7LxX0eXFnRj7WW/9Bm6XL+2PmCsLQrk71uKE7nlyyleT50fMkqvdEw0o9pWjGZwmUoWDYzanlKYoYDsFM9tgt+YB6NW4aO0W26E44Q4Q0EVvwNWxhgf2MoibkdoZTC41SqQwmgme0W0TDHoLZ/5KJ90JY2CoWyQ1CmpdIF3CnUr7ICKkUXqOz2wXVfVilSc349otSjFMPQLtxF72dAiRzD8VtakXuJhOSmnRo84mriarPvXhV0je6vm0y+w= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(7416014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yK6wj3J1O7AOcN51RdBWZhdUyIIkxdBmjaE3yDCLCtLfGOUi7l2pfxK5cohxWPn6M6wo0S1EcDPIJS0r944iwau4h0tnLVSKPG3kWj5Musoj5KKuVdT89CsTIGINANzlUfPenI+SQyMuzTrrI0DT9C0vidPKhnQ0Wa2oBAtz3cZkgrLY6bILKKehNEAYM64Rlih33kEY4BGAHmwhwqB6TGnNGo+EyKuoy2Pns+iIz/nBk9Z18Qpi4OdqHi2BHULig5MhWAEj9sKEN9oRwBrpzFaVS7elgWxKAmnUx40cWZyIarEhtro4rEXGJC9yCHd3DlsBDfHGPHRGgVw4ZfT0KTLYL1wJJTP8vp8SLqvijuuLhRht9QED2Qo32BVja7A5XV9OojV5jkI7rjw+JSadAg82ZQsppo4rUTpKouOpf9dn+un8FC1kKi8SyQJtifi58Rpe9u2E54nMed0M4FWxbs/zvl8YnZTCkHqLHBZwqnPz0wgMvAn5izvsfOYykLAIVt8BOoSOZ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orOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 299ab77d-7f62-4b6f-8a00-08dcc67c8ea1 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:42:25.2490 (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: qlnMY2I8V/x4iDw87rjwtVaiacz0cmoJu7+KRQa256pNTW5C8beONjS1/sQMzfpnrICAa7rgYyWNTQhljZJ41g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5734 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 --- v3: -move the local clock variables, keep lines longest to shortest 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..5c86987c6fdf 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); } @@ -2401,6 +2399,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) struct gemini_ethernet *geth; struct net_device *netdev; struct device *parent; + struct clk *pclk; u8 mac[ETH_ALEN]; unsigned int id; int irq; @@ -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) From patchwork Tue Aug 27 09:57:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13779149 X-Patchwork-Delegate: geert@linux-m68k.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2071.outbound.protection.outlook.com [40.107.117.71]) (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 B4A9119D89E; Tue, 27 Aug 2024 09:42:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751755; cv=fail; b=h27dpuBPxS/RSCbty5EF56XIHxMKEg/IdaiLCDlJ/U3rhcIppvRUXe2enNJL+JdzaZnd169AW+JU5HI99qY9ZNxprwzMqVuPgxFFi0XpUOZg10VMUGKVYvDVr6QPNN+evMBK9weKHLGZ1FEzYxYIzwhbak3oW2izfqJaQ8h3S/s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751755; c=relaxed/simple; bh=N/tUcxjy1xJBFZ5NzpV/baThbpne8L5gs9MZqUQ50go=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=HULK5SwXsM2qXlOvAfK4/GdQRSQEUWWCqPulChgyi04To/Vz7oykCLV8KlnK2VAd9Yk49aWbF42GpFIHaWbX41xGIh5xRh6EkvFiL+U1Ew43egVGMtm/6agVyqZePxcEgzQd9rtuG+QS4TFXVAN0vJBys/uTdMIA7meybH8yp1w= 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=g7ZJDE/9; arc=fail smtp.client-ip=40.107.117.71 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="g7ZJDE/9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=f+oeliw8+G9yywAze9XcLIdcxfBOp0OsRp8ITmvDrRx+RJf1+xOU0lIOq1pRwLXRGTcVo6IL73lw80js7M3TAQZ/uaRljYKeSO7JRE1h8j8Y6iRRCLgH6O+a0EsO2F9myIURo6MkF2/800jqdpMuiLZfOTLC0ZesV4yHVZiYI+Oc3JC//INjWcUREgnRGRxfdHXceVjlw78BzQvXaCf/0UI37ybofdjPgtP4QO9qe/UcHzFupNZrz87o3Ky7JaUV3UYPIR1/QgM6zP+2e3gJh+tum9A+lHBBq/+AndacEiTaIXFJUELRBZ/66hjWYz5hE3dXFW96H4nL+WCcKBfN/g== 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=0wKdpf+etVGbdks0u7PTUFK7xQGU2Gc9tVtz4VzV9uM=; b=O622IQkWOaa5m2geVDW9EfDkth1lb8iPrduA3Oef1BVSUDRrvnR/QRkjPmPRdvuecVFmXvBrhOVkNLYCnFnAzbDWWJrufxumthYP6F9Qt3231Ni9DLK2tdvasLN+09yRkO3h7N//jViwD+eMgC7cx5bhmpKRQX2tX5bFAJE+1DrFehf/8cISftG9wDOfPt3M/7GZCSuPsIOlaiteC3v6xB67cOpqoER/UgMmRB3tyrt3zcw45qnIWumtHhdc7+aPkeoR7TDccdZcELg2SEDOqjp2LIendWotiIbeWT5TDs2tu/LYDM2sCplvcwmDSXdzTVsmdElIjSghKwRJSXQh7w== 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=0wKdpf+etVGbdks0u7PTUFK7xQGU2Gc9tVtz4VzV9uM=; b=g7ZJDE/9EKlh4xggzQy+tsrlwTrhiJastyj5TLM+cefMdeXtOXZHxMZhLju2mIVla3Wg3dyVfmQtE1Q+BjZtQnPCpd5DDMKlQ80hLgngkxaXSs7pt4XodSk2eZoROqsJyqgWqqQ6iKhz/aG4JB+rAfPM9qDkcJYVr/ANf75bUYWIPPuiD5cgQpOfdLkREMoj1EzDdqFhvx9edOe2pBP26TeFQ06HpZlPNoYORHJKWbiYKwN6RgoTgymRIOylK/8znerP7GhZqY/qCWqW5GGd6cIiJn3MUPTDw77g7IQQCO9OFRnS6bX/ljpRg3EY0rWz0yS6U7Y7TE/EEF9oOq/twA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB5734.apcprd06.prod.outlook.com (2603:1096:400:281::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 09:42:30 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535%7]) with mapi id 15.20.7897.021; Tue, 27 Aug 2024 09:42:30 +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, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, justinstitt@google.com, sd@queasysnail.net, horms@kernel.org 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 v3 4/9] net: mdio: hisi-femac: Convert to devm_clk_get_enabled() Date: Tue, 27 Aug 2024 03:57:07 -0600 Message-Id: <20240827095712.2672820-5-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240827095712.2672820-1-frank.li@vivo.com> References: <20240827095712.2672820-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR02CA0053.apcprd02.prod.outlook.com (2603:1096:4:196::16) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::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: SEZPR06MB5269:EE_|TYZPR06MB5734:EE_ X-MS-Office365-Filtering-Correlation-Id: ca0568ab-969f-4fc8-c8b6-08dcc67c9178 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|7416014|38350700014|921020; X-Microsoft-Antispam-Message-Info: wzRWpStLmM//68hSCDOZKPmsrInvem8e6hIAK7wAn0SmHnvQt1tMTr+2ouw7w0pf9zapxbessT8mXG9WYXJDZR7NJKr/epHUuYpt+Xie5PrHxlxdJamRCc5a/+iS/tvSNd5UlpUEgux+RBycn02es0sEKGSltYzPNWoEmHQw7pgvK/l8OvRIEQQty4NgfIYFx71Kp7K2/aXBJ40rUUC8pL7pBqXY56njx3amoi6Fh6cUN3xCoO749cVBVv8Qsgbx8zupGP6fLTbBw09yTUe8JhjGxUdHC4Re1Fq76RC0mj5LnlKxjOe5koHY/NkPTS+BM/Fdj4yUnlk+NecEhacH3jM3vFWVx9m0b6bxdY91DoiEdbkw+l2lEwlqxZ+tapvsuSCnr7tX3Bbj52RzL/VeTF1jq2GFXtJ1Qo8LBEAPhwF9DiaX9Omq7WjZ8+OSVllqHYps1ufkWiPF1rcF4ubGN55IP9WbMMIx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:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(7416014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RV7vC6H6p305EUqC0c4ZENuoq1oAmZxrWeGtX2C7aljn3rgpzLt3ouRC2X59VeIi1dvmU6UZWOjQGL2cz2ZZWgAtsWtQx9uF2WEjlBy+/AQ+K4UANFsXC1t1IXp5rJxQiU09bK1tEh5O95jbf0x+X/hBV+bqa0o+Fh9uzwJlRQNHn1HZX9xlqj73qBPobJmf4k4bmbOSB6Yx5xQ8IB8lkoAtlIRlkzFvXvV1YunCEDJA7fZMjCCC9CcF5JP4Vom39pkbQfgxQjUWt5U+6FdvPon0wclheIvycxc9zCu9m49n80cVpLtwk2sm5Z9Cgge7MqwmDgA+eiLgW+YnJFUn6Bssv8gACEkxpMLHbjYA9mzfuSQKnYYMgmoIKoRXrD5sVFW5VyENNcfdkBXk/eazJf0/CWgKhoNDMQ4YpfzXZuklIOm0Y7J6xXMhoScMM5O5dGc4df89xtA9urY4usNGkILufQh4FbnI3ju18OnzfSOKfA3sur/wn6knmZYaFItX4rTMUN+uyz8JbPUv9zcZXDCGr5Td+ZzFtzFhJXmuJVFNZyj9ro6ZWPiDmoFpm+3NCfzRko+ltTN+KNrxTZvzl7xXWKqzo/pLPxB6foEU1ZiEutOJNFXl+ZbnmUH+1XmeEw/e6rrMoSX2LTB/Ck6y2EETmeUI4MffhqG+HQBCO8ALb1qNETF9mi2ye1kDfdwcJ1JJqf9MKGFzESufB1mpd6hYkXntqsCBlJfUtwGR6UPDKlCG17HEzUPNr1/mQ5SSsRjVBqSTdmDxB4x/tM8JjFlBoaHSXXXwXoCUdsg0cGZaq1AvcQcSdZuZy6+A4OjsymxFqXkwX8skl4ZjVItYbWQOAhcz8X1f2LkF8XtZCA5oYSD/aVHTHcJWKpDxT61o3UvlGQUuZb371xTCan34UFEY3LBSwxSvdLQRhqMHDBToU6WQxrtaBOHOVXErIF2sdI215IdH4OZ1BBlY9tGgrSQ8BkB59zBqi95/hbaVHW0qQXNX/CJQUQwCRpubM5VNeZ0jhM8MARgq1EVeKkFT6yEMBw+r9hR/mAiQD4DP+LgU5Q4wW0EVkNNpd8AQorsaXSxFBB3n3GTRa7iwxnxC8tRuj9TUGFYCxF1bEPnqklDFDrqfew1EY0U4arxwY8o5otYTGCqTy/fGf4lSfb8o9h72yAfO+AUIE8SFIxc3C58oBA8RyRENAawzZj+GsiQc4PjEmMNslYtYsuunhAtkCIWvtHTMZuELnarjr6yUrBjrYjqJnMBXHVviPFg6AZH9hVIxmoapKWfu86LlUqwV4pfaG36Qhph0VKbUMxd/riDyk/xvQbvGTQyEeoW4Aq44y6LbBFjNcCyTdX3Nqj6BuUisvmBGe15wxCrLnRypT4YTYzEfpXhM2Q0oqqFxlvxDNWxzwPR1mVvFzaeuhfKLXpK/PONT6aH06iCedhL57w5VT4EWgkm82JftKDNDLBobn+RZzDE6WyE+pblrkNN0CBXEbi3iHL+Zuol0+ANcahxrcaEI7MqgBXc8AbgtB2Iml6vjZ8fsGas/s57Xekv5ohj7+7oM/apAiMvjzfZLWaB8qn3TbfF7hH0fifqlb6Wg X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca0568ab-969f-4fc8-c8b6-08dcc67c9178 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:42:30.0468 (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: Duv1ydduBHSZWwGkp/5QzInskBhUFVjwdRR1tEc9kZbi9HpXUkggE5/9sg/LFqw0GAYBd88W5+PHpjpdrLGEsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5734 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 --- drivers/net/mdio/mdio-hisi-femac.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/net/mdio/mdio-hisi-femac.c b/drivers/net/mdio/mdio-hisi-femac.c index 6703f626ee83..f6fcb9e11624 100644 --- a/drivers/net/mdio/mdio-hisi-femac.c +++ b/drivers/net/mdio/mdio-hisi-femac.c @@ -21,7 +21,6 @@ #define BIT_WR_DATA_OFFSET 16 struct hisi_femac_mdio_data { - struct clk *clk; void __iomem *membase; }; @@ -74,6 +73,7 @@ static int hisi_femac_mdio_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct mii_bus *bus; struct hisi_femac_mdio_data *data; + struct clk *clk; int ret; bus = mdiobus_alloc_size(sizeof(*data)); @@ -93,26 +93,20 @@ static int hisi_femac_mdio_probe(struct platform_device *pdev) goto err_out_free_mdiobus; } - data->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(data->clk)) { - ret = PTR_ERR(data->clk); + clk = devm_clk_get_prepared(&pdev->dev, NULL); + if (IS_ERR(clk)) { + ret = PTR_ERR(clk); goto err_out_free_mdiobus; } - ret = clk_prepare_enable(data->clk); - if (ret) - goto err_out_free_mdiobus; - ret = of_mdiobus_register(bus, np); if (ret) - goto err_out_disable_clk; + goto err_out_free_mdiobus; platform_set_drvdata(pdev, bus); return 0; -err_out_disable_clk: - clk_disable_unprepare(data->clk); err_out_free_mdiobus: mdiobus_free(bus); return ret; @@ -121,10 +115,8 @@ static int hisi_femac_mdio_probe(struct platform_device *pdev) static void hisi_femac_mdio_remove(struct platform_device *pdev) { struct mii_bus *bus = platform_get_drvdata(pdev); - struct hisi_femac_mdio_data *data = bus->priv; mdiobus_unregister(bus); - clk_disable_unprepare(data->clk); mdiobus_free(bus); } From patchwork Tue Aug 27 09:57:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13779150 X-Patchwork-Delegate: geert@linux-m68k.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2088.outbound.protection.outlook.com [40.107.215.88]) (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 5773619EEC7; Tue, 27 Aug 2024 09:42:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751759; cv=fail; b=pyWcZ64nXj0Re0j69QLFBhvvjtPUld16x+aXjlPqtbw/5HYIE6bbYgrcc/ZrmLyryC+CaoQ5iyNR5SPdkesaMwILnfDKaFNCEXwlm7l5za0TLKS2Sr8V6HhhorKl/VWKxu83uYeigA/C1rlydKXfzXMr0aM9xgk5bPfnMgzU118= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751759; c=relaxed/simple; bh=Y+fmIwBxvWxyVZfdxqKdvMSpZL8fqWlU3Zglug5ZJws=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=m4dZsGxEy0NgD2pNDQIZumU3ojrEwKeHmsOrmbr8EoE4n0YSYxceKH7ZPKtKwZJtTEy/OkLOetHTqNlSrL8r/VDJqOaPXa1xpVwsg/VFV1AVzieupSbZzAA14CX7Ig2IvQPVRI0fgiKmBi7+fvWUESqza7kBuJ3F95on1jigRfw= 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=QeTiMzRt; arc=fail smtp.client-ip=40.107.215.88 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="QeTiMzRt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=l15asJiMfJHX7y/9vIQ/6Ug0julIjAr/8jRQjHpKombSB1cUH+cS3qGnxymIYGU9WGxcqGpehWv4Ck5M5hyRQgNWN/2v6mhlaapedZ3HQX1e/NDZJiUFlYhs4gkgIr5vkvDNn+HxCVBi6hrH51dC2jl7C6uHZLggqWIyIIEQxr+q6BYmtpDPKhy+gYXoJ8SPSOrUjSDqAo9AzWnACXh9GFMaZIbFJloBBa6t0+kc/ewxrLZpEzcG8ZjaKPLrYzu/qtmgIltVoX6pFigeKtZhdC+5maZ8PgXL67qfF4U1KlN+5E3coN62O8NGJRDeJhawtlCV9CgREbltpeEzQ0Zmpw== 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=nuUwMHlqNd7/NeaZphBJIEMMm/qXldl22uDXxOIGaM8=; b=Ha/c6MBFCm/zwt1zPK8F6uVUf9dxac85Aa/bATVVmc77WiQdBj39g3kjDlUpohqpk9OhHXcxxs92jSr6JM6B9U4xCtuPU/hQTD5oxZ2oiKiC5zqh3EHh8cSFkhAmFk12LP3SEX+m82CXZvlmB/TPUlAaxfXG0yXAr82yyJMphUxQT0/2gE5wnmMKooBTxQ6K64P8BybEk7CPxrgPEhPuU4sCxxxVq+prndhsTPWyVGvpU17sfTA4bPM+3j+mBcMEvKQvWbIFe4XHbmTemLXC7n7YMQwEjTBtW/6wi6YwMXUM5icM2RWTnIgFHwPkHLgkno6sy/ClpgHT9LAEOqE7dQ== 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=nuUwMHlqNd7/NeaZphBJIEMMm/qXldl22uDXxOIGaM8=; b=QeTiMzRt6Yraiaaunire7esV9CwCV+13/EXiMuFJ6ZM1zcWfAJ9xvASA+NIwrjtqt/xiorUa7jvRkGm1eiLa6yGkpG6LzGk3ADbMVIltnhfJDx3YuTXsLSVo0BvyC0OrVMYht8goa33QTdlGqOgQ2kJr+FUtvDG+GA/HFtzb2uURUzRAYnvjX+lLcLECNeymBDwkwn+AIvN2VHlJVINPNlZ1HL8vCOjExkr1il+ja9JpMdeOUN7NvWmSHp9Q08eADylvIUyGAupfDZ/RB4/kOEXiCTAh39Fqwm3Xrbx7AF3rg+6/mqiUKuGkDv1PePip1Vd05am4QUiUREwOX1ke1A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB5734.apcprd06.prod.outlook.com (2603:1096:400:281::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 09:42:34 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535%7]) with mapi id 15.20.7897.021; Tue, 27 Aug 2024 09:42:34 +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, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, justinstitt@google.com, sd@queasysnail.net, horms@kernel.org 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 v3 5/9] net: dsa: rzn1_a5psw: Convert to devm_clk_get_enabled() Date: Tue, 27 Aug 2024 03:57:08 -0600 Message-Id: <20240827095712.2672820-6-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240827095712.2672820-1-frank.li@vivo.com> References: <20240827095712.2672820-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR02CA0053.apcprd02.prod.outlook.com (2603:1096:4:196::16) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::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: SEZPR06MB5269:EE_|TYZPR06MB5734:EE_ X-MS-Office365-Filtering-Correlation-Id: c555051f-99d7-44d1-0b0c-08dcc67c9421 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|7416014|38350700014|921020; X-Microsoft-Antispam-Message-Info: 8Vzz5VCGL8O+OFDy3V39ctf74t2X3gl9MAEd1RCawCC1K8YK4fb9lqmG/QlmJ/3FA8fJcGBJ8tKy1lO7uycfXXxgHevHdIHlCptZzc4QRh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78fCKqGs2zU25BO7MWXXHKQ3RXl5lo/VdXer4B7mnI+a/G3zfxCK7Arrx1naUq5+6srYrQNH6u4/+CLrbUrn8DfbuJjQu2RRR9G1XE5BCSPnTiiNSUz8vpddZ08OJZlvV+RtDPoqX6ihh+bxDM9JivHa+b5IpJN279d/Z/mdUsxw3nosvWQ3JCmIjDuOKWn+5WM9R1/KyOi7gL38w1zs6lqcA4csMfGZxZYNNjo9i75F0X3KxXTN1RhPRSDX3b82UIhDM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(7416014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: izo/Tt2dKFT62LeZGRamsswyAfqpnUvJQXLPXkiOk4DBI0ngR50ul//SL+aClT/n+pv6IkEOz9sUWTR93bjiYyfcrT8dRrEM2pOR3FwKkEkuCHxiTOih06f1XYIUUEGHLe1ec0IcGzgUzQ4SlL/5uJeF5yIBwoH1GfXLxMtZFyCL/2+0B2MpyC5wTeMbA7VfVN1io7SC614a8IX+FO0aEasUhRm8+y6YcOt8J7LEHiGA3qugKXZaZ9THF9rX8GgE9eZ6Ow3oPT0nEkBeP2T/iOvqjTO69znfUpBxk70WvRw4egX+BM4c8L9eTa8ch/o8ThUAn6p8JXql+kvIXmxUKyMgz+r5fhy6JC9ArIqnBsMvRQEk1v7TTxo6bOC8wHxzZ2pFOvGJHRZ10S6+uD6se/yO8loF2dAETz4/GDvDodPaOfJ6kZdsdrn+pkVOSnbItXY4cWH5XXBJVN87Nl5NU1qfQES0AixQ9qnHVEUoPPVpeWInSfSUUP60+yDOZuCV1HW16NiS9cMbmaIiZGOSx/xRnReomVZ59gUkoWcXdwNoDwWZh1ZnRTfWL5dG5Tu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ossTenant-Network-Message-Id: c555051f-99d7-44d1-0b0c-08dcc67c9421 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:42:34.4664 (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: iFv0Tb7jGbQJrKijrC44IYOWk2Qfl7QpEPAaQeeEnPWzBaXKVJjnX7Fz3NUAE+uydKyUqnyrAAlZgjVxEprtew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5734 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: Geert Uytterhoeven --- drivers/net/dsa/rzn1_a5psw.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c index 92e032972b34..9627c6550a93 100644 --- a/drivers/net/dsa/rzn1_a5psw.c +++ b/drivers/net/dsa/rzn1_a5psw.c @@ -1228,35 +1228,27 @@ static int a5psw_probe(struct platform_device *pdev) if (ret) return ret; - a5psw->hclk = devm_clk_get(dev, "hclk"); + a5psw->hclk = devm_clk_get_enabled(dev, "hclk"); if (IS_ERR(a5psw->hclk)) { dev_err(dev, "failed get hclk clock\n"); ret = PTR_ERR(a5psw->hclk); goto free_pcs; } - a5psw->clk = devm_clk_get(dev, "clk"); + a5psw->clk = devm_clk_get_enabled(dev, "clk"); if (IS_ERR(a5psw->clk)) { dev_err(dev, "failed get clk_switch clock\n"); ret = PTR_ERR(a5psw->clk); goto free_pcs; } - ret = clk_prepare_enable(a5psw->clk); - if (ret) - goto free_pcs; - - ret = clk_prepare_enable(a5psw->hclk); - if (ret) - goto clk_disable; - mdio = of_get_child_by_name(dev->of_node, "mdio"); if (of_device_is_available(mdio)) { ret = a5psw_probe_mdio(a5psw, mdio); if (ret) { of_node_put(mdio); dev_err(dev, "Failed to register MDIO: %d\n", ret); - goto hclk_disable; + goto free_pcs; } } @@ -1272,15 +1264,11 @@ static int a5psw_probe(struct platform_device *pdev) ret = dsa_register_switch(ds); if (ret) { dev_err(dev, "Failed to register DSA switch: %d\n", ret); - goto hclk_disable; + goto free_pcs; } return 0; -hclk_disable: - clk_disable_unprepare(a5psw->hclk); -clk_disable: - clk_disable_unprepare(a5psw->clk); free_pcs: a5psw_pcs_free(a5psw); @@ -1296,8 +1284,6 @@ static void a5psw_remove(struct platform_device *pdev) dsa_unregister_switch(&a5psw->ds); a5psw_pcs_free(a5psw); - clk_disable_unprepare(a5psw->hclk); - clk_disable_unprepare(a5psw->clk); } static void a5psw_shutdown(struct platform_device *pdev) From patchwork Tue Aug 27 09:57:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13779151 X-Patchwork-Delegate: geert@linux-m68k.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2049.outbound.protection.outlook.com [40.107.215.49]) (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 3F1E619FA7E; Tue, 27 Aug 2024 09:42:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751763; cv=fail; b=L19mrSa9v/cQNErgxBuGXhW2Ued5FIAQjy927KhaXHoE4GIcTZjSsSD9u/lXVb8UNsEnm2B2ItzOmjF++qvso5OHCBJo2+Z1ZC+AZMCoqF0RasDac5z3zekgQV7xuXjM+1Hs80d2yCS+VF/q/Nl0JYZJge87GAz672PFSPT6zho= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751763; c=relaxed/simple; bh=STOXym3gHkt/hMtMCZWJAuxn5xhgY5LkZ+BjsW77SRE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=HsH9LxL6enWT0QLAPcMWZ3gfRfRnlC9sbvv7k+51sLSe3RXa3jnP2Im+WzlhZXNkh+zAeJQKqgibmHxeOjxPwuBbSKsKBkWgllYbxj9SexIdG0IBITev0n94ikTIST/nKHWx8ETmb0FNFMoD+MBLhh5c9fCIt5LSXh2KEBSwtns= 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=MCywYtJm; arc=fail smtp.client-ip=40.107.215.49 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="MCywYtJm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ag9Mw0X8gJveqgj5R/jXwSPN3tRPP3T1qAjDLakpur4/h8sPPg3COfpZdEPWR+UDJ7ydrGo5NJzMh6h6ODytIgM80pD6L9z3I5La/8GB8f6oudAtIOfmEdElwhDc2ADH0puZNfyu0y+CL5rUjS/SuDZkN/pXxGaJyKzxkVUJS71GxIzgHi2QqN11jtqNHgpEa/A8IE7eMa+9SXpTNH9IxxGXKtMOpkKqMupb96NcN7QqaE87ZoZ3GSH57uWztLbBM8Xwu2NghbdU6NLgCY9XWEvhGDA0JYhHP682FG4Mnn1lGa27DtSfKb7TVFl+q5B5hodPXvn0WqJwDkYRz2U9bQ== 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=WzjQUshltpAgBJf5WxknJnH9rd/dbwSbfbQLEIRtPcM=; b=UQNe0RcM2MFOHV2QZyVC+rI+bXE7ibF7Gub4UVTn3O/PxTZDYfZlr8S4pL+YYxUAw5ceYUxYTJPpHtJtjqzZGN2BBBgE5QgvN4mgVYEnd2khzq/7xKUvsLkAmVGiMHs6156AUpDKGGgNChKuauDjKnx5HoW8bY6Ovs/ST2dQzrC4FJylKcvZgrUZdjb0AZd3Lcgjy8JyxM573prta8HcgyG5/UIoHtLTAGPwJhrOu+1N/MiL9faF9EbHCnjmhsIWnI7Z9AYB3tKjBYGlZowsvx3yReSF0rMMS4n1NvjnfMhQtbq1JRcr33wkGpqMwQAoRCj3wH6rl8SU7GDFK2PLkQ== 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=WzjQUshltpAgBJf5WxknJnH9rd/dbwSbfbQLEIRtPcM=; b=MCywYtJmWjNR2UIhLU5ZazVyys3szkmy63eu0vEYCZrfGFlViuZ711S+nBCdouQ4T/KEXN+0fD+dxRwYvjbOMe9J5uU1M0pSj0hwcOS7FMD1+mlfEcTz152EtkhZPxsglanDwoD92wke+2glN/m4oEptsSdAtKKC/PaishBnaG59s1b6C3jd663tqo0zd+F0l7eAcgQfaqkbNd8Qtxhu04r8ip76RCj+5zcC1PNR10OxmcxFhTQBVqUnuvpo2h93Z8n0w0UFHc7OSSm6WtMdfhXphCSZEBYx0g08bxOm9BefYRqOIbCR6mii8PYph4N/S/h1lXJuG9b7kohoitIVYQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB5734.apcprd06.prod.outlook.com (2603:1096:400:281::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 09:42:39 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535%7]) with mapi id 15.20.7897.021; Tue, 27 Aug 2024 09:42:39 +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, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, justinstitt@google.com, sd@queasysnail.net, horms@kernel.org 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 v3 6/9] net: ethernet: broadcom: bcm63xx_enet: Convert to devm_clk_get_enabled() Date: Tue, 27 Aug 2024 03:57:09 -0600 Message-Id: <20240827095712.2672820-7-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240827095712.2672820-1-frank.li@vivo.com> References: <20240827095712.2672820-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR02CA0053.apcprd02.prod.outlook.com (2603:1096:4:196::16) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::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: SEZPR06MB5269:EE_|TYZPR06MB5734:EE_ X-MS-Office365-Filtering-Correlation-Id: feebf581-a8ad-4544-d577-08dcc67c96e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|7416014|38350700014|921020; X-Microsoft-Antispam-Message-Info: AGZwPnDS8aEhKyxTs7gHwvtHrTjdTjyUjqJa3RNoXmTOdrEzWHSZe8UUN+4es+8o05oWlzgmWJZHX1ScsgMFu0r94/Be5XyOtpVz955ac0fFLpVFofoiDh6tEsWwbXmjE0mLZKYmOhw/pI7+8wc4GsfVkvPP2abU13RTmZ1A9kufMuk0+63bYQRHTXdh260ASYmVbZMpkVWuPVe2/XGHgwx9Z9kuU8JjOGRAuA93LofcetinqRZzxNZxk3tGg+x6PnMSQH6KuvOtHYbgc1c4U58IrkyzBNYf0oM/0+URxnQ7JBLPstcL3BAWgx4qRo5vrCY7cHP6hcSR7ONJ99EPbQJnzgD61nwirRzJToGdCyc6eSD8eS5pR5Q8FCQ+A/qWJN6HEOrM/OAoaSHDEm7qljAlXe2GUL+r+UpCEVIVTEyXnevIBKq8Wpl0Vq1EY82u70kxqnZl/yjRjSqWhCciLc+4oEj4i8q/FWV6478/3pBrBmwApHEo3q5ZYS2oSr/2GBvzHVkeq1A+0wTbfIkxjyvop3eT6/tq0mkiqLA7zm/cr2FyEp2y3BPmgCL7mfhknLM8UNS1Ozmsh9U8KVJpDSLvWAJPVkILVJYrvJcd+lUMFcxSe8xQiv8CZJZIVbgex/e1IkJ/GeUPJX0Dla7CZIqnvt6KnFgOvc4H8rBzrwEqKpfyMn5vKTY47blhlAoLL2oaAfOU8xeug7x8GRgk3jE0s3UypUrb2N9kOZv8g5i1cA0yD19gvrwiwoVp29GvnWhkO+YDRdcAx7PeglV5G2sZOSZhtPNn9MhEO8jSeKLvf2XmqrBqIoRflXA0kk4KkNr2Ki/+YNv3MHaRw4jRQeBHKzN9Sc5fMdiCsG9DwUkemxUGhc2GCufecdDoDznL+w9RZtY0WwsGaATCP2/xH4sdaFZBSImBtCUJHmOJtK8oEuw3xSugQM1HQ4jRhlO9W68XM42mgPqTcvBUqvnxD5rpRAFG5iyRr9KyCX48v+4rpJxFQ0ClVIydaOeSON6Eejxv9N1jBciHrFpimya2Cz1qGjUDS0YhfD8WmyeFg6vaNR6cilVpC7wIIKuGKItDeW/Sty1EsyfakhSrY4qwf9mifbYBjYD5Y3oPI/AGeOcS5mJWDmn7GfABwgpAy0FFH+HTfn603lwBi9F1HDbrG4pAgPxIuyPxu8IrFEzRQW8x/8jvInsgB4DN1wexIIK+sUCNCR6miKuxx5pMwjSFoiPeykTHhIXh+GzLmTydh/d5Fa2PzZmNpnOxFrQRQpHmKZAL8SIREnyhOERgWNHymP9eEf8trKXDcfe1/zERtOtuNar1w4AofAg3QrjtCKub9j3AV/YQ5BUg7WNmiTBP4YjpV4QGmvofJmWLB/BVtLg13rvCKqamkscuU+qV+zGqPY/01m+yBD7m+GHo3W8yDzQzVbet0/3YH3leDUtPEjo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(7416014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wkY0l3mUO3JqFTpJizVHwk5V9Shr1rjngHfFYFErwCQQZa1NhjEJQD870N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UxZ6bJWt+ENvZgPgWZenS5RKI+M8aOgVDp+qr6jIXWtYJpugxXl8RGBSJQ15zM5bB06Q73fNE7HxyG7InSF9QEBYkJJQ1wS4dwJt/ewBWQ872nE97D9KfTa9Jbvz5Oe83L7AXV7UqUcFsEeWyloXMsUYgRArFb5zLnjvDjy89nwiTK45a4/O8wG2x0QpRiVnBWEOKcaT1tX4fQGbN20hLDwYbIeBALC7h9307kBwcpwbhZYz03GbEXQ+nLpejH05FPVRiTMEJLck5yWaT79r43F5IerVLOSP3QRwnONaCyu7yQ7aYhT7ENVpanXdtJL72BnXNZAVAYhSTqi/B1lXzXvGXNsDHLOeHzC8DpvuV/yVBPXyIm2K961D3+QcMWEjnNvJYvU0Gdgaq1Ms5zXLNWmLrm+lG58yd3OLh44sET59heVyOU5viLjiEJrcHj6589AuBf X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: feebf581-a8ad-4544-d577-08dcc67c96e9 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:42:39.2103 (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: QqzvQuy0k58CMeZygGPCWchA05VC6Yt32q+2mW0yoEzckGh186Ar4hTpnAwImuaY6EPgv/Xz/ku+YTUxATzQMw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5734 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 --- v3: -Reduce the number of clk variables drivers/net/ethernet/broadcom/bcm63xx_enet.c | 47 ++++++-------------- drivers/net/ethernet/broadcom/bcm63xx_enet.h | 6 --- 2 files changed, 13 insertions(+), 40 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index 3c0e3b9828be..dcc741837d50 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c @@ -1718,6 +1718,7 @@ static int bcm_enet_probe(struct platform_device *pdev) struct bcm63xx_enet_platform_data *pd; int irq, irq_rx, irq_tx; struct mii_bus *bus; + struct clk *clk; int i, ret; if (!bcm_enet_shared_base[0]) @@ -1752,14 +1753,11 @@ static int bcm_enet_probe(struct platform_device *pdev) priv->irq_rx = irq_rx; priv->irq_tx = irq_tx; - priv->mac_clk = devm_clk_get(&pdev->dev, "enet"); - if (IS_ERR(priv->mac_clk)) { - ret = PTR_ERR(priv->mac_clk); + clk = devm_clk_get_enabled(&pdev->dev, "enet"); + if (IS_ERR(clk)) { + ret = PTR_ERR(clk); goto out; } - ret = clk_prepare_enable(priv->mac_clk); - if (ret) - goto out; /* initialize default and fetch platform data */ priv->rx_ring_size = BCMENET_DEF_RX_DESC; @@ -1789,15 +1787,11 @@ static int bcm_enet_probe(struct platform_device *pdev) if (priv->has_phy && !priv->use_external_mii) { /* using internal PHY, enable clock */ - priv->phy_clk = devm_clk_get(&pdev->dev, "ephy"); - if (IS_ERR(priv->phy_clk)) { - ret = PTR_ERR(priv->phy_clk); - priv->phy_clk = NULL; - goto out_disable_clk_mac; + clk = devm_clk_get_enabled(&pdev->dev, "ephy"); + if (IS_ERR(clk)) { + ret = PTR_ERR(clk); + goto out; } - ret = clk_prepare_enable(priv->phy_clk); - if (ret) - goto out_disable_clk_mac; } /* do minimal hardware init to be able to probe mii bus */ @@ -1889,10 +1883,7 @@ static int bcm_enet_probe(struct platform_device *pdev) out_uninit_hw: /* turn off mdc clock */ enet_writel(priv, 0, ENET_MIISC_REG); - clk_disable_unprepare(priv->phy_clk); -out_disable_clk_mac: - clk_disable_unprepare(priv->mac_clk); out: free_netdev(dev); return ret; @@ -1927,10 +1918,6 @@ static void bcm_enet_remove(struct platform_device *pdev) bcm_enet_mdio_write_mii); } - /* disable hw block clocks */ - clk_disable_unprepare(priv->phy_clk); - clk_disable_unprepare(priv->mac_clk); - free_netdev(dev); } @@ -2648,6 +2635,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev) struct bcm63xx_enetsw_platform_data *pd; struct resource *res_mem; int ret, irq_rx, irq_tx; + struct clk *mac_clk; if (!bcm_enet_shared_base[0]) return -EPROBE_DEFER; @@ -2694,14 +2682,11 @@ static int bcm_enetsw_probe(struct platform_device *pdev) goto out; } - priv->mac_clk = devm_clk_get(&pdev->dev, "enetsw"); - if (IS_ERR(priv->mac_clk)) { - ret = PTR_ERR(priv->mac_clk); + mac_clk = devm_clk_get_enabled(&pdev->dev, "enetsw"); + if (IS_ERR(mac_clk)) { + ret = PTR_ERR(mac_clk); goto out; } - ret = clk_prepare_enable(priv->mac_clk); - if (ret) - goto out; priv->rx_chan = 0; priv->tx_chan = 1; @@ -2720,7 +2705,7 @@ static int bcm_enetsw_probe(struct platform_device *pdev) ret = register_netdev(dev); if (ret) - goto out_disable_clk; + goto out; netif_carrier_off(dev); platform_set_drvdata(pdev, dev); @@ -2729,8 +2714,6 @@ static int bcm_enetsw_probe(struct platform_device *pdev) return 0; -out_disable_clk: - clk_disable_unprepare(priv->mac_clk); out: free_netdev(dev); return ret; @@ -2740,16 +2723,12 @@ static int bcm_enetsw_probe(struct platform_device *pdev) /* exit func, stops hardware and unregisters netdevice */ static void bcm_enetsw_remove(struct platform_device *pdev) { - struct bcm_enet_priv *priv; struct net_device *dev; /* stop netdevice */ dev = platform_get_drvdata(pdev); - priv = netdev_priv(dev); unregister_netdev(dev); - clk_disable_unprepare(priv->mac_clk); - free_netdev(dev); } diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.h b/drivers/net/ethernet/broadcom/bcm63xx_enet.h index 78f1830fb3cb..e98838b8b92f 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h @@ -316,12 +316,6 @@ struct bcm_enet_priv { /* lock mib update between userspace request and workqueue */ struct mutex mib_update_lock; - /* mac clock */ - struct clk *mac_clk; - - /* phy clock if internal phy is used */ - struct clk *phy_clk; - /* network device reference */ struct net_device *net_dev; From patchwork Tue Aug 27 09:57:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13779152 X-Patchwork-Delegate: geert@linux-m68k.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2079.outbound.protection.outlook.com [40.107.215.79]) (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 B378F1A00D1; Tue, 27 Aug 2024 09:42:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751768; cv=fail; b=RSaRJwxWEA/bYNMlnEDIzvXNLLokoeKn/NaGYw9yl35tJItWhEwGlzeA8KHJA4SzrtHV9h+myD6x9So0ivK+arWDcNfT5f9LBfEt3Y3ftHNp2Dsbk038yjbhSldc3c9oCxNnkOV631H+lBEGQQ+/plDUc+Z/WFweSAL93GCz154= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751768; c=relaxed/simple; bh=lam3i1C/fKVtSspHCt8lTEW38ChaahKD5MaeZy0zAN4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Zv8VUe4Sw+8/sAZG/kYcgz6QOx+WxDZ1SSIR+vH9SDbWL15hPgmvxSL6j7pACeusrDB2MpCM/xmnDCz9B14Tfeb123D+6IOUc+LXFzW7X83cWPNNyRqsjNHHht+e/tGO5I+7fluVYw343Uftf9t8PeevyQKNr1VYPxDX2TISY8o= 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=DBWIgqmJ; arc=fail smtp.client-ip=40.107.215.79 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="DBWIgqmJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GOrKxAx5dvQm7AJFPUlm+yw2t5aix3MSj2eU4YtDsPcs7fb3dR12oO2A9kn7nBK6lkQALwrmFgAIGZbIC1vGkwAFug7AJgYsiC3gGhwi8YFeUhilIhL/wlYJC9LL/UpIkbkhSSxJ1UNZkt4fPIztL/kruqs0J3oCJtC4I13V/UGtmfJkKEvsd/ImU7TZcdUjSvGJ3fOB4wwMSRmQmKZJxrxnahca5MqK6kTDPdJXjXXF6kyUjIlsAuYwGIqu73s772WUVhJwZVHPtXIuiahX0XU2TLv5L/EuXmBM7L9L+z7qV7E+HHZIH6zFo6rLDXYjly7Q5GAA/CS0VWZRVZbb7A== 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=9ClWPIRRFkyW/ETzB202vCf3b9EilvOpJIebbhY9/zg=; b=PRGzf6Qprip/x/g9raGWgQj33IWUS4tyxFmwNd01p3C+LhL4fzGmG6IyrF9K0jI6WH0isb9sPB4XCOXMm/Rnfm/cBIaS0y289MED3u+DhMrZ4LrNPMPDT+a09BUI8HWuyk7991hZWPNX9mwqgTXPmiqWiQ0VHK2K79clyACsSGXo7JoI+/Qq4tymafolAhJ3hM4vzaXt+4DEnfCfxOCcZALLNAx4MiFLWQpiqBb/1Pi4N4wntU/khmio6SezV49c5xPfmf8dPZsRrQOpG/z3DuchL9DjSBo01nKKIMtjkHQ6wlfPblxYEdSRR8DNF4oTlfDG+E5yRgsKWHoe+thDQQ== 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=9ClWPIRRFkyW/ETzB202vCf3b9EilvOpJIebbhY9/zg=; b=DBWIgqmJuOD/YLZLMe1bpTHzxB6XeikJ2cBrppBOXc7bOxi0Qw/8jsKBJU5ojFAKeacKnmpjRyKhcj6nhcxuKmZh0NcTYyAOhrhDriObiGWv1YyytTw06gcH23owokP/L2gyg4Bx5mviOI8hXaQfDG1blQnL2yOgyuk8F+EVJB2y6rs1iQpOnjZ3HhiN7XBes+K5gdQ9BeRPwl5e562a1RbfUs4CpVvZb23OdHlMpdreBlZ7AVYkS47h0lkcMZEc4lSvZjwxLkKiWKck8M7AsHbQ/iMzTPbvKuSfOYzZSC/Ygd/uN3uUCieEdv9Cal+667TDyCS9ajNQpiT5sD10Fg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB5734.apcprd06.prod.outlook.com (2603:1096:400:281::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 09:42:43 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535%7]) with mapi id 15.20.7897.021; Tue, 27 Aug 2024 09:42:43 +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, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, justinstitt@google.com, sd@queasysnail.net, horms@kernel.org 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 , Maxime Chevallier Subject: [net-next v3 7/9] net: ethernet: marvell: mvneta: Convert to devm_clk_get_enabled() Date: Tue, 27 Aug 2024 03:57:10 -0600 Message-Id: <20240827095712.2672820-8-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240827095712.2672820-1-frank.li@vivo.com> References: <20240827095712.2672820-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR02CA0053.apcprd02.prod.outlook.com (2603:1096:4:196::16) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::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: SEZPR06MB5269:EE_|TYZPR06MB5734:EE_ X-MS-Office365-Filtering-Correlation-Id: 3684bd01-5c0c-4750-01fd-08dcc67c99be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|7416014|38350700014|921020; X-Microsoft-Antispam-Message-Info: gPQ212Zl+TePH8gbqp9W9V6C8/EeV414BlYhiuHgW10a9MCJNrMza9nrPoa84QozrGToOdrTGAr1jpAQSd26Z0AKSBWgR5YMfajCu9GICBmssHk1Ebr9oO1xIBKIBqyjdWEjZLSZKL7GCr8nJvSK8J1i34Z35zWygB49FlEeT8tYnbRZNSPPiy3q6P/YASk2kunpkY75L5WMJg+cQ/gfFd1sPVDSIcygOkC7XH9NXdLJvOAHkfq2IymhTFPJN/s1lgtIeQwtn5Dr4wNDZcyPGRvGKgcoewGh1HTHCxLWtWGWhFBdtaLQfffRkPFhWx9AFNIWBO52aAF+5w8vREVXwBtl++J9p3G/w+hAumrndzPvYAdI9lwW8JzlQsNESG0DFVRC+O/hQfRvkoY4I6XEtC66NRbD1j2svrN2im1ZNtny4+yxEcEXxwpKukqTIHC3iPO89WwqsB6ifKyt1HsyCXD1Ae2DWDLgxSypO1NIMIUcocOqfjcV37bVEQmw848PTMps+YlqvzcshtsQh4Gvt8azB5zoZJ/AMObYSfaozBITJwuvcNh0oCthDyz6u07w8IokAWOWxiPYx4wWra8TIp+312fWuWgCIfsL0guPaPpW+g6zy1ZH/iYB39Xy3Sl0d+xQ4uEVToUidkZjCEiDdML95uQnU34BsVkThVEXRpCX68XF4wRGrPUYstFVPE9GVIZv24xO8s+WinCLAQe3qUKGUgYkG6MNepwMHkXnX1w58J1nds84bT4zgJTZuD2Ag0EWAlTxH1iJFQggoTQvR+/CT5vcV8Mh0RGlqaDOHF8M4Tjy3CeDNWlo/9+ElCiQ5jygwj9OoMgu0S76PtHdFZVX3C/BpDGLcndFAoLh482xRj1iY2LF8BX4Nmz2EFYCG4xMLAOsRTZUsApxNrAIt1z+yaaxZbDBHAdz7RLB+SOmxkStjgV1idw5bMa723EiOQSrpu4c6EyvNeAU8ZdlWCmVyHCjhpC3wHxzvA6GrLaG8F4q5VrYvqzWWxevLUuGiVmEZDVkjh7yvMAJy9EhmX2ZysKZp+IQWAq96pccUV5UoHqazPi+xwMjzMCrToQ8uIVJEsGfaT/9PJJUNY8nsNnxGve4PfpBPc4KrstZhQHhyro3ZQYN03IPxwpS481QxoAjDqxk9KoXSdrKmzmtLigb8AD6HJnqQXLR+By71cOdfzhgl3nqnEOyYr6224jLCemutD64GF7MYXKVRwnrURtnaWFBb0lkcZAz4vNU3QMuECIS3ZY+hASU8rBxqCEp3KqrVNdeTp/sM25LToCRV9eeJvwXtayJ85kwbVm99m7i2MMC7D2lOrcG623JedpcFrKt9AsknOSR89XY8Iaft8SG8dHjwi60bHjvcnkg/sS8y0V/bJqvNmd0mO8lmW1cOSk6jiLxZ88SEFh0C/Uu1KvZI2Auh8bxJLhMNC5IKHY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(7416014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5ohhRJ5IFd6w/q7Bug5h5lZYv6sAIvKVJT4xj62ie85pniHBt2YCP2yHAizmCCLACevsJYj6m4kccerO7pNCHOg9Q6qtvF/hOQedyCSgPIJ/DdSush/SAHdhM9ZdoxHVHXnLIcKF/BzZ/w4vyWwrO4OugNd0Icm1qKb4y+W3JCi6mf25VeD2fnhG8jJY/vaVzdbnxtj3pt6XnQimiPRQccVYQN+GpM1HtZDuAoNB2med6UojP8sXITRmopHwINDtROhyHmbSriqCW2kvCgVCnOGH/KyjPFNfAG+2kdkKxsF7smUzHRmDY57iqaHwsrNnTwOCL9uc3NflEh0hW6RDLeeYtMQm/QQpwqQsf24XWjAmirdnsOEUdGyuskSjdxvoElP4jQ92xlDZJgDFS/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E2TCqslOB20vJnx3fYJEuMH4VAoTNhTsV8N5kP3KFB5kl5b7BiXOrm4avXMR1UrCJ3iTze+3JCaO0dwb2LqDy2iMHcCKbxawIcxHobY2b1/M3nXgNr X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3684bd01-5c0c-4750-01fd-08dcc67c99be X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:42:43.8705 (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: 3KOexM5VaI16l2iA0YCn+NYlXjux3aEEUDL9dq7DK0/NXEt83YWrUvFeXCezYg44mPFymegkhqnHsanel18dzA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5734 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: Marcin Wojtas Reviewed-by: Jonathan Cameron --- drivers/net/ethernet/marvell/mvneta_bm.c | 16 +++++----------- drivers/net/ethernet/marvell/mvneta_bm.h | 1 - 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvneta_bm.c b/drivers/net/ethernet/marvell/mvneta_bm.c index 3f46a0fed048..bfd1ed12d98c 100644 --- a/drivers/net/ethernet/marvell/mvneta_bm.c +++ b/drivers/net/ethernet/marvell/mvneta_bm.c @@ -411,6 +411,7 @@ static int mvneta_bm_probe(struct platform_device *pdev) { struct device_node *dn = pdev->dev.of_node; struct mvneta_bm *priv; + struct clk *clk; int err; priv = devm_kzalloc(&pdev->dev, sizeof(struct mvneta_bm), GFP_KERNEL); @@ -421,17 +422,14 @@ static int mvneta_bm_probe(struct platform_device *pdev) if (IS_ERR(priv->reg_base)) return PTR_ERR(priv->reg_base); - priv->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(priv->clk)) - return PTR_ERR(priv->clk); - err = clk_prepare_enable(priv->clk); - if (err < 0) - return err; + clk = devm_clk_get_enabled(&pdev->dev, NULL); + if (IS_ERR(clk)) + return PTR_ERR(clk); err = mvneta_bm_get_sram(dn, priv); if (err < 0) { dev_err(&pdev->dev, "failed to allocate internal memory\n"); - goto err_clk; + return err; } priv->pdev = pdev; @@ -452,8 +450,6 @@ static int mvneta_bm_probe(struct platform_device *pdev) err_sram: mvneta_bm_put_sram(priv); -err_clk: - clk_disable_unprepare(priv->clk); return err; } @@ -473,8 +469,6 @@ static void mvneta_bm_remove(struct platform_device *pdev) /* Dectivate BM unit */ mvneta_bm_write(priv, MVNETA_BM_COMMAND_REG, MVNETA_BM_STOP_MASK); - - clk_disable_unprepare(priv->clk); } static const struct of_device_id mvneta_bm_match[] = { diff --git a/drivers/net/ethernet/marvell/mvneta_bm.h b/drivers/net/ethernet/marvell/mvneta_bm.h index e47783ce77e0..396dced914aa 100644 --- a/drivers/net/ethernet/marvell/mvneta_bm.h +++ b/drivers/net/ethernet/marvell/mvneta_bm.h @@ -94,7 +94,6 @@ enum mvneta_bm_type { struct mvneta_bm { void __iomem *reg_base; - struct clk *clk; struct platform_device *pdev; struct gen_pool *bppi_pool; From patchwork Tue Aug 27 09:57:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13779153 X-Patchwork-Delegate: geert@linux-m68k.org 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 634851A01C1; Tue, 27 Aug 2024 09:42: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=1724751774; cv=fail; b=QXqm/1cqJn7lS6t0SycVXaHQ7lpArqULqQTgxRhg+DntdZ0Go/Gw2zEOl6KvGa09DGsLF2FhUs8tSFRjlj1Ckk2OycdHnA5XJaG9ng0hsO1htYF67/9xdDujjpZ61iqMS7871FZhYuqd6sMIW+qg0wGzZC6pd+EPSJr8ZxB7u5M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751774; c=relaxed/simple; bh=4S2RiJMzuXZAmky3qSUDWr32ueafShaSNeooOmzZpik=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tI2LS4n2MwBTCe5FRtOn229aBlxj4QEw8XU42wFGwyIS0TBkahzt3oGZl37IeLvcvK9GCiwKCvFbj1tb8dyp+petn2w83UJqBNUnn5BJcfgv6ejTeJaNyaXuhTVoRlRRvWdQIpILOOXArq6/XcKQR5czcWEeHTGYEbrWVH+23IM= 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=XfRcaEmf; 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="XfRcaEmf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=f+v3wEcxM5Z9toxw6Rfs3FZKGH0jFEOUtLWyJFGnaJBETsrwoWLWOstC9NWH5mCgi/oPgS4383MdotbFP/Gl6JOBtEzNvx9HJg9cTddNz+9k39CKwioWLqBTys1/R9XbiA5qxZw1z4swJ0jwLduq4WTz1+M4KIY8Kbo9xGclEHU3iP2pQp8/64mQmJlLvSH/K0OX7Pm8ch7SD/ZnwIEH+2o7V0C2SGHMcRPQo9km0b7+4j9sRRwyhjNVximAssVcUK6hf7Dyfy659yEY8/xNDqYXYJfAV8T2lbGw8XNg+y+fGEHJGh8wYgP7FLwLPsgH502B2JH110NbkS0kHNGBvA== 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=7SmflboBSPhrF9rv3Jzy9l5/rAhNeMH5eUOtlPv2pFw=; b=xYCQBa74x8eqIjYnEGYBpBcE7HJuzMTHh1J7l0NTS9/CQOiAgo5ZZSyswlBZ2iBk66H+9uswbztEmZmwu7oRhGYTDOx20xzwxC9poVoi8wR+QBJb9j8kt7iVCNBF7lxsYsaSlL2vKNX7c5wABLsaXFhmeJnnKnD4tP5t4cysd5OqBhvX/DT10UR1+upRnR3J8H8AFTG6XrXjFLqxzprhrMvhFcxMiXjMpYblLONr6MFKevfIO4Vzw5Ec9f04hY5xeNAu5EEKWkRS3TJvH9RRvI56+Oq8Wsrgbzj2pywbHBwOnW1zm9IihzjRmZ++hV+OaIJbiVcXCn1n+RuYQYikzA== 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=7SmflboBSPhrF9rv3Jzy9l5/rAhNeMH5eUOtlPv2pFw=; b=XfRcaEmfHbfjQKCLT2heYsspAxbLsAYFRXcX40v0oAv/mmejCFU/XSVzTUPy4FeJbawqXpJ0rMEwyslzGZ90AnpObYx0qeGJw1VlplLmZOjIlJSCyc//c5Ne0ezE9oxVIcnOMf/8EJvhId+hVMh+EqnxOX7LW+JgD9Zh8SOxdkOp1sQhEWf9YcObHYTs3nd+4IWvZ7iaDBt20vdhuhpCBCkhzLZvR4j0rnuO2TNZnYC05lIiQnQDOrjyP3K+hPYMEwdLX+zqwiRpmq7wCS4VICgNWnegZNLPQkM4hwOrJ1ZEA9xbL5Eu0A0Y85D7kmofnFDy08EktRIbJa9fzZa5GQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB5734.apcprd06.prod.outlook.com (2603:1096:400:281::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 09:42:48 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535%7]) with mapi id 15.20.7897.021; Tue, 27 Aug 2024 09:42:48 +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, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, justinstitt@google.com, sd@queasysnail.net, horms@kernel.org 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 , Maxime Chevallier , Christophe JAILLET Subject: [net-next v3 8/9] net: mvpp2: Convert to devm_clk_get_enabled() and devm_clk_get_optional_enabled() Date: Tue, 27 Aug 2024 03:57:11 -0600 Message-Id: <20240827095712.2672820-9-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240827095712.2672820-1-frank.li@vivo.com> References: <20240827095712.2672820-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR02CA0053.apcprd02.prod.outlook.com (2603:1096:4:196::16) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::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: SEZPR06MB5269:EE_|TYZPR06MB5734:EE_ X-MS-Office365-Filtering-Correlation-Id: 21cdbc7c-1115-434b-0225-08dcc67c9ca6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|7416014|38350700014|921020; X-Microsoft-Antispam-Message-Info: FEWMfciPU9TO2KFqnWwUTdtOPQKYzV6c/tyjBqIApzuex/rj0/lGNDvGTu6bQL7yKhpeYfacseZftn6ARsHxR81dfbLHV6uI5FGuJjAwXzg6bI5qkM0LTo4d5ZOu8LVPWGGkqeEWeIR9BJwbYyF6eJ5nsR8GKPMCoshi4RQwh5RKeFGihDvoLdm6JYrOcjmt4rN5MoVZn+rb8mKOS6ft65c7FoS7CzeRobGXkzRyRbe7VEGgCaR24AUZXpzm1JkSQaTSN25H0bTQxow9f55TDRMSsoZTM9JQtNqwenPt0W7fhY2LYRjHufs6tpphtKcYc2iSgbWAxSYSJIHyX5Vn73qHyysSZ5WltvljtmT0SOtedW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2OCQc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(7416014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UGKK7Y8X97Tts17kSjsHtB4iSj1K2YkvA1i7pO1zM2N76Kukof4qx0tKN7vHBTdptU2Z4s3WitgsGfIFH2LbrAomEatBrctui3axmcDG+sGzTcdQKr1z5SlxAR6mcLe2AJHAfmhgYjEUzKHKrmZwPwIIT9qE+DLKTs13dmrFzewcBSns4x54TKr3ycPvAj3Ke90SVA1ByQPeScuQkxmkV+zdTkNDfq5b9om26/aGleJs4s4yCD9gyvi7Hp2kpFphix34/Si16jZP5QTOeFo+2LBtEE8johw/pYxCFQfg1Kabph0IyJyrOu3UJvnRfcyu8S3I0HRiOyxJJQl7uXZjfpb6dUOeZjkdAomP6NXg073FdOGNobpaTMG3/5W8HUA4EkHn7dChqO2elie08laTsJE/Ul2w5k4fOOaEdc2GqLy/BC9ZSKccl9WLuvVfa4bp3vQX9DCtZbIDlGE5TGuMEcJ9V/3ANfg450Ak/UOKyt6dvRvVCcr+w8yp8UbXK0LauZjJuKDpCx1Z42g5yOD1Dub0XTzXeFlMuqtyqanb8ky7Ch7iHOz55OsjGCP7Mt8+gdxrWVVXf4CpJmzZfjA4DqEXKZMiMioMMR+xrdyfpqUraIEXidcgpnsBSyMTsmGUYljGui8zMotj4rUBMzNJvqGDoT/HkEKbQeUs7oZsmwiJoC4ceSv6suF0FyNlirPcW9J+GrEQDApWdAQEsfz8JjRQIe9NNo8XM2o49cwBhwvWgm8p9E1w2GgrCePsktPvszKZCdmC4NVDkrva0bdi1VCpR0e65G85pmvpc1bcDom0D9jd9RyveQsBSrWvp5kMC7NFg4eMGuj2zqlIHGpnUbnMGoyNpuPZckYqvcpeUytbwZnM6azzGT74byarwxj82GJTwCemtQS+mfbT6FNWFDEJOuYJ6YKLkXUPfGWYrrYrFDY8bCqYDdiz2sA5rkuQydNktvzV/aJGAOkyMIiwgbBoJ5cNQiyBGoSFCgogU9pp+oeOJMzHkgePeByJTk5CWYc/b1QajRL8cEwf1/VzOp2icfstvGI5HnIsgMOqtG+6o/Hx4+AV8kuk4UD7gxYyC5EkHGn84kzWulyGlSLRK3d5xyG0Jsv7Q3wgIkMwfNBi6evDGu1dtVbK3zpn2lgl+YTwyU9E3zK0VJfVCEqkEBgSN4UeslYcDs+9eqjAjb3oU8F9CkbNZoRqYwp2KTyDNxzG7NIzWMrPsog2pgYK4V3MsVNwmGsAnikFFgKoh7l9gOD6RLRj1OJW8U06u9CnzP5LVSLa2tMtWW4PffxKJ8RHAQvx2sy9M+ruh0MxH2niYCNf5+QLXnsWafX9+xfOi/JOBwJcbUz9k/A7plsc4YPBxqtFMNrsv/YVT/tlGnWAI9mu5AKHk99B7L2i8ko3sawO2Z7Q7bdVkhlbkzbtYY8NZoVtg83NNW7Ko3TDcLwPU5rarj6fejMRXHLfc8MCHd8m2Jb80mUAEXS0+tV/1GEfipQMdMOkMHOUNTxrjRdw2BF0unG+saLWHLVHPP4oYrieCO4sL5Z7+yM0irgf4+JHWRXsngpiifKuaT+a+MH2pWezYOhkaiRXjkEP0Dd1 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21cdbc7c-1115-434b-0225-08dcc67c9ca6 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:42:48.8331 (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: N2ClBlKcacsQDq8+xqKFr7VShscdJymuUlcrpXXErLbhWtKLxbLc+INGymePphlLFQbrrswmbFFceSQ8FfbOGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5734 Use devm_clk_get_enabled() and devm_clk_get_optional_enabled() to simplify code. Signed-off-by: Yangtao Li Reviewed-by: Maxime Chevallier Tested-by: Maxime Chevallier Suggested-by: Christophe JAILLET Reviewed-by: Marcin Wojtas --- v2: -get rid of amount of variables used drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 7 -- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 89 +++++-------------- 2 files changed, 24 insertions(+), 72 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h index 9e02e4367bec..643a645e8097 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2.h +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2.h @@ -1044,13 +1044,6 @@ struct mvpp2 { */ struct regmap *sysctrl_base; - /* Common clocks */ - struct clk *pp_clk; - struct clk *gop_clk; - struct clk *mg_clk; - struct clk *mg_core_clk; - struct clk *axi_clk; - /* List of pointers to port structures */ int port_count; struct mvpp2_port *port_list[MVPP2_MAX_PORTS]; diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index 2fe8bae4eb3c..0ca2daeb0f90 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -7561,56 +7561,32 @@ static int mvpp2_probe(struct platform_device *pdev) priv->max_port_rxqs = 32; if (dev_of_node(&pdev->dev)) { - priv->pp_clk = devm_clk_get(&pdev->dev, "pp_clk"); - if (IS_ERR(priv->pp_clk)) - return PTR_ERR(priv->pp_clk); - err = clk_prepare_enable(priv->pp_clk); - if (err < 0) - return err; - - priv->gop_clk = devm_clk_get(&pdev->dev, "gop_clk"); - if (IS_ERR(priv->gop_clk)) { - err = PTR_ERR(priv->gop_clk); - goto err_pp_clk; - } - err = clk_prepare_enable(priv->gop_clk); - if (err < 0) - goto err_pp_clk; + struct clk *clk; - if (priv->hw_version >= MVPP22) { - priv->mg_clk = devm_clk_get(&pdev->dev, "mg_clk"); - if (IS_ERR(priv->mg_clk)) { - err = PTR_ERR(priv->mg_clk); - goto err_gop_clk; - } + clk = devm_clk_get_enabled(&pdev->dev, "pp_clk"); + if (IS_ERR(clk)) + return PTR_ERR(clk); - err = clk_prepare_enable(priv->mg_clk); - if (err < 0) - goto err_gop_clk; + /* Get system's tclk rate */ + priv->tclk = clk_get_rate(clk); - priv->mg_core_clk = devm_clk_get_optional(&pdev->dev, "mg_core_clk"); - if (IS_ERR(priv->mg_core_clk)) { - err = PTR_ERR(priv->mg_core_clk); - goto err_mg_clk; - } + clk = devm_clk_get_enabled(&pdev->dev, "gop_clk"); + if (IS_ERR(clk)) + return PTR_ERR(clk); - err = clk_prepare_enable(priv->mg_core_clk); - if (err < 0) - goto err_mg_clk; - } + if (priv->hw_version >= MVPP22) { + clk = devm_clk_get_enabled(&pdev->dev, "mg_clk"); + if (IS_ERR(clk)) + return PTR_ERR(clk); - priv->axi_clk = devm_clk_get_optional(&pdev->dev, "axi_clk"); - if (IS_ERR(priv->axi_clk)) { - err = PTR_ERR(priv->axi_clk); - goto err_mg_core_clk; + clk = devm_clk_get_optional_enabled(&pdev->dev, "mg_core_clk"); + if (IS_ERR(clk)) + return PTR_ERR(clk); } - err = clk_prepare_enable(priv->axi_clk); - if (err < 0) - goto err_mg_core_clk; - - /* Get system's tclk rate */ - priv->tclk = clk_get_rate(priv->pp_clk); + clk = devm_clk_get_optional_enabled(&pdev->dev, "axi_clk"); + if (IS_ERR(clk)) + return PTR_ERR(clk); } else { err = device_property_read_u32(&pdev->dev, "clock-frequency", &priv->tclk); if (err) { @@ -7622,7 +7598,7 @@ static int mvpp2_probe(struct platform_device *pdev) if (priv->hw_version >= MVPP22) { err = dma_set_mask(&pdev->dev, MVPP2_DESC_DMA_MASK); if (err) - goto err_axi_clk; + return err; /* Sadly, the BM pools all share the same register to * store the high 32 bits of their address. So they * must all have the same high 32 bits, which forces @@ -7630,7 +7606,7 @@ static int mvpp2_probe(struct platform_device *pdev) */ err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); if (err) - goto err_axi_clk; + return err; } /* Map DTS-active ports. Should be done before FIFO mvpp2_init */ @@ -7649,12 +7625,12 @@ static int mvpp2_probe(struct platform_device *pdev) err = mvpp2_init(pdev, priv); if (err < 0) { dev_err(&pdev->dev, "failed to initialize controller\n"); - goto err_axi_clk; + return err; } err = mvpp22_tai_probe(&pdev->dev, priv); if (err < 0) - goto err_axi_clk; + return err; /* Initialize ports */ device_for_each_child_node_scoped(&pdev->dev, port_fwnode) { @@ -7665,8 +7641,7 @@ static int mvpp2_probe(struct platform_device *pdev) if (priv->port_count == 0) { dev_err(&pdev->dev, "no ports enabled\n"); - err = -ENODEV; - goto err_axi_clk; + return -ENODEV; } /* Statistics must be gathered regularly because some of them (like @@ -7698,16 +7673,6 @@ static int mvpp2_probe(struct platform_device *pdev) err_port_probe: for (i = 0; i < priv->port_count; i++) mvpp2_port_remove(priv->port_list[i]); -err_axi_clk: - clk_disable_unprepare(priv->axi_clk); -err_mg_core_clk: - clk_disable_unprepare(priv->mg_core_clk); -err_mg_clk: - clk_disable_unprepare(priv->mg_clk); -err_gop_clk: - clk_disable_unprepare(priv->gop_clk); -err_pp_clk: - clk_disable_unprepare(priv->pp_clk); return err; } @@ -7745,12 +7710,6 @@ static void mvpp2_remove(struct platform_device *pdev) if (!dev_of_node(&pdev->dev)) return; - - clk_disable_unprepare(priv->axi_clk); - clk_disable_unprepare(priv->mg_core_clk); - clk_disable_unprepare(priv->mg_clk); - clk_disable_unprepare(priv->pp_clk); - clk_disable_unprepare(priv->gop_clk); } static const struct of_device_id mvpp2_match[] = { From patchwork Tue Aug 27 09:57:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13779154 X-Patchwork-Delegate: geert@linux-m68k.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2055.outbound.protection.outlook.com [40.107.215.55]) (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 05C23145A07; Tue, 27 Aug 2024 09:42:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751779; cv=fail; b=YELgb4CyTlo8cB1AxMXfFkNuGPBwsjD00nqtRBTBK+VpCp2zma81sBn+jwQYGcmuWcGeOgaCpEp7uVY1g/ZkTyvHIrgV06rmGDdOajScYO5hYpUX7YAQ9vZ5JYJP7U57hogM/qD37Mw/CDhk4IpdxoFa67a6RxUZwkzL4VVfd1M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724751779; c=relaxed/simple; bh=zeX/YnL+vXc3rtOcLL7mYLbRFsPSV5CJbQZUVBOm3VM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=c2Y+23V6PHHnOacLziXVmm5j9J12YJxO38RAz6D7BiOWtaM8eRR6d5VwzEFad6lx36tJvHLt4edXti96nEhDLfz8HQUO6z/lNJu3O8jvGfTBy+aRz5kk80zmO1TXcie8/2tECfEP/CTcBEWAaNlYG+p+lUbF4+pgFR6diu5yuKc= 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=GyYLYFFs; arc=fail smtp.client-ip=40.107.215.55 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="GyYLYFFs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hwHk+GqvtI3HEVAtOEpovTFa6tzOkOfoiQNiVWu4wvIrebJflPxcq+onAxDeD4ezkBk0P2G4OsBTobAtzL67HTla3KFzUmvYM0UzQL4oCWArCmmPnZxrz5ENsyL6eZUe9qbygFFNlA/TB2DeO/1s5NzeSDkmNGwPfTGfIXfhTHgI4idzXM3NwQfoA7ZmEqDVTKP7Ub1qHf2vSvYYe14Uo7iXWl2pxm4eBiMjoYqfPOQTRJtXIK9PCyAgfVf/9mnd57zLkAHSyWjRsETbiGosb7/OMXi/nEfVziYYIRuFGeudV+d1nGq/hL86lwfyShgzae+znvqpfFA6N5xyoHGsSg== 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=loKZ3Jg1P258pXcp3YCt+6qnQHyeqRZ5FiyqwfFFhhU=; b=AntMXu/Hxece4NyI6wiHCbixUdHM/A7N8Zf1ggffJU3HUtMb0xQWnMGWuPa+SB8qgQEO7E10yX1Zl0PfUw4WGpawawy2byyY5g+qmsjkRbN1JrjBLGuSTxwO9eYd0/fjUjxXNOsVw02mR343vm2Dr3k+WXmesrJbIF5xWGLgattar1MZ60Tbln9+eJYWSv0xnJfOKnkTT/9WoFPJ6Tb4bau2aBergVz4XILi+o+I0e6tHern03dP3EaUD7yoRcbOrPaQxnQAOXngFbZSrQtrVFPV/MfgPRoxX58HrYfK5icAWczXYABoZLGiaHdnrdpLc9Qf3R/eTIAmyfJSz01QGQ== 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=loKZ3Jg1P258pXcp3YCt+6qnQHyeqRZ5FiyqwfFFhhU=; b=GyYLYFFs2fYub5IdVSNekgcJcn5yAnqd96V0a7zDqopfYoOmYw44IkQl0omWTmdw8xN8tkhbLqV4mN0ZvkZGDeqazfc5rNH3cO4dkRylNhBLHlQduAph0ZWaSLgcebQknVB7qO58j3byUa1ZPJaKMv9Uo5J50hTS60NTwdRxvoOS1NeuCMnXoU2I5lUbVSYWKZ4qNU/8MIkW7//tDAwuUjSrhxUUQUOKn98LM86pU0DV922iPt8pO61qxHWIATkkO6LzhtABb+13monTnnR3RLtIAFTc+MfH58+xGGzN7A+yfJW/hOUCCj62UMAsPJrdeDfV/bxyrgk1ECdnvB+Elg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TYZPR06MB5734.apcprd06.prod.outlook.com (2603:1096:400:281::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Tue, 27 Aug 2024 09:42:53 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::8c74:6703:81f7:9535%7]) with mapi id 15.20.7897.021; Tue, 27 Aug 2024 09:42: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, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, justinstitt@google.com, sd@queasysnail.net, horms@kernel.org 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 v3 9/9] net: marvell: pxa168_eth: Convert to devm_clk_get_enabled() Date: Tue, 27 Aug 2024 03:57:12 -0600 Message-Id: <20240827095712.2672820-10-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240827095712.2672820-1-frank.li@vivo.com> References: <20240827095712.2672820-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR02CA0053.apcprd02.prod.outlook.com (2603:1096:4:196::16) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::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: SEZPR06MB5269:EE_|TYZPR06MB5734:EE_ X-MS-Office365-Filtering-Correlation-Id: 2300050a-1963-451e-acac-08dcc67c9f7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|7416014|38350700014|921020; X-Microsoft-Antispam-Message-Info: EmPvyhko7dfPYZb8SeFkqpfCgWtq4VkejUzPjSWu/EnXwBIJfXIg5zF339ccm2VZdWlQ2TKgBZQBJsFmwlEC3mRP9SRj4IdOjG6W7Dm9rXXgOfIo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3pcQOXerSSK+WwQ7bxXPBTQ3SyWv0x9sx5kzn0EIUWBOo582ZAmcGyg5VoxcTSnWAWmEuL7LDhlutnnPz3NZPG1reHSYLeuAzLq+Mg0aWQw0o9LAr/q2QDhdY3deo3/RyYoDz8BBEmjQz6+NLSkIrIXsfgMIwelCfVasxrT2A7T3TEiRlWJEZTzefpa9PAaJ7u6PZ8Qt2VLa+QT33oQVV5Z9jZCBgQp59ySG0AQNRvvutCvLoogCi6XJY1+xPj+w8vgc4tycb7m+7ijoZY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(7416014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YIDQB1GhOUHvjOuGaDZNgZVExRU+pc+OxHOkTv34zXoR9uXKAsQyDvOwqYlTKv74xdPNFFGiNzxxznZ0V0rJcb/z8G1Q/D82W6EnGnBNSkYUCRzLhbh+51aL+i2kvfAPrLag9pYPgyn61EUbwHqsGIg/KGimqsenMsWn96NrYmr51yUAqkMgGfhtyIUBZbeHUxzwljtoVBhw9n1cXRoUVvnNXU5ZKSlSNGKz3Xb1FztlfiqNVlBQR1dpKTws2sgYf+WbALCyOcy9OIdUaFPXCI0QDHFaQ7GvP6OEs0jpKvwFxnT0IASj4ApRjfzs7lX/zO3beACHF3BJOS4Kr2hnqGKMtFsXq7oft1FnBv+RqYUUdUPupE6GZeSf73/bHswhiXiYQGeY087qgfr+Z+kNEs4jlCtUTBXiAxq4EzE+sbDD5WLGoOtENLKtLJzbIRIO5adjPTumBEpWYg5jHyBAqbnjSJl6q6FMPhL0KizgcsYjXfKn+R/bF+r9o6bVoRcZHHlEiqw6EWfGDQvRMPSf7qJ+ZEMkoqu9+Bq3xLzF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ange-CrossTenant-Network-Message-Id: 2300050a-1963-451e-acac-08dcc67c9f7e X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2024 09:42:53.5264 (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: KnQGE2Og8283HW4EoODAnKWWEx2eM67AUosbCNvqNoL3mB27Zr+GR1eXZOoeB1/vLC5Ngon2r+bya+nK+Fv+/Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB5734 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 --- drivers/net/ethernet/marvell/pxa168_eth.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c index 1a59c952aa01..bad91cc705e8 100644 --- a/drivers/net/ethernet/marvell/pxa168_eth.c +++ b/drivers/net/ethernet/marvell/pxa168_eth.c @@ -237,8 +237,6 @@ struct pxa168_eth_private { struct timer_list timeout; struct mii_bus *smi_bus; - /* clock */ - struct clk *clk; struct pxa168_eth_platform_data *pd; /* * Ethernet controller base address. @@ -1394,23 +1392,19 @@ static int pxa168_eth_probe(struct platform_device *pdev) printk(KERN_NOTICE "PXA168 10/100 Ethernet Driver\n"); - clk = devm_clk_get(&pdev->dev, NULL); + clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(clk)) { dev_err(&pdev->dev, "Fast Ethernet failed to get clock\n"); - return -ENODEV; + return PTR_ERR(clk); } - clk_prepare_enable(clk); dev = alloc_etherdev(sizeof(struct pxa168_eth_private)); - if (!dev) { - err = -ENOMEM; - goto err_clk; - } + if (!dev) + return -ENOMEM; platform_set_drvdata(pdev, dev); pep = netdev_priv(dev); pep->dev = dev; - pep->clk = clk; pep->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pep->base)) { @@ -1523,8 +1517,6 @@ static int pxa168_eth_probe(struct platform_device *pdev) mdiobus_free(pep->smi_bus); err_netdev: free_netdev(dev); -err_clk: - clk_disable_unprepare(clk); return err; } @@ -1542,7 +1534,6 @@ static void pxa168_eth_remove(struct platform_device *pdev) if (dev->phydev) phy_disconnect(dev->phydev); - clk_disable_unprepare(pep->clk); mdiobus_unregister(pep->smi_bus); mdiobus_free(pep->smi_bus); unregister_netdev(dev);