From patchwork Fri Aug 23 07:21:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13774681 X-Patchwork-Delegate: kuba@kernel.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2046.outbound.protection.outlook.com [40.107.117.46]) (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 E272813AD37; Fri, 23 Aug 2024 07:06:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396794; cv=fail; b=U2N/IDLvccZjV1ELqLwCAGZw15GZHgupix8pZ80CcmVCVNOpMK2okP/RWkIzqmEvZ2ZqVDrQGPG6/kXOB2NLbPAqcKR1XgF8kK4y3qdYPTEJNrxrbKFHS+BWeVzGvCeEjir5zaWRd4LNM7tvM9rKGYX0FqUSi93pOiBEPBp1MUg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396794; c=relaxed/simple; bh=iJ643tR7zH3ZBtTySjCVJyQlQQK4LHdROae4Wbgdk88=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=L4/FwfbhA/a//hw9VfTJ7VeuaigBOOeVDBTDdLQb+ciN3dKHe/ajc7Oj+rkt0VmMz6Xe3tECoxT99ZC4NrIa8JYA+mqFFRwpkTMNQ7xtSf1K+29OgIwUUa1fGQNEqrDQZid5Hqu/zNJKKFJHfWFHllsC95FFMopLC8xWGUrJ0z4= 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=Te6xy79Q; arc=fail smtp.client-ip=40.107.117.46 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="Te6xy79Q" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JpaawdUAvEXPIgdV2Yk0/2QCee+1wpUzvAgqk1xvRKIn3kVLZYEHgE7dMAzY9BQdnv43JeCldXIqwZwjf4cD5Q0iC03m3FyXBUzpBPkZ+bA9ve/l1AhDsBZ2q/bzuwQrFWoFXJ4YbgV/YI4jQeKMSYhrX/ZktLBQaToqdCuIhH8yNR2Avavc9TncZ+4cShV9qQ+sTwZq6mi5Q76K6/W9z+O8hdjMRwZbHyHDT85U4zEU6aWjGhFaFovFehZVjIVwW5RUz3v6E5TwMI4YQEis+w/jcnrTzd6XiPuLOqU6IxdvSOtwlv0AgvueomTbB9kwA/q+eJC8AmuN0hnFzQHcDg== 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=gLoA0LuRsS3HN8S7Q1G6r4RsDxVt4pHXlpmFWQFwwzwu5Lz7bAPQ5l5Svn6urHw3IdyqamU7nPBUk+foeUGprwMNswGJswQuAl7rSjTjwykD1lAwOwMjxbhQoI7sEoHfS8F7c2PCDnoLobgiPvlAAd2JWvf0p7f3+OgHXJOr3EAHWij65VO2t0g2e9Zbi8bKGnCyIncHDYGbYVK1IGHnoStIUh3tsdDr2i/oNRQO2mkmsfC/ewEaCGTx/5Ppv5LNLlxQzCyK538GflyZIhplihqzp4K76vW87g/58x/TCNeC2qnGfopzLtG4cmBBesR1xM3kIaP1xsRvjFEQtFXIbw== 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=Te6xy79QjWxKGdvn09njIZCpHyDsTgwR1frEgkl2HKuYQnau62TroQgEhBd7xtqUxlJsT5NEdU0Rfc9caj9rCiDnGayAzZwBjDW+/9hTqU3j+bOoj/iW/o87l36pme6c5EeBih9bxeYZmGGkhUcm2ZyPysPTxmPbm6EYZKNiAy5RyDK5jKKNzS+Xid8lL4tvJsccvbqE7xb6VK7yfIVvy+W3bZz344de1oBSygMTofK/EEgFXA+60GpyuU+B3BaeDdPDT8OcfEZ7AY4a0lmJKjs7LkNZD8JlKiXzvh68FbvZJUpwm96Ce5c17o5+EcZfsQf3VGJKNuK3Zq7UAXzrAw== 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 SEYPR06MB7069.apcprd06.prod.outlook.com (2603:1096:101:1d6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Fri, 23 Aug 2024 07:06: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.7875.023; Fri, 23 Aug 2024 07:06: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, kees@kernel.org, justinstitt@google.com, u.kleine-koenig@pengutronix.de, horms@kernel.org, sd@queasysnail.net 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 v2 1/9] net: stmmac: dwmac-intel-plat: Convert to devm_clk_get_enabled() Date: Fri, 23 Aug 2024 01:21:13 -0600 Message-Id: <20240823072122.2053401-2-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823072122.2053401-1-frank.li@vivo.com> References: <20240823072122.2053401-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR04CA0001.apcprd04.prod.outlook.com (2603:1096:4:197::12) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEYPR06MB7069:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e2002b7-4a63-4d66-6a50-08dcc3421d1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|7416014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: YfgT8ccWrFUzAz5/l3D/B6tvian2DNvzAqOhoXbDBBBowxxEwl/DM1p/ZQ5DmTR24MyQ/3ahjZt3UpfUauxUtl2bXgNzv0ep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B+3fomcb/dZ+VD1jArI0lBauECXNJvdTERGpnVnWG6+dHUjBD0lxenL80pgKxElnL/L9hFytCZNs4uu9iyg7VJOeiBFm6TT9T6023wqx0eY+OA+EfA+tu1YJbmQD02vMLjwJRdKRbj3tDTwDM8xEh3k9tQaQ8Kxvs1VU7ZZMjd5NbiMmtiLIL/ILzaC8fczdIF35qfwZcr9oR+1LoqaI+CxGKSGrHV4wm8TgWrz8Vfo7BB/8AyBFUAhqguOWEhgeg1920PS/BwvbA3zc= 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)(376014)(52116014)(7416014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LghRyacoJW+eUJb1XtTx9vYS1qWYzuQM+hDqwXDa+k7ZGSgYQ3pCQVMgJ9Tfl5nJ69IDUY6I+RXqD5piAeIkDgvBjqqDJHwfe7Xk3fyG5r1+WR+7MAv//9KoE2IMgM2LAkTCk5xAqztSLxI6Dc6Fo5kiBGcfPMbJfpk75ZZ65GsBR84k23++4bdfFeESlSJkVWXFxvUoLKizv1oDM7nd+bv3xWPW9z8Q2OqqD/HfRRRkMZAoJ/1XUrf968MQbmMSX2OyjyQ3laEObAqjbmKfOeamFJA7xm9I0BnktkvVv1ee4S2Ce36NhQn+/Hnnxc1rl08jElNJfByKRUxKyK982F1waxETMrQOue4wXtzIo0NDJa69L0CYRz6Il1f7UY2uuafDftuG1zu+ZWSSNTF8U1Pv5II2kNzonDYgnUxIDEI4YAwzcInfcfJ8k0UUpGq3vEdxBkjRARH6Hp3dEdcWN5xBKlzYCFYzrGSv2NuTW0LgA4JfAxCd0jZnkl0UzdOIGXkjr5gdkc5mR2ousYLTwL73ua0sHzV4ES90RAxph3SHe45Qr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Message-Id: 1e2002b7-4a63-4d66-6a50-08dcc3421d1a X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 07:06:30.4865 (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: iFZwju7BaTjroZ5O9rKJwORXPK/mymwM7MZtS1MsQ1sNGxzYc8KzScyoBtTlFexN7cDTIsl2hPZd7bk1hw4eeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB7069 X-Patchwork-Delegate: kuba@kernel.org Convert devm_clk_get(), clk_prepare_enable() to a single call to devm_clk_get_enabled(), as this is exactly what this function does. Signed-off-by: Yangtao Li Reviewed-by: Maxime Chevallier --- .../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 Fri Aug 23 07:21:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13774682 X-Patchwork-Delegate: kuba@kernel.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2075.outbound.protection.outlook.com [40.107.215.75]) (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 488A413CA93; Fri, 23 Aug 2024 07:06:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396800; cv=fail; b=i9+cpO5UuUV24Y1DJtdw/Xqt+iSM6CBulOH3+wqgXrObkkUtAKkhFUqzBMubl/3arbJhhYlL0Yai2OKX2AcPo1TrMfcQMfPFYG1Spr4ggA2OaNa0UIDaOjFSkEJzddshfu+JcgtiOvBihzH2k7k/C8MIzxnC8h5AWBuoR+pQAQE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396800; c=relaxed/simple; bh=nWesW5pr4lkg968KvaDmOKb5xtZz0YzjjvLlfY2/kNI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=S1WHMNLwxHNkAR64O1yUde4jWweB9/mSCE1/LY0i6M24QokdLSyvDHf58hnMschw85sGoZWOBg7bYYLWQeUGHQNd2rwgrCDmt0FKPyH0YpqK78yikm//iOAmcOkjSlkXnibZ/vtQPXUT6eVCnAnItzbhJ09Q0bdXGrQBvbgjmbM= 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=Ijze0GV/; arc=fail smtp.client-ip=40.107.215.75 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="Ijze0GV/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=V2XqJyBuiBaBqYz6lWfcaWt00Yypr2OqNfg4jG8lJnn3eNXck0P/eeP+lVZPpNTBOdN6zAET9pgxOl1JrBPnwoNpKP4xzWr4pT+YToUTimX3VsrQUpQWW3fGHnhxxtnqVGntuqecNk2YVWsrIMK5pTUQGDBEJ/ufN3kkQMiIm99XzWamgycSe6qSvu0GzfPekY8uXxCsu1Cv7BDqOerg5G+jt8DKaQ9SCPvQYjNGMf++ZbcT1aNQyyHtJNn5tvi9foCSKAXvUEU4ppxwOQOiqSdd7Hu2ucskzxkDBZxLQx9aR9ranYXklTjb9NpUVN/vT2Rn4mDkuKbsQ2Z2OBbFkQ== 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=mI0K8rSXqPnuSQqybgOp1bYWqZhcAzOMfVU1VL/kzuc=; b=EnRqHXtUl7BeofEex/GAK+XTLzGBTHGk50Zb1H/yYHdK8bOYIPQZaJHp2GWzWzjgt7HcZo4+wrIGp3dm1v2ZDUAo/Pm8Tqere2k/NJMX64VTMvmIJhXquKWc94r5rTYZXxQCL980j1gf/nWl6nVaETZov+u9a5BDuZ5hKISqgkth+oRQtYVTIGTgYTJI6nuMZehOKHUf0tBGHsTKm9ojvgrV7AIfyfEcVopZIlQp9R7tFKMLS6vOy8vEmentvu41hidj0Lm6R2ibyN7WviK5Zq1vIg9Oi3utr8EyWtI4eqcel+0Qs5D7LmTUfI8WecdtutB8/os6WZ4lomCviby3tw== 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=mI0K8rSXqPnuSQqybgOp1bYWqZhcAzOMfVU1VL/kzuc=; b=Ijze0GV/JRwxE84JbpPTQdtc0dTu3EW5jnZpsMExVPUhff1Vz8l4j827uM6I9DU2VCMuYStacq82osSEncTy1PtToXj4Y7rv2zT8m2TsXXcK+nuDrEmsqQRLaDYpY/Keyu/HAoKZanF0LklTsPd67asKgjclQB6lAO+3aAkzyGEMBQX2HMym4Z7w/Ry+6KNJYVSN4wuRPtHPUE0K4ScxwV985eSx0n68M8ZGkfF4C7oIdQdqjEZJknclajFlCR0WjlPLr1Aw41qwDY0pfFVSIRmMVWm7DNAH3yL6cenejXktWCueIGISChOEP4YsSIpD6/XXNEGw0ZjXewxLaukdMQ== 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 SEYPR06MB7069.apcprd06.prod.outlook.com (2603:1096:101:1d6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Fri, 23 Aug 2024 07:06:35 +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.7875.023; Fri, 23 Aug 2024 07:06:35 +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, kees@kernel.org, justinstitt@google.com, u.kleine-koenig@pengutronix.de, horms@kernel.org, sd@queasysnail.net 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 v2 2/9] net: stmmac: platform: Convert to devm_clk_get_enabled() and devm_clk_get_optional_enabled() Date: Fri, 23 Aug 2024 01:21:14 -0600 Message-Id: <20240823072122.2053401-3-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823072122.2053401-1-frank.li@vivo.com> References: <20240823072122.2053401-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR04CA0001.apcprd04.prod.outlook.com (2603:1096:4:197::12) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEYPR06MB7069:EE_ X-MS-Office365-Filtering-Correlation-Id: 27bf6480-d3b4-49c4-f4fd-08dcc342202c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|7416014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: jkMcSo5NHHu2p9IMrktwdoUcchvuIQ3g013ybIaMu5JkilOnYEoQKyHM4QxyivnclIvuECwKilOyS7iX+0BxJSZlh7BffqKNfPg9EDh35frQpl7FUYzus9kBtdVknVG9HQy0UtoF4ftJwkBwXkJKAUdnjJsnZqigU9M+YfvQ/t3I69XZljZh6VWjA1EIhWo9eKdYwRlC9L5k6aAzBxBhXeUprO+Prz/PAf/0RkIGLdRO9pr7ZLI+l95hRgk2IuzZ1IW1noC8jgl3G3avN/vl8dujzd42uoNk8EFcerqg+dgY7JIk3dyiZijm3DNk2Kx9nG1YBdPKr0IW2ragEw6ROazOngA5MzpBpz3/uQMHYHkpk9MVkbBEiziayur69DcFrEWbhRBI4phDYRi1Gdu5QQIHY2WLFqVLDVt1TXZK/e9PmzNsCOkbcQJO+tTJeVaykCqHn1pJFcowl4MTQW7h3+mnzcz2jQ/SXyqw0xRDyFoPeEqJfbFRC8jpe+s+LPvIdBW7xWO7Dnw3GlFQehboR9ESLCCIttQigv/bQqG8s8kLuA0dPZ9GzNdXQz4xwk+vsprrkmRW1u1TFj5XJ/XsUZytegHeb8aSHl1X7t2QvRW21mrKOrgHXUhlNqM19T11J93iie6K16m8f1UTcGYx0TlN35S4lroexzE4h/tFyzto8KdIJKkOID49qrF5rl7TGyZjtyCxs4TLjRopNeJCAt/M1OaX9aF8STrwB/kNFeNr5rHByI1x1tJAJqvWYioxvxiYStEHDWiujvBCEQLrODybmjk77iqR0ABun5WFcD8zhqn/9k8HRujssLm7qPzP+m2P6WPRgrFEyL/W9UL17cEuhTN/wmslFqgzM5yYlOV7cuOw0ywYUaUDekMVp8WrjfZMkAmkf+ONGIfEoRmHsg0zdSTr6aRyJFxw7eehXtZuYi2sN7jYDIXp4Dsg9Pp7lBRJ05i3U6ebcRhr1IYYyAQj3z7SA/6H1cHyRJ22H6m9VmPJAHpUH6SQanSxs9eCclYpcTMOeY3rl1SlqQUVdS6+xZZSbgZJ30Of4veG7ivIAEl2VzRmU1cFM/kU0dgz/dX9+wh1VEXJOojBYJ3NxzW3ly6tqyWwk87GgHpMl1m033RrNlkZ7NRyLz411xxT0tiekRkIrmL7BH9ZJSwYguD0EKO5bXfe4OAnPB3Vkm6CfOLhhMXR6Hcq5h3iZss4P6+v5xdu11mTIZcfVEbra0GfFDITM2RuRwVeiu7u9DcTaZTsXRC91EZiflULzjyiyuFt7xKtAOlAjMT6/kgGqwIbMPL5Vh8O1UuvTb6Rj051tQoswWfHT8NCnPu/24WyYL+aaQA+rGNM4WzLE4vgLRSDqr+mj1TWMMnsYZO8fxpT5c4mGVAYQwBOJEk4xKOxgj95gEk6QR2vJzZQSKMRxnFMjSyCINe3wNo3WfYOqgA= 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)(376014)(52116014)(7416014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: f7t1JkJLLWA9qGccmbYE8XifZOReHu8/CjhcFIIEzSyWsuurlsiYt5oPsBbuioFMwfesL2XB6brUXEG2J3S+nnoiyB4nfYiUjjF+yPp1CGmC5K4U7Ey687/2DhoDiJhoCbMdVLKnVn37SvTnSIzewWHHVlMaXqTMa9FuPwxnAQlFyoqpL6u0SlwwVgjg3F2YdvgcdVgSwXWCk2vb/HL/8stH+mRQyHHtvqm/TFUcWJegVFh+wg7bMe43itKSpweWXvYNt1wfX9sH0ieJs1tfLyBZTqC/UkzlRUDcPtNGhLvu97pcXP2eWlxIXxpwl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vnWI/jsM4NiBFYsP7MDOEScfSrYsXfsCDkS0LLGxXNIOrthXXW8CIjDzNrCAolzNmpZdDmMIwvLCeZV6lxRa4ZGLbsCA/Zekf+XaxbCLMd/nMQOf2NTcEVvMdTn3BO3U6JrM1dGxGBKKm/VzQ6HWkMaYVQeOwFp5UzeTeYdct9taxYe9OSKIfRERzOigNhgIZoANvwU X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27bf6480-d3b4-49c4-f4fd-08dcc342202c X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 07:06:35.6439 (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: W6c4Zj9/d630eUn5u1SuLXVODqGG6GB84nZRtR6aH1esL09uZoy7VmgU0fSM3JOAifTLcc4Tdwx+WxGBOtfCeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB7069 X-Patchwork-Delegate: kuba@kernel.org Use devm_clk_get_enabled() and devm_clk_get_optional_enabled() to simplify code. Signed-off-by: Yangtao Li Reviewed-by: Maxime Chevallier --- 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..1a66baaa4081 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 (void *)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 (void *)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 (void *)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 Fri Aug 23 07:21:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13774683 X-Patchwork-Delegate: kuba@kernel.org Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2078.outbound.protection.outlook.com [40.107.255.78]) (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 1876313D518; Fri, 23 Aug 2024 07:06:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396805; cv=fail; b=nzAO+IfSwpe3fmXllY8YBtyFZctjXCSPwbo4GP5Ssyqg5DVjkdObHu9+MtzfKgt71v8L6GY8hhmgG2vbEKJ92/0gaRZyTeq1bOguUNHPYsa43GbOk1Vu4b1ULpMO+J2DqCP9BzpyGpeE7/C0eZIIlEEamQAC0RTMVIjNEtZq0T0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396805; c=relaxed/simple; bh=sXreGL5RcW+LZ3HpEkMLm+V5Oer4/p6JeH2q3Fhre3M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=BgOXAigzwQP3HX6Vqo2VLw9md/jKKmAuixD6Eadtlm/VtnsCqU6sxuQEOPcFPlHTWAz8y3K4e7nsbjl6fQbXPfindC6O4H33BWZAM07Dmtb6cHNGsPsD3L95B198qGl3zznfBV1E7ADipm9s1CQLzrDTcz8R2RTz3X0qEtEubTg= 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=nRB2BpC3; arc=fail smtp.client-ip=40.107.255.78 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="nRB2BpC3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ItkxkJzlE55akrJ653K9uyxKKHBgWV/z76kgWpW96P2Gl8J71YWkvVBLJv5j4SJqox9qym6AXZ3V5Q2zqUBap0Vp1IPxbBf2hgSWgYb2/F6cBJyBCPEBg8YAuaBxXAuNGqanTX6XgcgGeMTsNuK7Jw06g5yH+SwXgquFugU6Y6TN+k3W6MUdV7m+y2pNF8enLTCAz08H0pbTSUmHHWJ1XZXBe0z6rskSy/lFK7reEpeXoNORqxgGgPySbx4w7eSgIZFuc9Jgpugk9aAFPKvfqaL51I1rGyHXUCfoPw+ahjm88FirAeMcjEM82YJ/+UujPPe2Yczyfjl1GRE0VNj2AA== 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=Emi0kjf4HGTSvNWAGhXGFzo60m4I3Bj17jnJOAE/QS4=; b=bQbw5YKkKuqvWR1fTwfkIiJEbpvO7IEN/yqaxNCErG6ayZiDyFSSPoJku0ZOGipaXJzHtqjqyezZW0hTPXfuSPs+4NSQOpkMLNmSTeb+3vcYjYfyNcEcKljUAnFRBBBnx+oFKxOWUXFj9EikZKDILSA3SPtUYUsJSo8qFW9bFBM7JLyGD3qelg2j0yOHYZVJnnL9ohXPTO/gqdvN39nFmrU+Z5VVHukWqbzJSd1xebQ3RXRwmNAAchuLvGSFNs0iyylKxHDZSC++C7LrqVFrepeagCvDKiIgAVjhsGgUV76HlRgGgPNxdfq6ecEOJ8A9jzW3dHMa0cACaNzimtphTg== 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=Emi0kjf4HGTSvNWAGhXGFzo60m4I3Bj17jnJOAE/QS4=; b=nRB2BpC3j4h/1CtH3WLCxbeLdpa8fK8AnW/GFG5Ff1EQEfp0/UQWyCggRbdAJWCEQR8ThYnCCXEyqWIfRDJ1CKNAd3NL7ouAVHa8Puf7wcDX9IaB5/9cKeWuKHzXRVDye5IYWtozajnpdpl4IsFahrVH4wlEUv3uCcn5znpATjqN7+Z9KYrmc98eMnjpXkOTGGlMsAJNfHIp9mSJPoMqh/j18+UDKct7vWYjtoT3BkZ77V60jvRrSflV3aCtsG84FV3kAD3qACbjdfRbccVeg5t8OLlMsNOa4mJDRL2ulkmsLmf74BsSCSlSh1UcYrlswd5k050/wvXS0SveeuzenQ== 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 SEYPR06MB6105.apcprd06.prod.outlook.com (2603:1096:101:de::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.18; Fri, 23 Aug 2024 07:06:41 +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.7875.023; Fri, 23 Aug 2024 07:06:41 +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, kees@kernel.org, justinstitt@google.com, u.kleine-koenig@pengutronix.de, horms@kernel.org, sd@queasysnail.net 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 v2 3/9] net: ethernet: cortina: Convert to devm_clk_get_enabled() Date: Fri, 23 Aug 2024 01:21:15 -0600 Message-Id: <20240823072122.2053401-4-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823072122.2053401-1-frank.li@vivo.com> References: <20240823072122.2053401-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR04CA0001.apcprd04.prod.outlook.com (2603:1096:4:197::12) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEYPR06MB6105:EE_ X-MS-Office365-Filtering-Correlation-Id: ba5f9e1a-3a84-44ef-4e62-08dcc3422364 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: j/7AKL9wgGm2EA7Rm2QzsSz4lUZB4SjfBqAsBmbOKP+DfvzHaAHTGqV8750yDz8mDi1i/Q0pAvzXcS56Jtt/l8L7sWPN3X8cTllcN83yQOGNbbJNix8FHLo+et5TFlNrTejnVwXVUhrkGue4NL5ykWClxncIRuWrRDv/iwcDkQnDyTjY88JtxHUfs07tbF6kteL0hCgRfE1VtVNROi/qKaRsGKihCxhOi48lcxZ7jvEUy/m7FPLJF7vBRTWvW9l9dfLKuzyV2GFah/GGGpwOvKDAaMZ+h5pjcbuL9069ETWb6eHOe0QwbXZxe67H8HZrZXQfPwCfNvaDdHmm38WX9KckYzP4tJuzrYsCEIdT4kqaRPhKQe72iqM904T79GvyUX9xAcLEkCUlxJSyfuMSuqVbAehS2el9pel+YyjZ+B9LIirC2W71alYDePt0YBZ9AYVY/SrF5F0G+H8JoWYRdtgut2wyPqgww/J8tl6No3iW5Pn8/X5SBCue7Qx3Ak3NUwb2pH2A83coXRYmIYuKwX7DxjgEEePLDK5fZ6eC8yzG/KdqtVzzWyYrv+8/sn9qjAF0Un5imEfL+fCGodHWD93/GvtG8utPZi8PpwVfoe6/dw1jFGZeMM0HXWzdr9eQbi5v7f4Eh/166R2YZAnre7dfKQzTdByLxkM6TvDNk3lvOi9UuC9vMiMpcblfZqVLIaUYPETQjo2cvacXK9ivF3mySamy6uHAbL0FjNalME4Dayj/NR+d/xCJk5Qo6gfAurgTzGPfcdCYqBqwwcJ5nKnZ5McipWNu6mkos1yCK9RBM+lK6wdz/KXzRCmyZ8Lwo79Z9rQI8gyhE0JNFbS7JCr/lhjtPO/lVA8sjNpp/gdbP4Y4I2APtAWe1ihD1mthM2FfH/VDo8grYWic6T/JnBpS3IFBhsrM2km2T8NRwMZYRWtHMOYvn1XGkslE7v2LbOWfADN2OOU314Pi2sF576I8jI/gAlFwcy+6gfOObt+D5baz/w8gBj2gVRTc/49J6jy2ZSw+cYeMCps1NBgs+gH1kEsS3vaIouvCeN6msNunNANw6Rk5UPFvQpewbZoRv7dPxnWL+4ydowLBpkycZIm3WlnnjkA2l7E8y2SCjKbBieoyFLHczPOeyeazp9dmFU/KlBThAoX8TEJWPNpjMg/8GPOasiw5TkJJn+jfW3t42bgAx24z+YXEnKOD/G6teEhFIG3F0oWvBSfdnrooeQ+0JfhKpo7ljcAvpx3ISjmNgysP39oReNFVwJniTUhL5/tATQwSX3GBydb/xi2CVRHqD6gjQcaP9b7+wLEti6/Dq42lYu2hbrCrTdAv8a0K5k9DiG7rRyeXe6Rav66D90JMpp1I0wKekTYKKhiPNNs1EsK6lA3sdw3vneuiO/j2+ARdWfTNPWiAvVRun7f/n3RYOcMKz2CsWhpczEHqEFc= 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)(366016)(52116014)(376014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fmeMO2AvgiYmx6wF8/xiOBElwUh7fmOlg4nd1Acalx10dzWzuWxuodTDAbzX1IFxHQWz8a6CZV++64s2R0kk2oot8QVmWXn4rXYSU9qWMH7t3adCa9L1d1W5XN8PbL7rhXsEbLZGdNPt2jgH+LBFgg+W/KjNuux3MUzWfiGLXkHetoGKfx5jpcJ2PEiI7+G6uGR6u5KGFtrdqq59tiwEN2kCLqmJRDnOpeP0CdPQS+8CAOTHPwDDv6wJSxeWRpVCpWpWZi/LklgQjJ57eInBBxeEfsQZakNKiuEZqfICKSOM383scPYIaUUzt8DptQ3NSu15lQMor4u/4obOLiA65ArweWNWM+xNIyCHV892FJxmPQs3BxwYu50YmtiENFaFQHJKaLZOAnre8szshL6hWdyBxybXrbekg5SFtfc5cuM1atffXTXBccQliKidgQGh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IwBou8cWpDYUfiwVvwtqnkBwO5ufj/ZkGEFvaWwMUtgcLh2HdTIr6n6AovtnCh1yRdY/wuw+wy X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba5f9e1a-3a84-44ef-4e62-08dcc3422364 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 07:06:41.0434 (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: aMosMSc6jy6ZCDlaimbLCZHWU6rs8vey7pyeUTJU1DLBpQrU9d4vUz8mnNaFes0y+YYmPpvqqOvdoLYv/NxXYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6105 X-Patchwork-Delegate: kuba@kernel.org Convert devm_clk_get(), clk_prepare_enable() to a single call to devm_clk_get_enabled(), as this is exactly what this function does. Signed-off-by: Yangtao Li Reviewed-by: Maxime Chevallier Reviewed-by: Linus Walleij --- drivers/net/ethernet/cortina/gemini.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 73e1c71c5092..90a14e03a782 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -109,7 +109,6 @@ struct gemini_ethernet_port { struct device *dev; void __iomem *dma_base; void __iomem *gmac_base; - struct clk *pclk; struct reset_control *reset; int irq; __le32 mac_addr[3]; @@ -2326,7 +2325,6 @@ static void gemini_port_remove(struct gemini_ethernet_port *port) phy_disconnect(port->netdev->phydev); unregister_netdev(port->netdev); } - clk_disable_unprepare(port->pclk); geth_cleanup_freeq(port->geth); } @@ -2403,6 +2401,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) struct device *parent; u8 mac[ETH_ALEN]; unsigned int id; + struct clk *pclk; int irq; int ret; @@ -2453,14 +2452,11 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) port->irq = irq; /* Clock the port */ - port->pclk = devm_clk_get(dev, "PCLK"); - if (IS_ERR(port->pclk)) { + pclk = devm_clk_get_enabled(dev, "PCLK"); + if (IS_ERR(pclk)) { dev_err(dev, "no PCLK\n"); - return PTR_ERR(port->pclk); + return PTR_ERR(pclk); } - ret = clk_prepare_enable(port->pclk); - if (ret) - return ret; /* Maybe there is a nice ethernet address we should use */ gemini_port_save_mac_addr(port); @@ -2469,8 +2465,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) port->reset = devm_reset_control_get_exclusive(dev, NULL); if (IS_ERR(port->reset)) { dev_err(dev, "no reset\n"); - ret = PTR_ERR(port->reset); - goto unprepare; + return PTR_ERR(port->reset); } reset_control_reset(port->reset); usleep_range(100, 500); @@ -2532,24 +2527,20 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) port_names[port->id], port); if (ret) - goto unprepare; + return ret; ret = gmac_setup_phy(netdev); if (ret) { netdev_err(netdev, "PHY init failed\n"); - goto unprepare; + return ret; } ret = register_netdev(netdev); if (ret) - goto unprepare; + return ret; return 0; - -unprepare: - clk_disable_unprepare(port->pclk); - return ret; } static void gemini_ethernet_port_remove(struct platform_device *pdev) From patchwork Fri Aug 23 07:21:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13774684 X-Patchwork-Delegate: kuba@kernel.org Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2040.outbound.protection.outlook.com [40.107.255.40]) (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 61EE913DDA7; Fri, 23 Aug 2024 07:06:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396810; cv=fail; b=pxlARnvvlitzc7pcW5UfvQPZszrBxwdXU2g08k9UvWmZRRGZsPKkbSQA0UiW8GvP4JhhEuln3KcSCedXPoyoyN0VbeinFSwKA1UWviWZ2Hx6atxg4osnvBohgNQFU4c75VTWoNA7wWOsUa3Lu25G4eBxlEfgL41zzcyuKMtsdsM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396810; c=relaxed/simple; bh=N/tUcxjy1xJBFZ5NzpV/baThbpne8L5gs9MZqUQ50go=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=pb+Gwr93aZLeDkkwp14XsLf9Qpih82kJ3nqabA4emCNyiQZCiZ1IIRTsnV97BsnRVyezmvCBIK6T2/xegFBVia/XVVA5+XFWnfH0sNIX+zHHVeDJNA+V0VHIN2INd0sl+pD6tHfc6Hev6nq2+qarHhkpmouWcy5Y0joWznzmrFQ= 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=EfLXmJt8; arc=fail smtp.client-ip=40.107.255.40 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="EfLXmJt8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dlPhJ8L4Gzzvb9SJ955JgBnShzbf8Hchz5vzGN4XQA9mm1QC030LNVTy9iGTOXpJGxZ9m5JKubi1Ljgu2CR5cYfaDvOG0nqCFSwQG1tryaBxobeXcETFrL4bQALLr/bAVONDGCsdo3bmCOxn7SfLF33G+rAzQr/qQcRNODL719tbEN25E5/mzohEBTSV3W+Ob61dypg4x3insIprl1FxCtgx1I2lLSdzMX778VkaTSbVk8XHLXucuRo27785+hd1lBOXOxYiVxzp0prBTtXaoDVfF2oWLDuSweuw+U+cTSIALxJWwIlN4zdwRtmbAwzUdppzKhvDkY+08mp3dJO/6w== 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=wcWcWPClike3g0pupVw67JkZTgKOqAdNReCIB7rMH8UKWKMBdrInFd0vWCdBkyd3e4CnwNg+ZBWNDD6HB5Oy5C6jCo0uAb8cuPL0XBmgp3SWCc9ZwOIiBi3AhwjqnPnJMpV883aC7o7uC1eijdxrmAJR7WY0vOI6JSRIQLAm8XhkeXpda0dnFaIh7HtrMqL6Y93jZHU/eyTDq3n32lNNwD5VxouQIIcz5wChOny8QzLp8wrvyIXXc/ZaWstzLP8zS90SGyBeRKnr1HBtgRvt1pXVxpvtVhuKJCVNRssognDOket28q3MTGhvaD6IXbra/i7jlLpmAK6mRxQXJN9xmg== 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=EfLXmJt8C7wSI/wMbmwd5zrkI/vIqK9QGG0RBYNXVFHWb1EKSJPfmt2Ic1tFqouAV1iBsr7x/CBZH5lQxat4TZywJKaBJmpIiY+Kz2oKak78RHQGrBJGI2w7+Fwt+miyFY5M/7OLaURbiyd66m4/svRW5rLaz6j1/VSjWst7thW6QCFXaZOC+IIsMfqJzv0ZytDLEqJF0cZQCYxy0sMZkkYqTCTug2iqFj3j0nwp8ImiOy02dS+nlZyc04qjSTVOrlCxVmQ+k+rWBe6xPHlGXRVWuRstxXjv6ETY20FuS4OXrnmIgUcZg5Stbpuz1lQkk5pbH8V8CW8InTCbHsrzzQ== 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 SEYPR06MB7069.apcprd06.prod.outlook.com (2603:1096:101:1d6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Fri, 23 Aug 2024 07:06:46 +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.7875.023; Fri, 23 Aug 2024 07:06:46 +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, kees@kernel.org, justinstitt@google.com, u.kleine-koenig@pengutronix.de, horms@kernel.org, sd@queasysnail.net 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 v2 4/9] net: mdio: hisi-femac: Convert to devm_clk_get_enabled() Date: Fri, 23 Aug 2024 01:21:16 -0600 Message-Id: <20240823072122.2053401-5-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823072122.2053401-1-frank.li@vivo.com> References: <20240823072122.2053401-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR04CA0001.apcprd04.prod.outlook.com (2603:1096:4:197::12) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEYPR06MB7069:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a28efc4-a126-4de6-43b0-08dcc34226b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|7416014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: kFmXydhXfPqk1siDk7NX9SkxTmjXNJEqYn5pp2kQJjqYOIbM5VaxVw0QpY/HJakj/761brMD6kKdrTvrA1mmUMbTzRGg+Bg6JcoUmNCk7+Upj6GXA9Zq/+siztWscI0USLxkGdnvLyo9w4YemgVNp5rp0XpzRJWm9vIu5YRaO1OyyxsVHTn3HLmKh8dnbxQ6EG52wYVTJ6xKFINEwFQxiORx+aZHCTTGlmd5KVGGMWOzK/Y4UEcP9hokOj1bLBd8rMJA3z5PcxkKxbKFKfp0/5Lc3DOsUYtFax22aeEumL0w6NJmQlgewL3HTZnLPXboIS0qZtY6AhjWnaa3o+vrTYf8yEiYlN4yDY+rVOFUgz9FmogeUGoderw+goW4H9lHqRNYa5TUv5+A3h5Y1Q8L/XH9j0NiDTiuzN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en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(52116014)(7416014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X7x5U5qteOabPxMyq2giawSvLV32FTJg4VJGchDyfKBpCyNrZsN8KWMv+4huTjmAv2aRBJ6Rn06fC1MAqpIY/mSWQP1cNiOWX5HXrFzuZJGFAx1oy1+h1ExocFoltBa7847zJgj2ORMTYHsVzLVKte1j/0VpiDSqYD3NpYDlO9DRHc3ZenOtgw6QaTSC8QNd1T//sqKRyQVYTakOI0+Ikn4eUPeCEBjo4Dxo4DPg1Uslrz3wnE34/yifaLmt+kSML+r+wTE/lW8MpRNaRtES1rTI/zLdECSwRldbHe1Ki1KX7Ijc5kmqsL7ENOskat0+OrO1xyT4mZWJkR+sTuv2coiB9PYvDfBT2DAbPl61rlDLQjNJHdBCnSaeE9RCxmzgqf8HF22sebgW7HQ1+gUW3OXXuNUviSpQWBW2gn0ooshr4ieKjM7GNTJ3u7hqIAtxrz0cL/qNwegMmgIHei58PPI9KFt+iyivU7W+oPBzsE0ylPK3v0SPDc82rBRZfba0/Lkkn4+6JcNeOWnfHNv9Ujrlo9UYvi4JCw/Ghgt3GWTnTtq4Sra6h6HA6an6jhqTn4mKKVw6vh+N0YUdchfgfPRV/bSvQvQQboU+x7p6a6EZuwUjX1VUiZDM7tncNO71wnobksAvX36c1WSqLf2d8JRzi0T8Zk43xLgRljWXeKv4edf6nTVpKCFi53eNHDKvwTtbWjoic3FK8tXI9Ti1hhGMTRpLXbIQwyaWfbSAaYNS9+UBRlW5toprvzIrRy1P+mmBi5EWdGYAdC7KUukfFeg8HMXUfP7KEH5uJTJJn0s4XSIttAle0vuGXw7fUFIrlGHYcFiz6e167Lzj1G/EtaLnQGljJeI8x2wCZU3OOWxd+uf10eXhceHAjj7iaUfDRAJhi4x3OSJjnXtlAGOdOPJN0py/dFwRE5ob4OUP0U9yIqgtam96gpWOsat3hzoXxw78jUrjWtPOPHQN+LQf2dAbKbdnnAcpiMGHLOniEpIcyVCe18RW/Jhp+nMd3xcHPBJt/2v04h/lA9DjWRRMiOCuN4abyu8yRo/weRld4rIuZV5J5TRVfpIiKoC8/NWv1Qrsn88Lxu/KI2SXUJ7Ti6sz+6UXMUYFceAKDvXlYlx1xfVKfMuwIwXycNPBH7Xun96HyxR7izHYceUbOgV13DDZJGmrtpUWIhAG3xePW6cNOrII70kB5igA/+SOWIR8FAZkVsVufZVnKleMFN5/I4CwTX+4C+CXcO6ynm2mHbEgU1Jq+exDv00ZLsHrEIKwlo1odtSyaufW3C/Sui66HxKeo90eY35RYNQPBd6JPMLiSZyu14hcmf5Be5mit0g2TIvV8MPSirJILSFFBDl0qmz1tMToOqwXz2PefkzYh9XqlkjnxdvhimN1FxAaXTc+33tWQsPQ3U/I7YdcdVy3WGdZfT2dYHu4TBtFLQgWlia9LNtbXucWTAfGnAErkabFocGoNi3gqSoTDs03w8YFevOBrqBrXI7SNXx4Tp6YTC6b3DkawO+iFxUO++0AR8KD5aPTU9Jm4paCg2/zK/i+a5il+aayMB9xyMbb5cfQ89Lb3AJnwlGm9eJ8eNsIvviI X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a28efc4-a126-4de6-43b0-08dcc34226b4 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 07:06:46.6549 (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: jED3dyZosRlGHG4NYO8ODC3Xe+XJKdYaAgQ9p/yZy7rnVj+M8wrhMLpNjiSOtXCMyaQAKk9Lmcti1siSwntHwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB7069 X-Patchwork-Delegate: kuba@kernel.org Convert devm_clk_get(), clk_prepare_enable() to a single call to devm_clk_get_enabled(), as this is exactly what this function does. Signed-off-by: Yangtao Li --- 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 Fri Aug 23 07:21:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13774685 X-Patchwork-Delegate: kuba@kernel.org Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2072.outbound.protection.outlook.com [40.107.255.72]) (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 5D9D213B7BC; Fri, 23 Aug 2024 07:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396815; cv=fail; b=KKGehM1tgeEFsQFIb0ckjUFdakSpJXjemxL7mQ0NGZFNDa7OK6BKFCLN71+m5dlXyY+8JCYVuhiA8FuWVxhDEQTjq91WWE/3j1NmIyeJBTRT7xDyYcvQtj5Y6LdRRqcRLx/Yptbx+Ntqz++ZDA7xe9a57Dbg17o37Db8OTJqWWk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396815; c=relaxed/simple; bh=Y+fmIwBxvWxyVZfdxqKdvMSpZL8fqWlU3Zglug5ZJws=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=EfRBjnyIAKNt6VBGnCP6pYLPNZb5c3W7hs2u6K0NxTEsyUuoON0wtAuFIK/Sgu9i8EPGqwecNTs1IrZNS9fYkypyRZLvTSmMo96oeSMS4oGL1saC9NK+FDGeWmDkKo66VCDxL+/1ymqayVx1iwQY+eKhKDR7i3VmT4ACDm+ADtc= 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=CY7wFsVa; arc=fail smtp.client-ip=40.107.255.72 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="CY7wFsVa" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XAoI1JIQFjo53gdlauzoMwNL7AM4zREgQ8wC57Te2xEVdIdtEpZbr64Mp59zE33NW010Tz1Q8vUBvcxecsyidoSmAvMLD4fQH2iOWa5XfZIilo3dYMs0PqVJtGRdOh4DlZNlKErqYfkp9SR3Dy5DPveuP24Gm9mRe74wfj5yZpCRZN4UV8j2hK9dSSnh9Ntnqz8EFD6y9ST5RpIlTJNGaRxQjZTKBYYSzLvQtJcVykLaT4cLmSXcQUtZLSW5UcTdM/iKpmQAKxhxw3vsCAwBlqfbRylO4O6dy4QdxP8K8VPax2VzKEEgq84nXwhfxPwN3wTebTiIp2BTbZtSI1eGMg== 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=zOM2Hvaz43H9CTyzpNmJhkFhYU9MACkFDFNX1+1ZOx9jVNMFZDAV8+HHA4j95VZJVUmB+pogGKZuwlK341olOStQ4DCUCR6nXVzoqtbAAc0ScpRxnZJFQG6fogAtaZ5aJjujWgO6AtyiUqyU4ujISxJmktncJQuRUWP5loKNXdRjvBBF/xmoD8XJAW1K6YGiIm3nkWBHZjK+XxhR1/VVdyxmFaw3PsrdXj4QYBtIDW6yhuhcmuDL4BOm0jfOa7ctCUBCZkx0jDhu33mhFOTe1rYdd/3fH0vqe20slQSg4/ZALG/EE2Xs6PFPP5sPRvO9Gzp5YS5+Ilcw1LM7sQu9pA== 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=CY7wFsVaKRTcGfUSwjCuVVjBtOvE1WTzC60BZrgwUj4EqQRglo1wc+oxFcANpaOKvNDhqUhWP4u03GpjVW+LrCDKEfR61jBV0KAQQt6pZGBwV5doNG+MTzREWpyGvedu37kytDaCUkV608EI5Wwfx8mQV0o1KWYmxBSWMkBdsOXC18rPao/xtB16wACD7348JB/bWr3uZgyz7CYZarYSVJDi75VqPVsuY0lVrexsaEZyTUqCM0jOYSIM5h18iWoVEnkBd8jaxBHyiITbVzDx+/DeVJlYBUQK4vtjs7M9qrEYeGA5qDq5WOGFnjswo7r6eCUZb9OqCvZBaUamEPTJdg== 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 SEYPR06MB7069.apcprd06.prod.outlook.com (2603:1096:101:1d6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Fri, 23 Aug 2024 07:06:51 +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.7875.023; Fri, 23 Aug 2024 07:06:51 +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, kees@kernel.org, justinstitt@google.com, u.kleine-koenig@pengutronix.de, horms@kernel.org, sd@queasysnail.net 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 v2 5/9] net: dsa: rzn1_a5psw: Convert to devm_clk_get_enabled() Date: Fri, 23 Aug 2024 01:21:17 -0600 Message-Id: <20240823072122.2053401-6-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823072122.2053401-1-frank.li@vivo.com> References: <20240823072122.2053401-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR04CA0001.apcprd04.prod.outlook.com (2603:1096:4:197::12) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEYPR06MB7069:EE_ X-MS-Office365-Filtering-Correlation-Id: e4c5aa26-61c4-4afd-0a56-08dcc34229d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|7416014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: hyEovmu30a4qZUt2Ern+Hhza9POi1iq7R+xFim2RN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qfGmibrWjPZL0O1JS1sCBsQLmxOVCII+ncMMg/nOWdmvmeqFKjzK48aJ/VM18P0pgkFyOWi3RUYRrnOa+KYm5rmEGvOSYmj5jkZK7IkYJL5Pu50uDVaqpRMX+hBjlkZwCS/LF0KvxJmZjOaQC9YlNNpV39+Kcsg/OLkYBoBRfJC/bqrnXKwJZ5AntT8pdj6ckpsxquTq1fKFMHxqMSDU4911b6EfalDh2/bcX+ZIpUzOqKwlogdOHQ4wVEFLZR0B6RqMOrfLraKjCWdLYES9gQ/2KTdlzG2Uv6dWfyOK4vjzaDouUCwzGSqmtlYZBOjO2Oumh8/qs= 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)(376014)(52116014)(7416014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MJGJFaAnVpfkiaoAdmEHBaAphCDHEmYaZxgCrrrcyZZtDUr2POm1oTI9v2DNUFHUKgQhKJP1HRDUY/rlcMORvdjssmeel5zx+X09MMy+2reHzm4gEzaY8CIcCvoWtiTDYJWu4fdZ8jK1GAPUHjhSQbzlX7ezWK6Ah/pfeSzDw3m64PMA0hWiGMOO1TdioX8daMkZ0P0wGKBAyRxCEpzyNYorIMl3VBRfrpSYv/GXZLjAICgDgjOiyXXywX3VO2X7Vjn+n19Q1D1WdWvQroIxrzKeQgnPJCxd6VTcCvuqIFWY21wjfm2X+uQhvWpODkjWiwxbpIqXNB+kaSp775QSk2B8hslIJdK1fokmeKBfYw83BQ+KWgQXQCOG6jGktxrbspES5gv7w6WVwIzEqL/fxfyblGQiO++93x4/F7JaYbHFZtQuUR8vGgAj9PmRFcoAe/uDx/DuZTAIzSfcXTPNc4BpeGBJ8Ilfqkv/hb76OprGEQWD5QLuA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3H3nMWEFkWAGXLVepyavrnR X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e4c5aa26-61c4-4afd-0a56-08dcc34229d3 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 07:06:51.8953 (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: kJPSIg4MsxOC3ha9+hlvSVBesxlDCSnCITvIFWDZeZd3jtcauHkDoLzCUqvN3r3vb78uHAZBQJ3+q2klxgO0aQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB7069 X-Patchwork-Delegate: kuba@kernel.org Convert devm_clk_get(), clk_prepare_enable() to a single call to devm_clk_get_enabled(), as this is exactly what this function does. Signed-off-by: Yangtao Li --- 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 Fri Aug 23 07:21:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13774686 X-Patchwork-Delegate: kuba@kernel.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2051.outbound.protection.outlook.com [40.107.215.51]) (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 A63CE13C9B3; Fri, 23 Aug 2024 07:07:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396824; cv=fail; b=e9kp0L0LwQpZPpMpJPXL/7JvwvR6H4d3q4+BE2N1xTNTOnQLEqinYsKMuDqYP5VOlpt/+GtKus/lOmZOui9hJmFspOeOBKVe7+ujcrTTtuolxyROAAu4e6AEsgfnBYtbyRUyNSi3f6dkUSEdPkpAtjvsR0NKfyJrAm6P4zuaE2s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396824; c=relaxed/simple; bh=8uiaS0FJhM1300wHqyaKvmI/6JCTX9NfFWu2KnGs9ew=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=M5XpWPiwiSmGREbsJRH3o6xH6E4Lg28PFnpySQkjqcEh0Z/dqNai2Iq3IGZJoCnDH8zo51X8420m8nuydouqFNYrZkHBM5EivUKwJ6WsZb2KzoUQbKtGuGlusra0lio/YR5Z2oY+LTDPQKQpKR+nzrm179TNOtMwJT1TPyaGILc= 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=f7ZbNnb6; arc=fail smtp.client-ip=40.107.215.51 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="f7ZbNnb6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cQ6KQ01OVXirofrAPdXHKTgkmJq6pPen3SATYi/DQdazz6prsQBNQbins+FL4wy9ReBKN0rrVBJxRQIclLefYniMqLi8BOG0cMksjMQzVrP2+Y++RSAxsoEGV74cfUa4XqKR2IKxcsxj2nJnsBgF4JX+vPEd16uTOJpPIkpz+R5giXC5WeCeR3H3Iz94iyU22oswRJrkY6n+14Kj99vvEYtyA65YVbTHAS50Jr5v8vAAQEbEB5jbQj+blOj1+FOeBqJBvGH6rGZNWzDe03O0qrVYqlCCxlIbB2XVFmEcese1WSRpKW3QWYRlZOvC89H8btDRpF/UyJNAcnibyb0UVQ== 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=/2Se7WawwWaVcdt622wJpcgPKdfA2FV+ztQxBflOfc0=; b=q+CMQB8UNkGYRGk5mHQCFgdWd2hwcnASOfw8XMsV61Lele1U+1EO2zHWfkFcIqpvn4HtPymFOONOCNcHsBcwdY6LfAhkRj+nwq6o5MHqRuQkuqYwPhHaMKNkcIH0MldummKI2kJWurkNPL3trhukgMx3+i54haLzAbjoiETU68d8IXyVCERZRmlc0fz14x65vg37LNMVm5jDkLnx3r96avNFSoyuGiKeittdcP5xMv9TmDZbf3BLrDwDTHLNawdVXvjNpTQiybDL+6QCuWLj2A0axrT9k0FjLToqdhgrGnyxNTIxaLyAv8LvHgZwQ1PG8coJhcl5OC5N+f77ezwGZQ== 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=/2Se7WawwWaVcdt622wJpcgPKdfA2FV+ztQxBflOfc0=; b=f7ZbNnb6SPKM+2psGED+CMFBhwpA0aS8jCB3Ix7eE0E9BIfuew6yhaRWyhMyJMnt4/j8DoRG0vC3y/pATqwPRK2ZFUahdF+9RK8SU+2gc3WXmT0IpSjbbuSyxSNpqSvWmQyTB61KBJ6ufDsBwHKkpdGngp67ClgrvCcmGq4Cm6nggjaj30uFNurzmEyG9/WuIQvyL8JGqMA1gTA1torfEk/Tx1psKg8aIqrx3dKNydrP3KPkn9NfnucOjIQK2/+DqGjX9a2D3b5x8w8790rfyoTjxswV+fyJW7LBMZkaaJsMACSX5jq0kGNbAlnhvqCWyUbVoNRidxz5JEAm2kXN9Q== 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 SEYPR06MB7069.apcprd06.prod.outlook.com (2603:1096:101:1d6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Fri, 23 Aug 2024 07:06:57 +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.7875.023; Fri, 23 Aug 2024 07:06:57 +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, kees@kernel.org, justinstitt@google.com, u.kleine-koenig@pengutronix.de, horms@kernel.org, sd@queasysnail.net 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 v2 6/9] net: ethernet: broadcom: bcm63xx_enet: Convert to devm_clk_get_enabled() Date: Fri, 23 Aug 2024 01:21:18 -0600 Message-Id: <20240823072122.2053401-7-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823072122.2053401-1-frank.li@vivo.com> References: <20240823072122.2053401-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR04CA0001.apcprd04.prod.outlook.com (2603:1096:4:197::12) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEYPR06MB7069:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a229c47-6a3e-45a4-f975-08dcc3422d08 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|7416014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: LPjv8TE3hMFmSzj0veiRdBC12CZKN+9gRKh8f+DIpGSBM+wOPnJPkbSSPT0K6RSZJdNvQlrCamER5y0fpiv5fh+1sI9BkMAHSMhktAR1FmDiginrKFY7FmFflkPodp358G1qvr148ZJYcofq8rVw2CME8HwAp3ceD9Tcnrn4oEbIYC9O3j9cMRA981EY183B67+zDnKbW+toxM5wDlOUibSJ6sRafRZnvYXnWuXSZkxxrIXrEgXOS2soMLrRACF6eS6ERn+nNLCJLbeXQw/gEMuiK+8MnXQSAlcrJPwIm5CPm7POL3V+6qIZmTARYB7RBWRY+zgQR7b58YPB2rd9Dm9FaGaAybPuHahjRDIwjlFSljaw4cpyA4DBXd7PSEtkW6fLmDCT+vNEtOOzUybwgERdOOuNjwTcQnCLIXt3XTlF/4H84M23qeRbvIMjw+hUKfOF9MMQGqwLNqoyHB4gZkmX/IKTbtFOZpq3te14TH8G9MSOvM82hyDCsBUU1aTJgit+23zZJ/xFA8u5jX5HV/wNF+y8ZcpbHU8CnLGRtZVLOxox3CpWRSXQfSEuF2Ay4MjFzLZpjI6cRpGUpVx6aGgiTgd50S+0JbCkDkRl3t49VZMp9zVKN9EM0GABVcDAakpo0ryOQeJalXhpetdm1e6LLnw8BQW0TxH6oxmXHb3zvDYVCf8XgPhwGkAw3TpaM+XEPiE9+rzytgMsoTRxFdtBRcQMIUhQUZ9jDzjNT9aQayXfrJrj+KlODNurJR9cgMjSU3dy4H5Wb/+klkI0pWn9LLeiGOQDbuzGkNV+EyJ9IwzVM/fygIyTtW7SC0LF5osmQPl70ecs7Lf0FVgFSfSCyHIiEGxV1QeTKRbkPIQSpg0QiB5xAkQ68jwgAliq6L2eB6IlOZnp9eDCILBhz4DXbKCpAAef1VJPX+hWn+bB03Ks9HQ0otlfuyLN3mQeJtxKd5vkyeIRYTCUhrxwvtvHkeW4BtwgOcgFuFpvRTCXGpek5asFx3LCYMqisDaYEH/Rw4YAqpks7MYlZ3hQ1BJnf5K+oXVklilGg+Rp1Q7UONQ3wuzJ/OUlnCtGq7k2tJUG+gmS5zWylcKk/RzPAhrlMNQ0ICKhfDJptYkIm+JJ5byuoxFvx7I02q1JC8w2Swk1ns3Qfs6jAu6qtK9evfGti/+6daMVVTxwXNgfGowh+5x83z8Zg8TsbrPhSpOA4E8B58Es63U0+MEJq55DoQ4BwPq1uUGqzp2/TF1+WUYwXDk0G384BNRu7B6KGWRQn+OC94sB8NNpy/xH4DHRsgCzQs0EU/bFWx2RnQKEMIrB4gsnsR66yqYxH69L4lPxvdhQM1YFAE8tR804dTxwJQFrje+AOKe4m/ajqMq1ErXAnPQwwuor1K6vjHHclt6Ed2VUe1mofm77gbAH1GyMJN0MO3urgc+R6bVSaLmpaz0= 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)(376014)(52116014)(7416014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xDOmfLG/0Gx85NSM0Xv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AL+8e98cQuxnl4C7LDXffWmY3k3kBF8J3QqXg6rGo4l8Dg85tN/N2VYGvqoOwvdJwLOOzY0TtkS38uQ5GZ5vm+5rs+xSXIccbAm/QhVN1sVnLeLpVZm9L/2DniFKwD+8VKdX9FeRVRDBs+Ss/3iCGPbDa5WGT9REE+Pmc5OrfYTb+UKAXbHnvtQv1IA0HFLSLYS2/8j3s01Xr3jqJzY815jgaCp/oJ3L6E/8o6ca1oI/UOz5PXzezW3YL8KRIcLcdaxiQSn7D7KsjjsVZ/HaBmyxWMTqApJXnsOuZ0pMNOBFbmKX24Nx5/dvAxjZ3BPj1f/g+m/7pwifHRo6/c630iiPZRVak5V241nokUyq+guZwNXIWaTznJiOi9rcoJnsvUNeV+sPVNunyny6VrWfC+wMTgK7fr4xSJZRG+SaY039Vw/0k0W1Me89gbqzU7QmIaCK4OJGkdItgCGTg+aZUB472qIM24Brum3tNMKUvi X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5a229c47-6a3e-45a4-f975-08dcc3422d08 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 07:06:57.2755 (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: IqlkyPayLAC9SGbY2xJ3G3HxAVPBYSBZ3H8AyYgNzqZzOMOeIzoAbxwjOW6NpuApH/LcQflfyPSLMcLOcpLiFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB7069 X-Patchwork-Delegate: kuba@kernel.org Convert devm_clk_get(), clk_prepare_enable() to a single call to devm_clk_get_enabled(), as this is exactly what this function does. Signed-off-by: Yangtao Li --- 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..6e288cee2c35 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 *phy_clk, *mac_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); + mac_clk = devm_clk_get_enabled(&pdev->dev, "enet"); + if (IS_ERR(mac_clk)) { + ret = PTR_ERR(mac_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; + phy_clk = devm_clk_get_enabled(&pdev->dev, "ephy"); + if (IS_ERR(phy_clk)) { + ret = PTR_ERR(phy_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 Fri Aug 23 07:21:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13774687 X-Patchwork-Delegate: kuba@kernel.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2040.outbound.protection.outlook.com [40.107.215.40]) (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 594C5144D0A; Fri, 23 Aug 2024 07:07:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396828; cv=fail; b=IU9Nt4ROf+Ie5oZKij7VYXZGb4PI9cBAjOqLB2Js96rnqnb5wta5thyxEys466C1HQDrp6ABE4ssIHKoSg+d9Dgg0ZHoN0vraQfN4pjgo44LSo9s+g/CFTJg+oxOX1f+rRVDrIq6XSjutDjNm9aokB28J+edyX4McawNSxz8kOo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396828; c=relaxed/simple; bh=yoaScDT7AnFmMBiYnDTbztKbTwwuXKfDPrh5JkGH6+8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=HdyHYMCJOg1VYmNY+vSCIEQ5YZhmA7IfBfJC025SJa7gulZIiSTHsI7yG0YEY9XTRdlP6kMd06YeNI+RYgsrrDcxlQyajwtS6ptgqR8tZ0pDamH2A/RGtBO+LvbaUxmG0p6UOFU5ECGXJYdPUhrU0qWnulBRDnQNhlTKcPo2Rbs= 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=SQcE7w73; arc=fail smtp.client-ip=40.107.215.40 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="SQcE7w73" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tbpMXOwgz0sdW7Zu3+G6zu7nswabWfPo1nuMamzXglEccD2sr8S7HcybbWK6JsMbzUydt1ccjLgiOhkujaAlIGOh1lakTr0xfyz1XP9R1e71f+d1T4kPM1YGy2L08+1m44yQvls9q/EqZ6iTYHxs/19rmdVH8iH63Ag9O6wUoU8I7FYpZMlr56NortoqJtwBAOaGwfNtaycLlqrigYFZ3zTxiXToTw+6r/zZzAtjWmhBzTmHkDHxlvfQq8nIa6hxDEAQZ/e21N4BARTSqVqOSJjPPz2KIsvAHK6PlNWuNcoxTCikUBeOruhDG0c2wDqC/Dot9gUpw0i3e1UXxgLJFg== 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=ZbLO/Cv63aNye+xBWZku4K2vXl5xoJ/bgVO0Zrqcjvo=; b=c2xTCJofNKllNUwV+vdLYP+XIsHdt1Vesj1EXe4kRCttYPoSyIVvnmKgvU8xhd1tRcULVmNsKbOEuGb5x+kEPJ6z0iqGngV6CVJLthDpxepsWZqS61PKD4wqQYH8DEzSUplps/kpWr+zByzKliBMQsDOxndC8vdxkq5IFn3wpcI+N8ysyJ6rOaGmL/MdxzFk6Gz6QPwEvBnC2QdDtdDkQNpoKUFjY+dOXJ89iqS3NC5CSb9CuGRcyHNoVU+uRSRaBvaaGO9YO40Viw1SiM0rEsOkP8wc8pPuN7j/cocgrf9OkN+wpcav6mMY4EIN+3ij6+o+r6UHe4nzlUQTs5LqRA== 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=ZbLO/Cv63aNye+xBWZku4K2vXl5xoJ/bgVO0Zrqcjvo=; b=SQcE7w73hI/W6guJr5c4rFA6N5hAxhedGBTR3cB2se5FMWZgPWpHY8jSOiHBTc6ZG3RAct9bkda1Z8qUs59fz7A/rnVjXKcZ6qMir3BHKijeArGRVU1MeG1+sZRQmNhUdgkW4lt82fyRaDXb1HTSzaKB0Gw4rtySgbQCTjI8l2+mCBPYETtddKXvx5MY1T0cp4qKMJTE7e53e27fN46zJ8dkLSVQhyMTZwaes/aDoLAhLaaufOjhi8kKfKKqNYX0eFvkRLSfODJF3dF73cJAZoD5hzVO3gYIWxLfpT5l3P3ePCu+aOG8nK6aGNMUWrmd6tTYhSeWdWJHZ/kuZOakJw== 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 SEYPR06MB6105.apcprd06.prod.outlook.com (2603:1096:101:de::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.18; Fri, 23 Aug 2024 07:07:02 +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.7875.023; Fri, 23 Aug 2024 07:07:02 +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, kees@kernel.org, justinstitt@google.com, u.kleine-koenig@pengutronix.de, horms@kernel.org, sd@queasysnail.net 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 v2 7/9] net: ethernet: marvell: mvneta: Convert to devm_clk_get_enabled() Date: Fri, 23 Aug 2024 01:21:19 -0600 Message-Id: <20240823072122.2053401-8-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823072122.2053401-1-frank.li@vivo.com> References: <20240823072122.2053401-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR04CA0001.apcprd04.prod.outlook.com (2603:1096:4:197::12) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SEYPR06MB6105:EE_ X-MS-Office365-Filtering-Correlation-Id: f0632004-2390-4569-33b6-08dcc3423045 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|7416014|921020|38350700014; X-Microsoft-Antispam-Message-Info: qKRNDQ8IAye5iBFyYH4WxoVn457nkTSuxtgUzQLCNig/hWnnHIZZGTvfPCLtdinB6aedRQfvNUuWY50nW5KmpYjs2N+X9wp3/ttU4G8WOvEyJ2QYrYlNSfrW5oJElkia+cfYTKjAh488Ec7mo5jIwBJ8coFGVHLLro1otbA2/UyQppLBtRdIt0XdkMr95lMqo7YiMgZq2SGZeEX/PBcCMn9+go5iEck3srSCKDnrmOkfgciBBWTcjks/FbIvY7J7gL8DO/Qso8FtfH5//Q0SZNlLDgps9GYlqyK4Kvv07JjvwwJgTuHZ39szRH9SnePpuzRDl+ygRp2i4LMC0cQCzOK8H6YlNFw3GGiUF+jeh9kicZSFosg7tsabSNdstU9eCbP8gJ91uE7Yt1p1QK9MruxzLDHryOhfPn10sfAWFNuU16IfOHiVspoAtT99F0hAoM7f48+glGqv7bwTFpJRLqowZt0n+TJDzPN0LlLMV7k9oPSx35F6vgFjrwZOISuyUmH2cvrNCWjsXx4sKIhjaIVWg7jj1sMirtTbxrMwyqMIHeHVIzX3ohwnLYejTeHjqts/xTnBFFJqWyOyGwnPbrhqWSqfpWmWcMDZwYcp+ZNCEKAJpZExivCrSjoE0ZPhyWiyqsHESTqlykYDEv6f0he9KZFgwDxKgAhCSXG3L8qQLPrrRJ4nMgbkLTuiGswHufDcN2pZv76sjyPv/v3pXnw1fnjM7yT4YWYCNyVz0gkKRXs1lOHwRuGZX1/JUqcczr2Ox5qf2qLtzDYKZllmDkrnAekp9MWw/5lgusBPZ5fczuRm22tGQ3YRSdEZNpU2lGBkddbXNxRFxMpo0TqCZoqmXzkOlm3FVEPgOgmfCdBrjneUKwaBTAIK2Bo+F1A8boXKBJOrHpjYjTSQX1w2WbHzst68cI1YsXubFm/1rGPweSXwgqp1Wp+h1Ra7dlZhCMhJNYKcry78VK503p3A8gGoS4do+8Ox0x+j4XXGUjv9Umz2WNWUlUx6R62+51SpuxbfMHG3uMpLq9sCybwWGpS1Bp87+sGKrNu8K/O/onDxWWhCu+kddlPTR17Uh2DTg2ZMOxL2u2lAxDoXKARM+ic89stu5fMiMY8Zu9uLpo8iOsS8vkCmlCSJ3gY8Seh5Z1ZRa05qN/kZxx8+eraJSOoT7n5sjZ/NjlOcYb6h+/GKxGrFXJPNVCjCRvUklJ9o9ja8mchss+90LiimCpwDK2xPFEeGOA4pkwmmpkX4UGEzgMW+0I/xZYDRldz/hlM/CicvzaWHVzktclFFFEqoQYepyECxzAp51KhkSvXEKvclSx04RgCDQ/3VTngjnNNL28U1w+updpak8nykR2xjrHfrfUIpoGmCjDq0h9nnZCpwL9lXvullG2zH45obsoPHojDoSlYbgjr8LMQu6soO4tJ6DD7j1n4IJ3Jfkee6+zc= 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)(366016)(52116014)(376014)(7416014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2OlxANd/3jjSnzCHW+yE8Zy2iIxYlz1orjFZjrGtaQiH31/WJacLfzUy2jAN/fu3/ukuwzHA31362uoB5qC6Bfrjq5KkNXG/cdiN6zjY4yTjM+Mk8PMo08yFGuWVvtB6zcVt7niSEl8/ENsKvhs36p5/jXK8jYW5B6cWxmLJLWFFggiSoCj52XYW0xPGxb25/dMUpJecQA97B/VsRds2hU9BqIUF0l/pWRfA0klPXTT1QZq8o4KRSMRh/eXCgum2AzXCQNDgUuxWHRk+8l/1BMKLMhtV+awIcTnRXjH53uNhtllqnT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bKx1lIypoY/x7cov85XtQxqJwVEku+8VPVBl+9zxCpTLCcl24pnghVff3u2hDWRdR3jhtNc3LM7SICvyWXuw5YtYn/w+XG9TCZRK8psrPf6jSQqX2/d+pUksJiAecgXf4Ia2h0QykZZyKecuNFUJDzITKtL1hPelzRHMziIFqMfbzyNlDWyNu9ljed7mUdMcSklJEtNveMx654QXM X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0632004-2390-4569-33b6-08dcc3423045 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 07:07:02.6982 (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: NSIYroEUGCxuVtqfl5Ar+XtI77q65WIaRtf1rtFde3w/hSuN/xkSJBZWMJtQSNEuB8/KRtj45ZMZHf5MgL8H7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6105 X-Patchwork-Delegate: kuba@kernel.org Convert devm_clk_get(), clk_prepare_enable() to a single call to devm_clk_get_enabled(), as this is exactly what this function does. Signed-off-by: Yangtao Li Reviewed-by: Maxime Chevallier Reviewed-by: Marcin Wojtas --- 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 Fri Aug 23 07:21:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13774688 X-Patchwork-Delegate: kuba@kernel.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2057.outbound.protection.outlook.com [40.107.215.57]) (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 ED42513D244; Fri, 23 Aug 2024 07:07:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396835; cv=fail; b=uxv1cM2ERKKtX1FBMyoGwy96j33t4Q7ScNVvj55CR2ekSZRvAg1kaYfSXXXzohBKXJdY5zKf4q/TBZ84wE8ep6x2jNBGy30RQA4NMEwyDNXgQkyW9QFXaHJULy5yt8l4Di34sH045jLzRuMh48T29jNEXpzFboAvZNRuI5Zyzqg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396835; c=relaxed/simple; bh=kUk0jxtRZVFPLqs7hmTHthd0frHqrpJgFBgoVf/8HpE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=ecFiMx5i6r22SD5QteVZ3LyT4/ckDNzl+Z4y4to5BGNofEbAY+6k8DrlB52oTZ56zLkNwZVBtboyP8rWjOa4AfdnbcIUdJRlbYxf5mjQv4c+c7UUhnw3+/xIXS6kdewueN5/9SsjTuqpgHiStk/7pfNrtsgIRBmsX/7MLFx7zzg= 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=Fe/kAmpf; arc=fail smtp.client-ip=40.107.215.57 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="Fe/kAmpf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Lt+n0YtniCQqZx05xP3Ddtnz8KDfnaTVNyKxJa+y56l/oVSLGqT1hAYp3vZgbRXMjq6IRCxAQXSzVQ+PVPTHUi1n7K/octy/FhZpD+7ar2JlI882d/CrfQ38+SLvnhCeMTt6KUwJgcFbjYGqL3ScxLOFdDdi0Trg//2KkYSB6uTQ2YqqBZ5SHrLSgQQpO876lOvQWGrrT2VRNvh50xEgpszTUESIYam6LAizFhPZfSnx7jds2VN+kz0VeTxc4YnyWdktuCOpMLmTZUksZovuwfJOuLRHcBINN6K2CZixfoiOBUfkxn7ocRBYe19bpfyih1TJ6uMun/t5gRBDuSVa9w== 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=WJmtD863T3kxcJbVXrhCIFngJj7X2M4d/uZuvnSe5YY=; b=TKh3YGqXCxNjyUIL1dcAGlmfmymiZ0q6iZDzyo4UaXrzhYOvsXH29I4ePBG/JSU2JpNE7DeDCEV7es1oHJDxeZdTzqbvR063EmUwAS/CEw7HYtZ+8qHljDiwdfQl5BI/WWbqXFuniy8LVExoE9i7ryRlL1hEK4ThVwQaCg3XqoFuyRnt6NW9xD0exMDw5HW+Z7aMH8Do3NEQIz0N5iA0oA5hbRlMrr9qWZ9dex1s2QiyDPQbk/NPfabQjxI1xRAKrbxfGbIn90tA584ybJVPBopbYiDZbCr7ijweuD3cyTssjNK2ENhbkfF48Yo5/xhiWUkS/WSusPgnRQ+0Hhd7mQ== 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=WJmtD863T3kxcJbVXrhCIFngJj7X2M4d/uZuvnSe5YY=; b=Fe/kAmpfteckRfGjy9nYAzRzZdqMe4f2tN6vPdqHaIDd6G2D7KSGG5Zo4bQtW+X101UvsLgJdvZJPk8OuqkOogUP1NRxoLFObSVfsLRxdT1Z+z4+wXwcM/eyrkUSdREjL2xaMmLfUSJEpbfu3aCMdFhh5iOW6pDpDhh6hzlpMTXdAkzauBlS8fi4cygm+hlJDFTlQoYQG7g/HNTFhTKNfXlizuzGleYY/Md//y50hOLGTg8n1GuhUSPmq+kiQNe2otdFmzZ0m35QemyUf8dqebrH95gdY8Bv5JV0IK1YKAX3gin1p+NlhAYqPvJQIkp+xGUg6WxmLczgcMNuZmV2Yg== 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 JH0PR06MB6980.apcprd06.prod.outlook.com (2603:1096:990:6f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Fri, 23 Aug 2024 07:07:08 +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.7875.023; Fri, 23 Aug 2024 07:07:08 +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, kees@kernel.org, justinstitt@google.com, u.kleine-koenig@pengutronix.de, horms@kernel.org, sd@queasysnail.net 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 v2 8/9] net: mvpp2: Convert to devm_clk_get_enabled() and devm_clk_get_optional_enabled() Date: Fri, 23 Aug 2024 01:21:20 -0600 Message-Id: <20240823072122.2053401-9-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823072122.2053401-1-frank.li@vivo.com> References: <20240823072122.2053401-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR04CA0001.apcprd04.prod.outlook.com (2603:1096:4:197::12) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|JH0PR06MB6980:EE_ X-MS-Office365-Filtering-Correlation-Id: ed409a36-8604-4570-4ebf-08dcc34233a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|376014|1800799024|52116014|38350700014|921020; X-Microsoft-Antispam-Message-Info: RzVHFbg3s3lODcUP1Gv/RXNoruaSbvgH7ApYitFmJFtAPyeN9JvcXE7SN52RlbPmkgSR8pZjoINQqaBAml+gJqM9PPDYmr2Xcu2FglXZl1/9tdS6tLK9tjTQQkjNXlj5wrICdiJ4djWpq+iEGyUufhloqBNFuay8RUttNwDsZnHsqFWtF3r5odL5lbp8sgdTt8rnCYroeDWRTo3obs0kwV5ogr28UJZZ5dF9MRsjjt9oKS34al0w3HyI3fTAgjh1PQx57eBGGyPdJ9EaSxIeoMm6R5ewxx5nQq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2MEEg4oQ4is9G1B5LYfdi043EpkStwBr16DVNDMyxGKTZILSI/aHBQ65rm4GhdTJAH1VHfFn2z6Vqg3zITxE1sz3tcc= 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)(7416014)(366016)(376014)(1800799024)(52116014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lcpVoX0WR69qUSKeCYQDoQPxrc6MlUTlroEOMhOx0AzwRjdRWk4Qfln5jyI/XfchpiuLuxo8e4R7UfQxp3PQ73BR7KlwKOE7ciqNqQMtJWfYtpPV4NL7gy+ErPv7yDtpH43WwPnYMbCms4k8QHt+hbHB9Z5LLeUlTw0Gh8wjqWZN7rMkMDfh3vVBGKfO8JWbA7dTwCRXdAhBy8UALywFlAFG7iJVfxV+zgyGtbBpGEo90pWMDZNwdIt1Pn5JHVwTTp3eKW9cKU9jW/fFewVWhN3hNJhmoUquUBxl8pDJgInU5SB71B0RQ+1NLm3magw610yJI08MCFChBxb8X7GH90X9w1CnJQUUFII9pbMqKHOIcLkdP08tA3EjoWkKvjL8nH1NVtgxKWWD5n07FiLIQ4ikRzwMcLZLklrJplSJsKyOB4GZo1sB8D8LUq7lJwkyrrZmXLHDjSReXrAvtRsGN3mhGdY8sGtLYj/C5tSx4axK1885P4/qRVue2xoo3mpUqsH0T/8OAih+82mZ5RzVgGAAHHbAzTe2YuPCLDYqN59okC2eaesGhKjggLbKDYk7ypxc4fjTozdJvGOA/a2dn+lwuxuyq/Nmqtdmu4veAisBLyNkWpdJd3AzyvVID5ENwmr8EQRm2LyCOi3tYnRMAzhDK4R6J0l4AqQvhxBqSScTPz0ay1IhpkS02nwNnZ8jSCS4xxUsGyMGbp5xEPi5P1CYF7D6JPBTyBLdCKUOxmKXkXdlNnTXaAzVTM5rX6eZp6TO77eYm1dWihC610ttNa/78omy9q67zeXeXJka0yoOOGFbnFvTsocpEbK36IYO3HQBY1nVyaizZ/pfEuJCCrkzb8v8Zotzd1k/tPAGV4g9UScLPtI2pFeeeFlJo9KEdenMUhgvs0VZFFfoFhZfAgxHBXHi/yZMDRmFe1vN8Sss+TmmE6eMxDtXHGgYI53n0YQCFL5i+VwjsVTASHutbOeMQbg6zLT58whF0SxKDDWKUaiIH+VBcS5+0AKVj7WqrC5IbzAHRntfYBLC42ud3W4ePjipJ/VsZylV/89zK5gIWcmjNtHX5qaQRv5CYZ3eAzNzSaeScllDsFhsvnjy/z9JBHW9vkTBhAUU033f6FPEXdwmzwwYaE1djHwB3ynxiiorecI4cSyDHNi/B4VTJQfM2cWkdKyjGbF4Ktnm1qlVmIe1GwM+RmhZgQDo/UsldJrosSYKeD4Yt+kB7nvuXDaLpdQ5DjgBgZJe8dcHnvOIW0X4H6ejVlV/h/jRQYmXdIQ/p3itc0FV6sDTK3AYfKMS+lldPUPOP+R8obqWGvyhBLAp9uJxySr00soJCje5pocvNeH5HWK6auRLudc93vaRBN4+Hox9O66rDhuZJKz5SqWMvMnWIOJixt2NeMOxljvYF8HdFpSnsIt/jGmfq+Zn7UHD3GHuqODIFpwEYi1HS3CecUxEREIehQXyXITSiQNf4JXoOTOG7cLJFj417VwlGWv4UFItaeMlskRNj+Ufl5GPXG0LPySafGwARPh48XhAu5ioYDxoEiRIJbT4zijT9NYwbNE3tjmDqGIUgzIRZtFKEsV1Um6bkWymgA+s X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed409a36-8604-4570-4ebf-08dcc34233a7 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 07:07:08.3811 (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: imLLe8Oq6QcYkessuiP1+e4SCViVG9GPKXhArL4cUgu1F/nzSUNqYJIivxzF48vPAfU7u4ZtVMxv3pJyUA+6Sw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6980 X-Patchwork-Delegate: kuba@kernel.org 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 Fri Aug 23 07:21:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13774689 X-Patchwork-Delegate: kuba@kernel.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2057.outbound.protection.outlook.com [40.107.215.57]) (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 E6D70149C59; Fri, 23 Aug 2024 07:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396838; cv=fail; b=KApzhMDbNB4L5nIsbP2FZDQdhcDY80FyBOxRY8xXim0f8e41yLFh5Dk2At/If+W6H+Q7cTDbAU/rHnMC/2eaWAkV9VzIbgQlk8pyDAQjOClQ++3O+KlgnNf6IY+trN3O21N23AtXWFMxA7JKJxV/kSocSAMbAekYCruWgZ5fKbw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724396838; c=relaxed/simple; bh=zeX/YnL+vXc3rtOcLL7mYLbRFsPSV5CJbQZUVBOm3VM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=X4iJ70Qkv6T06QsvqSD5w20tY0Q3tsQkkeo0UuD8YnNBhQoWsheOjuLdnZ7Rx8IF3RevzAo+2n0VWHI0m34QBv2e3t3Dfno0VCMMg3+ydL9P5eSOpidhfHFj/nMMCpK8BvSQHgYI0uUBSDW6yTR+O1XOM9IumOHewqFUwPaDhsE= 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=jqha4XvR; arc=fail smtp.client-ip=40.107.215.57 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="jqha4XvR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=q2D0KqWreQIbSwRFo19ORgXIfe0tYN0EVDkllfD0XJb8m8OjUsAeaPR9WHgTJck3Kftmtti9edg41bAf4Zl1fw6kIBH+ADajjSWXHtphycADvXhOEnBEdWlZZt5FTOn80CuY/ugz5ZSWbuvUuIZs03qaP9DnkELMnlhcIdt/XP2mOByu9ZgPAWmmVK/NPDKAFGvNjZ/oFwyBHwS9vCMTRJ12/vmdFuTnW7eeKnBGsdXg675EX1N8pW5pEvgtCPXieYkySv94d6HefiKoeAw5HX2+clen2zscYh1fs/mPARpqX8Vuzk55FeTbyjo8X2Bw79BahMIp5FjBw29xXK2UYw== 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=olPfDqzMDeb3SOWfwuIi0UyOmY4hpleHvOKQLIRDQSc7hV3k91RyUs6glUyNIim09RxajF4TAF/MEg22VOSVWRYEErza8KkJ5BDGWBax82XtzPWw1v2N+c9p3qYElSp61YxMU2PEm/DBydBbHzFbjk3CZqyJQ2L8mppuiS6j12tR1yHuFcKewOlSjwk5G38A+s6bPMNcPI+wuRb4Hf5dU9VplQUYsqzLYZDet7s4e4zF0w7JftORq4aQkWSXblXcLZRSdsIAaYYmvUKgByR3Nh9Xc8hS+eH9uUvxODm8PmplQBIGq0TTZCkeugJUBA/YYhkulK8kBd6UD+P9M8Xplw== 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=jqha4XvRQ8O9flSPaRY17jW0G/MCRVcdrDhFJJuIUm00wXgTS1OnwKnboJ2eE9rD9rLbpNVmWnMcDwvL/XCNzlUhGXlJ1U33iJIio9ttf+nXxgV0UZ1r31iZ+m7CUMmsdiO6GnHpGHptjTKURQiTgxYBGbAyN8W6Bd6E1IPHJPXirHhoJcuSUBT9dtSK5p3yYjv/TsU2udKEZWQ+8jOtCo3siL+j9OoneDXmUJb731FWnAVNqolqVr6ZjO+JSKaZkzQQHXtDDNWS2dWNNfnAuPFGMTkU9ef9XEAm/S4uZXE6k69Z1bHZN3x4RiCBXRYOgRL3dWWV2Fm/Ty8jKTwJHg== 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 JH0PR06MB6980.apcprd06.prod.outlook.com (2603:1096:990:6f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Fri, 23 Aug 2024 07:07:13 +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.7875.023; Fri, 23 Aug 2024 07:07:13 +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, kees@kernel.org, justinstitt@google.com, u.kleine-koenig@pengutronix.de, horms@kernel.org, sd@queasysnail.net 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 v2 9/9] net: marvell: pxa168_eth: Convert to devm_clk_get_enabled() Date: Fri, 23 Aug 2024 01:21:21 -0600 Message-Id: <20240823072122.2053401-10-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823072122.2053401-1-frank.li@vivo.com> References: <20240823072122.2053401-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR04CA0001.apcprd04.prod.outlook.com (2603:1096:4:197::12) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|JH0PR06MB6980:EE_ X-MS-Office365-Filtering-Correlation-Id: b5ad0c70-d0ca-46b1-0367-08dcc34236bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|366016|376014|1800799024|52116014|38350700014|921020; X-Microsoft-Antispam-Message-Info: wub3cS4t2M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ZGAC+aLBy5yxgxqo4jADM1YC0Q4idYHj8ecs+7UEdA8dXhJqYrvcP5txwonF3ISSbYrGoESd90MM2YbxXMYiTUxlGpgBxpzvrPW/gcSCI0kEDwfqS7F5fgfjLngycD0MdkAE3CCveW7m1MbqRrbxwkTGOI6G6ekMEi3v6mNaTt7/rt5SYshv13HLULpvQnAlxzLhHfo8uDmfX5fG+ZkQ10m40YOghJd0fq80OojE5Ploi9SRH702UyCTP2EQRe9XN6ogOSniQ1btr1fewC3vfyOJOUiAD+qyNFrC6DmpDLXVAL6nY5LamHeqgf7rvbuK2kmXMP0yTiWD7Oyr/wHbJLDtgn1fMwX8Ui8LjoXqEg= 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)(7416014)(366016)(376014)(1800799024)(52116014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gHcQydh16iDY4IDqdEJah5Zpj64N5wIPcIocgMe7zViQ8E12YruuV//b+u5ougKo4ZVTAhG9DxVWyA8zWU7/D3x4RlMxsGVEwiEamSFYTLZ4ToAA0QpISiiedzUJu7uflTFNUezRCnOj1k1zXFsBoh3cZZc3NdT8gOHrr659oKy0Eby/IpnKiuSK2tbpkKC7zI6huMVvdC4V3gpv1AwntEryTYeWFnmumrtEdh7wrw48crrypWPQF2TxobYrFCY/kfAuzLcAzOqiFj4gq4pAAewztVFxq/r4tIIugA0fbzDoOPCzURriOFftlJB5w1JzfTtM+MAA1Jd5MhEu/5k3OT5Wqq8xKKTeXeCUt6PXqyJ0UDbBuBtBYmvq+LxtqRp+TFE7ev6B3xzGrli4WD/D+Bg3OgEyPbVo76D8SxOn2uLowp5cmN7S4IgWrrgjmQZCK81pWyNnwHGIkylicW8f6gS5vUPvZTBFzLDn3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T5ltp6S3J0AiAV/GN9Ix29ijRqaJeQjTmEUCukmRzG9CS5WH X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5ad0c70-d0ca-46b1-0367-08dcc34236bc X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 07:07:13.4831 (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: 6ZXwq+EYMG0Pv2dU/Ep7T8ND5DHlI0Kzt1ugjIhensAjH/1rPrcj3deCnd4uH8iy8NlNQMvPxKP0Ou/Tubjkjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6980 X-Patchwork-Delegate: kuba@kernel.org Convert devm_clk_get(), clk_prepare_enable() to a single call to devm_clk_get_enabled(), as this is exactly what this function does. Signed-off-by: Yangtao Li --- 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);