From patchwork Thu Aug 22 08:47:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13772968 X-Patchwork-Delegate: geert@linux-m68k.org Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11010048.outbound.protection.outlook.com [52.101.128.48]) (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 4676117BB33; Thu, 22 Aug 2024 08:32:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.128.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315568; cv=fail; b=r8Fiz82jvX2i3fzH1CqcBcvsmVhqdlbdHNw+PYUP7NhLJggMgENCWDnIPyAnNRtt+JpmzA30apUzEJWPyldL8qlmRf5nqlZD0HVEr3rz65x5EoVuZJJxaxiwpCb5rbv7TXXxr0OQ14Zlz+2eSZ9G7LwpjSqYLTcz1E7MmBB+yG4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315568; c=relaxed/simple; bh=q84ZdESuhdwF2N8JsUlh3JTg4+0UeH+JICFuIdKxXSM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=S1K11SQ4j3mn+R3Md5o7GBv4utnlMnkM5JMJGsmI70k2M7roaL8VO6h/WQ+p8L+HB1xPydBOl6VngoN4+dGBVxpb66X/lKd+aLWGwO1j8KBrAI5Qdj5lgXziGaPEl8ieIVVYIKguTeLL4uz5SpfzUqSAndH4Jc55qOXCkNZow4A= 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=RDxh+p+g; arc=fail smtp.client-ip=52.101.128.48 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="RDxh+p+g" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yB9CtMrRKL81PFbgVcGuK7lb66u3M5ymYXWBVsAADDzOzpBnQ+iTY+IBMSyyquRes9i3pJMbTB85h0xHvR7x6Ur+abDn29C72pjzVRNIHwGfsHhPyYjr1xhij8vdlwv/mzuYKToab/k+INxP2HCNPZqzb5PB3WovdFR5C8xg32djmB82nfpMbkKB18Aq90PzX/Co7ey2Y0uEcqzIB5MQXY5vxUvOgOvIgmPXlIpYe3niW5SnPanli97KY+4YMwwWEJG2EakirdCxY6j6wavt9FaoLIB9pRo0rQYWTZQaN4cmwZ/7wKBYHyMkNXagfGFA6a1ItwU2RSOmgSTHTfC92w== 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=J3GiK6ODgsx/PiIlszUN8L5lGBAXPklB3EdsUplc/bk=; b=JKFsqbpSSd6BYwrd0IPegrF2JoJF4rHqjYJH8VS84V8+T8nAA4mFQz/RUYTyDI+5QtrxD4MSarH0lSi7rEeB6kQepHHfwWzBcN0s6lo9qCghUnt9OUf8lEXvJFtfKvUyXWbgdyp1LEMjQWFRwNmvWQTTRt7brAWpkoIhKMLEF6cGFQ+MIJki1/N/AiXXzjUp1jPSoFkJjn28cluGYLNIt6df6wF0wP/+PrjMoGTjlbnWZn/aE7eG6wnehgs5SCkuRzGVtNdO0mteGC4M7b7ASbPvKc35cv6O3gp+d3vrSxZjoKfyBIa8ViyzATZjV+V9LQsU5RvIpzrIqoChAp1vCQ== 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=J3GiK6ODgsx/PiIlszUN8L5lGBAXPklB3EdsUplc/bk=; b=RDxh+p+guYURaI3dGbpBnOkzDUkNA5veanbjGiBhnKUhp5/8m3yQOyKu2MfEbPchQVoSyWdHTHUQ7mO6o7UB1IR0yeLlq6xtFvzZTP2DohzJM7mZ0XYE/RAtEH2wHEp3zRS4aTMnsmfWuAvp0thku4WZYLSL8JzQusajipY6MXTkM63u4+JR0n523yLkMkUYPddU12zzGMQwzL6TYc0HVGnZTF+CSlx9Z8bH4ivPHtKPeoATx1W9mA40fVzDsegpwEK3p308x0LboCT3KASyTXrpGQ8eiP6ytxeWtXU7RZshQqqJzdtlLU67DEwUitypkoP3zNbBt5JwvM2ZDgyDpw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) by KL1PR06MB6259.apcprd06.prod.outlook.com (2603:1096:820:d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.25; Thu, 22 Aug 2024 08:32:44 +0000 Received: from TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1]) by TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1%3]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 08:32:43 +0000 From: Yangtao Li To: clement.leger@bootlin.com, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ulli.kroll@googlemail.com, linus.walleij@linaro.org, marcin.s.wojtas@gmail.com, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com, hkallweit1@gmail.com, justinstitt@google.com, kees@kernel.org, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, horms@kernel.org, shannon.nelson@amd.com Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Yangtao Li Subject: [net-next 1/9] net: stmmac: dwmac-intel-plat: Convert to devm_clk_get_enabled() Date: Thu, 22 Aug 2024 02:47:25 -0600 Message-Id: <20240822084733.1599295-2-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822084733.1599295-1-frank.li@vivo.com> References: <20240822084733.1599295-1-frank.li@vivo.com> X-ClientProxiedBy: SGXP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::17) To TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5275:EE_|KL1PR06MB6259:EE_ X-MS-Office365-Filtering-Correlation-Id: d426b2d4-df4c-4984-7803-08dcc284fe4c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|366016|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: IWrC71DG0TxpHxX+7a0lHdbPIekW1PGSkw8OkqiDqmHt0tR3h/+6MsgxcvIUWU584ZKQjKs0rJ2D8jnWrJem/iT+fjCkr8OR2Inwv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RkTKLipj9290La+3EuYO5Ve1pupZ0TNOXu9xsSmJYZn0WH7P+3loZNO+VhhGzf1BlcIkiVMbnkzdvZz226rY1tHF26h5PYZXorQgnkF7WL/FBsDQGgfXvzGaPYZc+d0wXaXFVgJ/5cM7AmgsNn/3Qmy95qBhVOSO1bbRx+9/2V4keMxiRi5h1st1yJW8+8No4e7hJy20pHpKOwDepochJpFSw2cCkCSm7FEncGYO8XMJIjSqW94F9zRxalIqMZW6dN3YoM1gz3VOXdo7/5+KQryVL3NnKM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB5275.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(366016)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WkNoPETHxXtaeRgYbXK3BQ86hvGret3Ep1hXG4SIkrO5I12gFBHxU7qv7pvmxTQFVOeWnNsayTigB0o6mgYc+kj2CW8sqmibAzyY6OBWPF1aLNEt5kQRoZx3bETNNGO1tgVyK5CGm9umr4e5gqgAv4J7NHdT2m6td03i4IV2IhPdeY7INN4kP+j3EOnOFKEcDA0GzbfkP3/23038/yR2llImZJiCQxdv8ikGw6ZB0eDfAQ2AJVTSpbJ7OFBtyjS0k0HH9i96aOocUYE0WsRgqdY5VTW3ruuF5TpAldzuicIXK7+zyNbeQf309ii+wJAkyPRi84JLrXHXAjJgNMk6cjuNX8NoHisZFRnup1sohOh1XMFg4HRGZ1g3vujcwqfYDA8HrLGG8nprjcFl4u4ETP0vQNXiHXf+VW6qluJ3l8mYFkg5ej1dkYoBXisJyiH2usR4pJ8omXGsDRZ3M32uU4ZdjMPiffc2+eliQvhrWAZ3m7KjjSox1/FJ4dH5OrIZQ3q9SuLP6FT0QaHG0LKXPiBYkoVUkP8bsQcbGwTSUEWnfn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Id: d426b2d4-df4c-4984-7803-08dcc284fe4c X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB5275.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 08:32:43.9025 (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: hJQ60OkNI8Ipnts6vRf7mzqmYTHTGM8iSlMlXxgZgl63adA0VJgMDIPcQiM6l7jEB4V3D19Q1hmou9rCXjpvAg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6259 Convert devm_clk_get(), clk_prepare_enable() to a single call to devm_clk_get_enabled(), as this is exactly what this function does. Signed-off-by: Yangtao Li Reviewed-by: Maxime Chevallier --- .../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 Thu Aug 22 08:47:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13772969 X-Patchwork-Delegate: geert@linux-m68k.org Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11010055.outbound.protection.outlook.com [52.101.128.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 915F917C7CE; Thu, 22 Aug 2024 08:32:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.128.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315573; cv=fail; b=sj7smJzgpiGwCSaaxKyPyXGWDW0VX1rH18WoPwXgHY+MKQ5QRLoQ+y9RfFBEUo9v1Ii4X5TMeJITI1O21hUda5ftq3iHyAfu5hh1g6BvmFUL4pKFwgAkUFXIKT7hqVUoPQitmzV+r+ieMgCKqr/xyktSvZsB71n37Nd7pUmvUxQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315573; c=relaxed/simple; bh=t503dnBZaOZj6kU1x+FB75B6amzUjhz/adf6D6FdyfM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=DNlG9yARA/2CQVzc1QDX0fLBtWBVOAIpuV+JTJrBeEDLDrHmrVK42hIXusjVg5zfis/AHjsRm1QF+y+LngbkXpOWs7uzY5a0rkkbRDzNjeVH7QfHo0MUED0zM3UcO3mOIJxA49CoBNNJSj/M750XVvaaqiMbFdf7mUzWqNtwU2w= 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=nFZ+YeQU; arc=fail smtp.client-ip=52.101.128.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="nFZ+YeQU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ACZSo5BQltenrdp4/zepKk0Ig/ffDKyfUjhMXBQtdmN2cWNLOjqNQMNs7olUJFxR6Qf7g18Q/k1v5HmgcYJUGmTH6tReDOY2UbEfTjb/9pxSrzeNBApYgedSz34GSWAkD99zgc+M0mrMKti/lj8pY57znYQIX49UMXBxtB5YeT2WKxppUba1ItAx8hIvJ/xiIcHF5wlDTtUK8II+GcmvAUehL6mc23hQfppHsfl5yEHtjlxgAqQ/nEh5kbptHIHeyf51prx+OMAygfNYeNLAeW3sTUZhJn5oU3PZ4JLz8snBJKpUsWyOD4mUyvmmSQERxy93uB0KS327wYUvBuDhFQ== 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=hHKPfG9hdm+u/TzBm+4+OpJDRI+kGysmRTURtJJP2qM=; b=gGpjVLY0quIMawb+LkSscB+FnW+R/MJ/UPAMNEXuQf7gpCxLqlnojrZccKMqqdewJKVLLxarBG+ivqZ4ChZ+NYkfHM8ecFi8dwYE2cXfDm2/4WBeQT7XfZUl/6U5MumsaLNOH1eKm33ib4L+zkPFCcDnfxy+Kk44PlVjHpwl3xp5jTCy+UHKqiedAU+F1Okw5aecumq+MEnZM+/Dt71vnpEUEhXRWj+svPRMDxgA4UArUREFEaMT/c0pzPBE/46W1m+O9pGqlD/28rJzPnqPzupuhrjJ4P0O2Nu41+0UAQuHf9BXuK9RlUkKd2jh59BLJljU+6jZwmdsPuNLmNzS7Q== 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=hHKPfG9hdm+u/TzBm+4+OpJDRI+kGysmRTURtJJP2qM=; b=nFZ+YeQUgr9vVONa9D7WPSZMfABfF+IRtx8/jBdidtdKlNdklomsbWJITAXIndghB1CWy4q+QaKY3kwOohI5bG7uDPbmm7F30mH4VYx0xs4fbVa2glsvddgnvizETzLY1Yd50schRb5wST9KP8T4OEIufpOByYhRegARr5Eo5s4QBuuZGGq6IvX3hbNiewLycHrJWLNIFp999T4VDwXwzFaKupaN5Ud/+6Xp00fDS3bJhPzNqdVz3Ou6nPBCpygkcXHdzfinSxIpovMBoLrwiZi5Y44g0WpDIB9ZRa/3pBA+1xKx1z1JUtokliSZrHndkqLUY0xl9DpbaZXCNwCfbg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) by KL1PR06MB6259.apcprd06.prod.outlook.com (2603:1096:820:d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.25; Thu, 22 Aug 2024 08:32:48 +0000 Received: from TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1]) by TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1%3]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 08:32:48 +0000 From: Yangtao Li To: clement.leger@bootlin.com, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ulli.kroll@googlemail.com, linus.walleij@linaro.org, marcin.s.wojtas@gmail.com, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com, hkallweit1@gmail.com, justinstitt@google.com, kees@kernel.org, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, horms@kernel.org, shannon.nelson@amd.com Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Yangtao Li Subject: [net-next 2/9] net: stmmac: platform: Convert to devm_clk_get_enabled() and devm_clk_get_optional_enabled() Date: Thu, 22 Aug 2024 02:47:26 -0600 Message-Id: <20240822084733.1599295-3-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822084733.1599295-1-frank.li@vivo.com> References: <20240822084733.1599295-1-frank.li@vivo.com> X-ClientProxiedBy: SGXP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::17) To TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5275:EE_|KL1PR06MB6259:EE_ X-MS-Office365-Filtering-Correlation-Id: 92ca2faf-43a3-432b-603a-08dcc285010a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|366016|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: jnAwyWMKqoV3sq6eqtWRhRU6XhSz5a8HzIrA8bpK0FtjHP8w+spHLPLAMS08+7NU0hlL4D9jF9+ZiV2u+9Y1xY9XLYOkcyb5Ro04ohLNluPMog/63DZO8g61By7CP4jVSywpMr0Tfzp76ZJP0WLJpnhHQz6D3HbXlgQ9CjfejPfv5tvaG/rTYwtz21tIdDOYzjc/PwMSv59KhumQR1mJc34eqpiMAJBCPmttQEmXA4GXeQPrVB/iw6DDfpqsEtQYj5tMNNEEdiRO/6OSguNoZaFKgpbKd+h03xNeUKnftCBk3gOtZt0y4i3fH0gSw4ryfrHN5m8n8WCzuvODu+CLMUVLOywcYdaRoZArGABEfmq5qkompGxkgV2VumRnEW5Tz2Rj7HU9EY+5nq0891hXq8lpmtgdYw/y8QymM7rCqusi2bnFLtegzJBkNd45WQELLi6+WuziMcRzBN9NTOAwCVOFdqvcdAMwgqvhqikiNT6fTa002UQkaOfBfmRut0tt4V4P7fAs9C1USLbA3mVBS0um9y5fwBTybgFTyebffh0Y0rvTDYMjheKJjlpZP5BRPOS/LKlGdDFoYBAVl0DLdykQc4rTmGewsUsoRHOPrL54tMQhTo7jyvytFOjGZ6hp7XCEfBlFDJFjT6HEzvqRms0af1vQkJWu2HmvRzrRonvQUIWdXSHRwBqEUFJFA4cVbgayCQ2g5SOzE/J/oMB2KML0j/bZrh6bEAUenj3ga7AbXsNJ/9cF7hE9DLkOTKRu7sbQxeL1OLCQhyilo1NUz+pXkgleztM9R+E5aP00BTlU1gV2bfSZMJhfq+5wjjildVWNURPKrY5dOJrE5JYUmHOKFCNOBYgNM1TXYZ6CAuE8VX0n+Fwfg2d8aoRQDlS0ZE5H1Q0nx4dKtOQizP9nY5TMlwG2btSQelDUSP+qXWBsT7a1rk4TGG2fuKzYVIcebknRFVIHdyIZrXj112j9RXbBO76rVLP+UZ4sGaPvHF8CCfqSIihBJms2MaJ9NUw1nKl0EoFxJGBMAWe57fKLifywV3CipS2Lqv8kFanjphCSyjQGZklsBWSnImrAP2b9bs6CTnq8octnBpnavR4FT7/2LrClRG7JPnbFyWwFTpJDq27+LFR1L2ODdMG752w+RlHz9TeeXLPgdukTXu9429oYe+oXBE/2RSG93w2itFcNetZ9RiDMKZ07yzq5hkuefE6cU1i3WZrpsXpEG2kVFagfGlBwthhg4pk/BP10qRjqBS/58jLEtD9xmmGVfbXfihw9DIRY6A4dg+99drMVCg6JNkx+hPQxPgIOOmi4VlNjsK93/rVgVlYa5xs+rBR54q6mX89WTWgqvzO9OVDZKHj5G5z/enQEU0RikGH4Pes2POr8qf8UbPSwr/gWJ+YYJpxytBUiH6O76vRmVnn/kA//Zk7V0hqIYiqPSpAH2ks= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB5275.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(366016)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rvxCyB0boD3YTLBNSoGbztmQBde2kP0yNrg0Mt3vFUSmKzf0KZrbcizz25vsAf0zJgAAQqJBw9Mxwt/9P1iZKYXTV1ER0AH4n36RcJLOv29fbl6+ImH7wl/uRPyTlZy9lmx/I6EXDOrYQeYi/Guy7VUuPYq+scz/INQae6EbL6WeqIdTDgrO0dYtMmaM8xnyfbcQMg51WJ0FXDpXTEyFICmwbIuxhQQeyYRgNXed7X6uGGOfWXD0+OMiRRy6DTZVXp4fD8V7i8qT93pjTIu+jyTW46WiNlxKI1gD0n+Ajk5Us47sHIRp954AAaf2CUojsAsCLIROeOiirBpKA8U4Vh4TGBQ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ENrXs6FjENc410gjEKwoY1B5hzi6Jh+jdBRwmZ7GUTOqwOr6Rnxef6bztgbPlkNCKLwd+XxLRsBF3TZzrAkULB+OeG8uqHMSZ00xliS/UPAsELo7tyy0/ko1LAWkKPAwDgXGkLPvZ5L9ckU2xFrdNXxNeXvTUT78RbubnaClQ9B945AskwDrMtBD698 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92ca2faf-43a3-432b-603a-08dcc285010a X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB5275.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 08:32:48.4700 (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: XOMAQG/0p2K4ITFdJ9kG76Q5fgdC5EA2TIPRBlCL7veIWcBVCWxUiyIZDfYhFfXhlSVhSaoAhMx9ZdhFux/CGg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6259 Use devm_clk_get_enabled() and devm_clk_get_optional_enabled() to simplify code. Signed-off-by: Yangtao Li Reviewed-by: Maxime Chevallier --- .../ethernet/stmicro/stmmac/stmmac_platform.c | 34 +++++-------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index ad868e8d195d..9aba6318ee77 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); } @@ -615,21 +613,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 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 +637,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 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 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 Thu Aug 22 08:47:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13772970 X-Patchwork-Delegate: geert@linux-m68k.org Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11010023.outbound.protection.outlook.com [52.101.128.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E14717DFE6; Thu, 22 Aug 2024 08:32:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.128.23 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315577; cv=fail; b=Ctg0uHbSlSjuM5ztXyixIobBL1542yy7QQW8uHd85U5zW35cL5VfxX6CADoY9xoKW3lsyJxRzvq29QLTBo+pVBoqULklEWpxUdQuojOyKY3+FDQu1qkb3j4BJlmAs5IpUVlkGyTLbUbikLVOiD1jQyNx8V92WBR4AmwcvNDBxjA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315577; c=relaxed/simple; bh=bSCOSjEz/rydInwi6wkL0kzgSk7IzS6wZ9TVTel0GMQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=a/Dr0Du24R0bA64TCLYZwdt2Yq/rRhKRTmrKLg/sSxpMN94h6mjmLbUi00qE+yu0YgVbzYRZ/MVLk6fqyDgp8aoWT0Tc1hSolwZAQkRGZKJSM2qznJgQfjwblcaF9/u5eeozR1IvQulew8sty3rh7ei7KW/zDo6xdIdbaEv7bEU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=q3mFEKxd; arc=fail smtp.client-ip=52.101.128.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="q3mFEKxd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yd1NuKQWdm/nNRA60r3ZZ70Nj5Cd8ENshaL1CwJIGSSwXsKeN8lvx4SclXajw0410pMSJG+DqTNiyF7YUE8aq8rfXWQqOBo61eEV7i02sIncJjehlwp0evPHtMvXpWDahQAyq9Qe7Qw9fojHdvc9Dnwar8s4k1DduQWOumboPohYnxCUBrWwbZBP2dd0VS4dUQkaJHapSRz9gYzGkeShmyIA2UyGVLuE8zla6v3GWXOMQQEiWc4utnOf/C0U7xfFOfMom0J4SQ9S9BqPUSf2UfeU4aKx0VrpxNkSs5K8VbLiBL7He6H58sqzb9EGblEDmA5/8wmlSVhKdg352ulfNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8d+6h7KOTyM+MD+Oybw2j6gPuao0KsZVAKxbqYJhA4c=; b=GzTGNUCihvDjPb8l/Hg7pWDPzhCtyF9FnNhHzYu/e5h5Ds92ToWqFAj+2Cexhlh0dhC4sJNUxba1LAqz0lu9SzFkckJR4KnJSDUuINMGQ46bYurHzKdXtRLf4C3uD0Kc7dcty59K4m7cZSA5/aDbErPwU5Vv5tc4QbzhlFKyKsDtu4a61KMN3BIK/d89aBXcnkeJxjEVYh5LKJ0ctY+9mcLNGcb+8YhtaRrjbAL1IIpPKNNoYjoAPlK3qPyWXsQNREbuHpQxcmu+WUUp/xY77giUt3zBaAxxWOAMwBPmmuphlYJKeDOq/jLIqHsyR9EzPmQvuRbwoWgTAQxIDtMksA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8d+6h7KOTyM+MD+Oybw2j6gPuao0KsZVAKxbqYJhA4c=; b=q3mFEKxdImf/6eYeZWUjbKwYpq9ezPOqM1hybTalNObyg0kD24pRH5yS0KE+9d/Ub3HdcapN8k1PXOO5/gmedFM9qwTSghEtTmAhfOev8SORgxk/3ta2Sw/jGfJQGTm4bOP3z+LghZDikzcsHHW0ipa7TDisYFmaie01TMZXcGs2EEvMKAua9IG+nIhfC0ux3wQvpMnJR2JvZ3czvepa7iqAQ1Huyo+/w7Q8muyeBbEazGaKta53vOHXiWu8zuTt1vR3SEoh81mP9LNvLZ8aWbN4l+uP//8XDeCK/oWg9C0pIcccYSGAXPBymSG6eY5d04zKjczfbUb7ROXsQwNWMw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) by KL1PR06MB6259.apcprd06.prod.outlook.com (2603:1096:820:d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.25; Thu, 22 Aug 2024 08:32:53 +0000 Received: from TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1]) by TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1%3]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 08:32:53 +0000 From: Yangtao Li To: clement.leger@bootlin.com, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ulli.kroll@googlemail.com, linus.walleij@linaro.org, marcin.s.wojtas@gmail.com, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com, hkallweit1@gmail.com, justinstitt@google.com, kees@kernel.org, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, horms@kernel.org, shannon.nelson@amd.com Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Yangtao Li Subject: [net-next 3/9] net: ethernet: cortina: Convert to devm_clk_get_enabled() Date: Thu, 22 Aug 2024 02:47:27 -0600 Message-Id: <20240822084733.1599295-4-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822084733.1599295-1-frank.li@vivo.com> References: <20240822084733.1599295-1-frank.li@vivo.com> X-ClientProxiedBy: SGXP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::17) To TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5275:EE_|KL1PR06MB6259:EE_ X-MS-Office365-Filtering-Correlation-Id: 2fa632f3-455b-4003-6672-08dcc28503c0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|366016|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: 49wg3UAqXAdcjgyGqiM5CvanMqpsgoy1Aj3Dfet7QzAFp+EvFixOtFB7LSt2fsHNG7Fn/zNsKao/KSoMM2WKn77c6sR/86JObyvZrWfvqZRog3m/ZO1Vzg9qiWFeBblwtK+4iXZ1d53t1nHvWYB/p6iuRxPymcOhlq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j3EOW3kfJv5jd9BTM/KWk7mZHe2Jnqf4/5Maz5rnZ7HcGc4PpAAP2hXcDgv2z/P0qkwK3hwTAMgs+2mtenEFfCBBAqvB21cD+zrdO9vkTa6pTHwzwBRuIc9PAsa3VyFKFNvcLLYQ50PopNCPu/3nS3KHy4SnAx4t9B9IVow4wEMfH7zRjsIsWBF/hg/xl/dcL6NaVPnlxooixHYyzP7KY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB5275.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(366016)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bJ/FHPcCHc+qeGCrGfJYpa4uIKcwQdEQitF+MWUuMJEVq95jboLLYIevUmGSFlVwcBTgl86dzOeoK9ut9KgulalPUyh+5O0AYP/7Q7zvoBu05PlaMA1O6OFTCZb7Qa2LgE8Un5SF4HGt3jXm0O9qmoXGTKg0NNxAffXDOmmpA7+SfLlnjilxOyUmBWydUAgndcnRzpAsAQ5GFeOwgLQiI5Q6stZkKj04MLVXLHdb+51Djz1AoELAS122kS0UR9P68XmhB4Rhe/irNJEqiWd1fYLkK8joA55xKJ1sNDh01bLd4aePyH6hefsY0VSg7iXG3njgEOxyEu6Z0aQC5IUvYLHLL+KvREW3GstorX40p4Go/8kHAQJmjr0ONQZN0GdeiyEf69kc2s8GhdSKWiLOinFguFHti9M0QK1RNAYJYwMKDPp5VV3mkWp/hBd2F+S3cIA4/rPoJPvQ3tFUmvgDt3076mOhAy6Hvb7O7wPs9OgNAZte1aHy1SDxvrQaVeo6Q+EyFToSH1zTHQpoOgGcnA/W6AXvrm24jFSVvMuK7biCB5aSbmOYv9B+7h/X9hCSnCmZLlIxjDM9btKy1jmhFpkBP/Kcioecfvp60GKpDXGNkZrF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ant-AuthSource: TYZPR06MB5275.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 08:32:53.0329 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: k2tmFtKJKIbkTWWWb/FiwAKHYtuz58CO9GlqU/AHyQ18X5oYw+U0bY/2Xuf23Y0SeSAvaGwvHdkpiH1LXsT5Cg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6259 Convert devm_clk_get(), clk_prepare_enable() to a single call to devm_clk_get_enabled(), as this is exactly what this function does. Signed-off-by: Yangtao Li Reviewed-by: Maxime Chevallier Reviewed-by: Linus Walleij --- drivers/net/ethernet/cortina/gemini.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 73e1c71c5092..90a14e03a782 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -109,7 +109,6 @@ struct gemini_ethernet_port { struct device *dev; void __iomem *dma_base; void __iomem *gmac_base; - struct clk *pclk; struct reset_control *reset; int irq; __le32 mac_addr[3]; @@ -2326,7 +2325,6 @@ static void gemini_port_remove(struct gemini_ethernet_port *port) phy_disconnect(port->netdev->phydev); unregister_netdev(port->netdev); } - clk_disable_unprepare(port->pclk); geth_cleanup_freeq(port->geth); } @@ -2403,6 +2401,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) struct device *parent; u8 mac[ETH_ALEN]; unsigned int id; + struct clk *pclk; int irq; int ret; @@ -2453,14 +2452,11 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) port->irq = irq; /* Clock the port */ - port->pclk = devm_clk_get(dev, "PCLK"); - if (IS_ERR(port->pclk)) { + pclk = devm_clk_get_enabled(dev, "PCLK"); + if (IS_ERR(pclk)) { dev_err(dev, "no PCLK\n"); - return PTR_ERR(port->pclk); + return PTR_ERR(pclk); } - ret = clk_prepare_enable(port->pclk); - if (ret) - return ret; /* Maybe there is a nice ethernet address we should use */ gemini_port_save_mac_addr(port); @@ -2469,8 +2465,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) port->reset = devm_reset_control_get_exclusive(dev, NULL); if (IS_ERR(port->reset)) { dev_err(dev, "no reset\n"); - ret = PTR_ERR(port->reset); - goto unprepare; + return PTR_ERR(port->reset); } reset_control_reset(port->reset); usleep_range(100, 500); @@ -2532,24 +2527,20 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) port_names[port->id], port); if (ret) - goto unprepare; + return ret; ret = gmac_setup_phy(netdev); if (ret) { netdev_err(netdev, "PHY init failed\n"); - goto unprepare; + return ret; } ret = register_netdev(netdev); if (ret) - goto unprepare; + return ret; return 0; - -unprepare: - clk_disable_unprepare(port->pclk); - return ret; } static void gemini_ethernet_port_remove(struct platform_device *pdev) From patchwork Thu Aug 22 08:47:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13772971 X-Patchwork-Delegate: geert@linux-m68k.org Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11010062.outbound.protection.outlook.com [52.101.128.62]) (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 8D58A17DFEF; Thu, 22 Aug 2024 08:33:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.128.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315582; cv=fail; b=mS/9YeKtqWCKzx52Tz5MQVLNxdp7yfdnj+VZFGl7x17VHeyuugGkQb0EOlQiSNl+cout/l1jmhlyPRfViaK2dQnOZ02Xd+50RhGhRqz2NCCoQnKkE2b5p9QPqnJxZfa8AituBS018v/0gcrlCWmeqrPce7sY8pbriSwiwIIe17M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315582; c=relaxed/simple; bh=N/tUcxjy1xJBFZ5NzpV/baThbpne8L5gs9MZqUQ50go=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tvCqojtP2woqbFW7weP3LcJxlj/Z1OZKv3BIjFXQF19vi5rXHCPI2ASJPXTIktPGt+O2Low1jM3HkIoaM31GrhJJjMdcPmcV2Ko773YpjUdUgr3DmJSmUk5YbCHJnel7mWuDoDOz3bfNaPPUieyPOOwQ+dUbCprGej4g/A80Lp8= 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=jpVePH4o; arc=fail smtp.client-ip=52.101.128.62 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="jpVePH4o" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wsq4N61iPF8ysh/XZmvoYlMc+rQsnKgHNl/Vy+ZwNzDp+UC57wAkSyy6yaEvUc3IvqIvTLS9UFsYkgVDT3TzoM8JZEDlT17iwmu1rCSZkSkWMQlf1Aoiur9caWMjdyx38DyPhyin8jx8SGmCJuLpbHM8MgRvyYx/KPiD0j8s0V5+29Z5DlhlZGlKbr4iGqiD6uDenF3pdmF3fENS3C6NdEtF6KxtV9mtIc90u6kb7huYD4AI93Y/rYog11iV2IMd5t2uS4A6e8ddeweBxRODVwTYchXHbDmVfM9WZjSedoycqfq+wxXS9NyQ9OsYF0GEXnXstPuXFK7mlf0LPtvgBg== 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=akFwcMhVH2aQQYc+Otnat3FntSmJ8kc14st/2LQCZUE21RZT2OWtDs75wWIERVTSq/4fh6MX54D/FGEWbiaLjyFdaOigMIM6jhNPWVRbUPFuz89h3veK7Su43LZaiFAiueEUgnv2sXNJz/CIOZTAk3qHUec61sYqnXifG5V2X0vmNXaOAmvQLcJ/p3UP/0O3y+RYjL7Fsbm8Qj2XhnwfdP85Dcng/3d5bRNAtkONNolhBVzbJd6GGLNapTB5LWKckfIO02yBwr18CbHxmRLaW2zagTOcPr/S91KyivvTOrs0jt6oKBcosrmMDxIZMmX6qOi8U+9qeCeNUGWpbLsLLg== 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=jpVePH4oYV/e0ucbMNSKUwPZuOshhn7EmssIVeMB/Kgn6HU8wOUOAq2p5MRE4viaL8vZqlXXKLggATpQgLxKR9Sw+1tqOU16qA9Qi5TMJXD1wpqD9vExmAf6laLCtubFXj0JsJMKGD5wiIQl/q4ho7yXJlaJ9xBmG8O/cPs5M/r4+WtaMChty3t3bFK7qE3tQoxeAnrsPYaB6WSAQb+bSdUlcpUairZ9JpYZPaHfbQUn/nR3e8mbrRTFU6lhBxPmJlGSNl8EnllN5RABfWYxwS+ZT3SwnS2+WcaZn2kULwf2EeNBRB/mdgVO1OgcbZqrodBAMCwU20ywMTJYn7+w+g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) by KL1PR06MB6259.apcprd06.prod.outlook.com (2603:1096:820:d9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.25; Thu, 22 Aug 2024 08:32:57 +0000 Received: from TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1]) by TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1%3]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 08:32: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, justinstitt@google.com, kees@kernel.org, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, horms@kernel.org, shannon.nelson@amd.com Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Yangtao Li Subject: [net-next 4/9] net: mdio: hisi-femac: Convert to devm_clk_get_enabled() Date: Thu, 22 Aug 2024 02:47:28 -0600 Message-Id: <20240822084733.1599295-5-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822084733.1599295-1-frank.li@vivo.com> References: <20240822084733.1599295-1-frank.li@vivo.com> X-ClientProxiedBy: SGXP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::17) To TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5275:EE_|KL1PR06MB6259:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e7000f9-eb8c-4b8c-90cc-08dcc2850673 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|52116014|366016|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: d8NvzooUORwCHl5sxVspFI7cIJMQ4+FipsVF/OFCjTO1Jqt3j5HmTGda6jNBXHhZde4kVlV220HMuaLr+aKJfxVnMSEDeo63IwsAuXIb4DVFmpUbiI7L0FkHu+XiSkTlIN51q2rUZUzCa5m37KK6FwidM0JJbcOZcBY/y4pnfksTjWs4VYK8m7L9MFU9OVy7Yc0uZDR48hieYphE/EMPMFGNWo9ik4REMBJarvMzAKTBgchCZ6kyzNqNmRyYRCEWF7dFCZmiT5tIH7mB+GPI+BNX7YJtzlf6aKafa7ooDUfElZbB3WLWA0GGGl/L24sNk5xannuS8XqzhUfIXNcmpHQvBpnFun5vQxx/CftCEO3qsrRxCHFEWTHqtS34TbTPuN5Dlbo4F7Uv0dk5m0yYpI+RVAoGMs90sgAcos1HzpwNFOxYyPNopDvhbZqtxrrdpSelh9KwvZVKeq8cdKNZ+nU0W3m3vYJO05ZKx7E+EmCtfReH2CqclXTIZLt9AhuOhq+ICpUkXt0E7l/AaGWS2d647ay6or0+TUXqqWFFsi5WqKSaUKd8n27aED+PRdP5FSXFxjqhzhyYVrVDSTvTXivtU8kyxkMWypbuMnLYzx43HSpcZA5yR+XRN2JUVCW1cFk8f3OCDRityLAySux0lCLp6dUd3wKyWIfbRBH/t2X+SthdkdX86xGK+gAV5K+PwEzJxGNgBKXgD2r3KsDPTuaLbRqqPjyfx0EuhjG72FiaDVxsd7rYG0mffcU3TznXurOBe1+5q9lL0XcWEvzslSt0WDngZiV2VssJ07rYf6zvd1LrCa8ROFNGbu+hHgrgfUX7QFoq4b3rSuNeGfuNQC13QIYEqedc2dBFA413l0MUG3evgSoRCOnr0hpD1SpW6Pq4GQdlE7x3TyevCGkClRJ1J1/MfnoCqUGc8xUClp0U9oYg4y9RlcgcK97tGC1OFrh2yEpDMxw12j2o0Kr1vfNXz8cQeQ3xnmpwV1f5E2IuWKg8bnR0pfl0cB7LCs54vCLhSkdgxPWTzHBuBb4rbK/NmCGqVvlDu4e4k42EjHoeLYHvkpy2xUk/qaBLluTL3EQEMS59qg9OocSxTmXzaUXQWd9Mp65pVmiwM4xSkovOYDt1cN+d2ULi0XD/rPOpnz6sVBl/Wq/yjesHiOOz/nNFZY98TpC7oSeyZ41DkPA19Z6hEUhJeR5lBjL1rSuMIZ/0UGy526VSd9/1dzzsYOCrxAO4w0PhqNEgWy3cauVL5k+3jW4zdGeaui1zXAzXYebI4/SbJGHJgU5nTv2KisHwNecTZ5/JO1OQ/oJn/vREaMfB8ebA2DycDcXSAUDU1/REC656Z+sE4vK7dlHcuPZeTbj1RcFAllhfF2sQRjcsyUkIOZ1wJYI/h+y/Hi59uVNSwU1F0ujqRfIupU5iYz8v2RegAd0+BpH8eTpxXyE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB5275.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(52116014)(366016)(1800799024)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-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Jc8oP8IXymOD61CiC33O7810X8UzFfmvO83902DgEelrzY5RV+LcvwTsZ7NXiccoDwxhG19lkqSP20jCUkR8zuAz1lDNeIrbLwdC7xzemBuEIsBaweVkDZqF0iTkycftqnf23xcjR5okDZs7CTr/90LHbZNH+IO2Y7W1EQeZh5jgVR80Zhht/CzalfjvXomajuwo4WFlP1u8vbOI1EEVPXIrShFrJhB4m6dBrjoalWELNG0SBTdnRj0r7G3hD/eEbDakVsSNeBOqVqtirWe6POUne8viEEx6EboPDlbMF0FrPpFff/BkYfUC1ljqQy9nL/n1GA0JYcfPZk8ZFdTUuvTXKrqhYkACnyDNgnzfIrbbnGt9CwLjUCJYTQtI5AORMfWbOmzwSolgFLKXi+o4PH0tuKDFhQ8cuWwJ+C4XTFUIcKDWMEV8r3n928lXmxrqyyGplb/CU/j2XEtLQA+c8+0Zo2jv39u4XyizIN36+v2h+KmbTvadvKQ/8sH7Y/LfyqFcFXlnnkKz9sgYKVvmWjaQRhKlQFMaoZNiiIl X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6e7000f9-eb8c-4b8c-90cc-08dcc2850673 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB5275.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 08:32:57.5808 (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: PnHfWdDawmZwymNBbbH2iMvYuMjFFRoY0wFk+b6R8Uv3wddNvZqz1tggdWw5YGRtSYAREop7UEfA5XkPuzuexA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6259 Convert devm_clk_get(), clk_prepare_enable() to a single call to devm_clk_get_enabled(), as this is exactly what this function does. Signed-off-by: Yangtao Li --- 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 Thu Aug 22 08:47:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13772972 X-Patchwork-Delegate: geert@linux-m68k.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2043.outbound.protection.outlook.com [40.107.215.43]) (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 F316E178398; Thu, 22 Aug 2024 08:33:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315587; cv=fail; b=QbSZFFvwxBJGke//rb9dmuQSsu3pUDSvzSSm4H6cWPirBwN74PoEJVyRGacF+j5n5mj4ySfUoJzrwnT3OXQeUSLGs6Ag/2unW8y7pZ+RkdpDanVrKmb8WvrYKjAkDHEphjAE0E9fQtsmQiwKf1zwC7Vcduu4t9z0F9pLLvAyusk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315587; c=relaxed/simple; bh=Y+fmIwBxvWxyVZfdxqKdvMSpZL8fqWlU3Zglug5ZJws=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=gBBqrOoh0x2m8HRvdEXU6Xvc/zql/Vq57ptPmVb0fKYiVQaDpf9bwTmjO1ozUBRXfP9ypSxy7PHOcekzcqgNheu/T9Pn3GC9mH1WJ8y4oWK8erdBbnXG/2hOaoLRyUQSQUiXzY1VAW8VWtavzF80fVBUqT0/wdQCXaKLyTPhuCA= 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=SKE6eWgx; arc=fail smtp.client-ip=40.107.215.43 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="SKE6eWgx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vkZJbXSvtj43hO6sTOsnpVPef303BQyqumIDhMCmCFTEBW649ezAkvPYo4/dlIUm/6ImQNawsMbMzcAb25zNINV0cKaXi6jPzSmHa9B0rVz5qW2mNCsEjwP+4h89XH54rgAE0gfOypaiy77y3Pzmawtpy/MOwMHW9G4C/ACcQNnHt3koIxjWQi0GMzOBIPBYcuMAOxF8NnSC+FhpBMniPSxPUgVbiL4E7pBEjSIXW8Jl7rPQop9EMXRFU+ZhoC4mPORIF69bX8cl83W8vE+GgpUCfgARWHvE7TLY+84i9vFhem/5pA0gRtwdrBTS2PGfg1V4VNyTkDoHLoGxdJnimQ== 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=IV2FQLxBIlIKY82+sdONMksze4zR/KZIns5j/nBBsRUNkRPK9A2rps18uy7iHJFPR7exvJvzcg1A34cviSxwU/3k3TmVVeD3sloTUOvp6bFqiMPv3oRm9ul4pBwtcJ7l2WLhc4SC1/Y7nH+G2uI+6eRSM0lnUo+IhWN1tmlUiFTr6UGuQBB5oAHyoSlUqxIcguNWJxXboFeCvFIYDq6f0quICrNiLHyxmoy6G3RvtQ5l1eRtROJ7oD1OauXAkhaEJcVXlULdnoWx5qjw+fMcMh7EDYxWbEy+ROW5nKWDxaFGjY6ZmHqmTap8uOsbBoVkpYwLvssND6etNErIB6uVdA== 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=SKE6eWgxj0/yHpDFPscnId+SUvpKXHYnzQleSB448s37019oiDdENrdLPyLlnnjNUoNStIOoCJOgSaNAKF3XCIHFRoblYFS7aThn/fY7Q6Ef1ud7u3NQ5mlsGYRxTqoMrgBr6edxjOUEf2QzPpb7EclO+MA5apArvfKc1aOyFszNj3nawnIrANkARJRkuDg45B7LCZiuDsRKgfHjN/TdPbmBO/KSLMW1zCJGcjdYDY8U78AtZYXKjeI8x2spYuXttpFeq5H4WUjDcCpauoFyzyIkD3e/jN57ofXmU8d2CUsPjBLB69ihed86PnLjMcLb+UphL0veMGIl72xKnCY/Dw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) by TYZPR06MB6114.apcprd06.prod.outlook.com (2603:1096:400:33f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Thu, 22 Aug 2024 08:33:02 +0000 Received: from TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1]) by TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1%3]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 08:33: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, justinstitt@google.com, kees@kernel.org, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, horms@kernel.org, shannon.nelson@amd.com Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Yangtao Li Subject: [net-next 5/9] net: dsa: rzn1_a5psw: Convert to devm_clk_get_enabled() Date: Thu, 22 Aug 2024 02:47:29 -0600 Message-Id: <20240822084733.1599295-6-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822084733.1599295-1-frank.li@vivo.com> References: <20240822084733.1599295-1-frank.li@vivo.com> X-ClientProxiedBy: SGXP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::17) To TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5275:EE_|TYZPR06MB6114:EE_ X-MS-Office365-Filtering-Correlation-Id: 8dccaf44-869a-4d6b-f30c-08dcc285092a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|7416014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: QCEM71hRPydy4/SdvSfjOx59gvJMThQ3VqBad/QU/i0zZqCeBuyzqqPnIrk7dfWCo53aoppoC12TRaWLYo/dCwyg43PTRoIqi4ZkbdaR49Bl0Cned9iwzl5yRCE8CnLQG53N7PlHOwZgJhTYfKcsCn3/sGcrI/4uvcoGoogl0lwnbjU6uoMXtzdQ475WQN1yHhKZMk1ks3nFktdqwT6xK0wblRG5zCI62VXqOkl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vaOaN+rXKztSKLpimyKndOSadkkY0eJihQWJu2nkYzGtXz0yWFWSG4HGa1ab1zTurthhKidbEGIULA2ufFFYCoWyoUVkJX739Msp/ZNQGJqMoOpdO0/CrqpEw6ZpjQ/zy0TcCJqZtQyh6L0QJagQbI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB5275.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(7416014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7PFKZ3wbnFow+Spj7hc+880vDZh9oyRarni4jY1fLFbtgGaCFWSy7n4TCnlgxBS+Qum72x8Zl1rqTXIjbCQBj2IK5LqUA2tObMoj6BD0WBTurLtOxdQ2OnyPXZqlu87CsK6V+OH0OCsz20FasH1fwKN83UGGz5cLoI/wCEm4khKtbIDUvyw4cBi57En/8zKKu7QKf8gVs3uDGA8G9+vYL0RLMSrj4b91VmfSfQN2u68i+gGe6dVldw3jkoUvx4kBhJkFwkqnTJaSjMat/77QkvZ2rfiqfyTCJNuWyYzNZuNYJGRtlTejbwDLI8wlnwkVBN0LxEUEEElNJWN7q6HpHbs+g4LTMTyqBvep8SuvBBs+8BevaT+rynp2mbwlx40X8Ykx4WjLQL4H6mXRCQ6R01Cbjgyzw3ah3QW30QkGdVLBJ/xTFGgBZwOxoFx1rUMADIddc0PQIwl8cJ0sVA/nPYa20jdZ++ubG8ynne4mgysa7R04ERw3J7OXF+dQMrmRm+W2EuDDiWKlD/8Dkz8FjWpgJJeKsBe/BW6RiwKXfM1hfwtpxf+TogIaCZKcN1cw2LdcvEPkVR0yFV4fFbnXH2o8+bEfpmc40Alm5flpheoBQI+V0Ke1yhqS9Z08WtcmbQHBRG5BRiJizu/r1pJTwVdm7urpPH11YMr9gRrEGPvsCVsxxNZFeYDKFyQWlxHGd/p4pUYF4l+80Rt6+9nQRZocKKdKjGt0Q5s094VhbQsaXOhu9cKvyq3mRaXGKD+i7yEulBnDw7s65z8t/O23a9ySWQgbhFwd5R08dGQ2aKoECt1x9bwVZeNraJ6KYSfLiJ3oehc3I2gUXHFBdavbQcE7hwsunrstPbS33DtlkrXKBa4Pa1MDadjvqsQ55yQHrVT70dAgjHnaQ/MrazPmUBg89SjR18g3ltaAiW5hwaDDJg6w1BfxL7j+m/1jaKdQy+Wp4RiIbvTREVuUH7DJQaIq3v2eWXCCcHM7ODZT0Cb/mhyYYxF0P8LicR3eOK/FalI35zFksUKa2rfnXYXvNHwmqWMSS5lLm2pLFGukgCUzSWJ+41r9GbjSzufNneodPeMC9hyjr38PAK7riZzYW1DWSgHYVVCKm3/7symdd47GYKZ89WZ3jsp5YbfSQNutCf66OmtG8oGTmr/PG2YTbJthiLdapZ3OwPobt20gHN2TMqEUCIL05bgzx7mKSgsJEpWKDJzerZXzfXhgvtcEzSYtGS3aTwhMoeYhsezM0XcerjGyMKBL1ipT0ZzvoxnvafDqt9kaOoEO8CaOj1PE8nzgB8dUP7DVmai59dkEqeL6RguNqrmcYpsWreUUgmqK9uciDpVkjzVpibkF629JhlA1v2YWOyeXIS59UI+WxeuJe0s7Ta72nc2fRNPNshP/yCrk+bYR2DOvi2hSOHOC1PrlTtIGlVB98q64zy+Z+Xefw5F30k1Rs0lxD6aOClhqj7yBR12DF6cnBcGeoQhw+AHYJWU8LBaFmD1JOwigevGE8dObUvMSa9LN6GWgDJo60pX5WH7LLqzWr6Dby/eqPGv8s04xMdc1w37Fx9joNTreZEGcwgMKe8bCyXUW1F/K X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8dccaf44-869a-4d6b-f30c-08dcc285092a X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB5275.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 08:33:02.1218 (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: mQLUi3ISXdrfwqgJ+nSN3jjLQbLFvtYs4pE6lpSNxM7YhMVSYWnuWzQiAgergJlOXIYTJvbOvQnMWcmu8daKsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6114 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 Thu Aug 22 08:47:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13772973 X-Patchwork-Delegate: geert@linux-m68k.org Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2059.outbound.protection.outlook.com [40.107.255.59]) (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 7BA95181B87; Thu, 22 Aug 2024 08:33:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315592; cv=fail; b=toTKOdVqffnbOLDnCzQr+nJKhL6DS766UvUkbtNPaJS73gUIXAcW5vaCEy5PxBArd4HULNheGkgUu6WZdgJGRw9l5JIeFZFYY0ALDcqu8TfFDpIgC4a2wqHtZoylW34ZOYNWY4CrWPiAF57HpTyF04XsL8ogJ4s3xLwsdZmVgzg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315592; c=relaxed/simple; bh=8uiaS0FJhM1300wHqyaKvmI/6JCTX9NfFWu2KnGs9ew=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=qUEU3X3/32htxWXqaBT2HsZYW7hwP05s8KhzEgBHvDff18DixzBDkRfSeEZXf+eHlOngF3gHP85vT7w2dlMOB+weS8Rf9hS/xiluSj8lbQx7aiOIcwRJH43qk3pobxxSp0majEdNanC0/xOsW8/oFjRNxqec8BUnBfEGsC/riI0= 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=Cd/RWGS8; arc=fail smtp.client-ip=40.107.255.59 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="Cd/RWGS8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wpXH6mWv62WLbT/npQrFKUTVq5YRwlailJ+AzzSXLa/GnQAayYxrnm2HToQYV5fx3o8PwJNjXN43dT5VhzB8yZQntUV5H8EonVJ3q4tqcqibcCDPbpAutIuUt9lEqT/5VxnLUW/BG+AQW+MxQxIA4zxkNrWBAt4tmrWy+smdFScnIhaxjZfB67m6EU+BRcrbe+ZfNIacHUN39uIegD8rR18p4LzMz8Amt99WEhkVGPLpyDaqyzf/eDaAobPmC9Hns+HXoY17N7uIJOSSonIOGjFwQizNGrAA6gxXlxBfAFlF0QR7KsY1mAkgubXNtGbkKhocRdfqoF8xy6vXxg73aA== 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=ZeCjy4C1B1HA2Im/+qO6eDK6IQLMrrHdYLRnyNshFKEPduhiNfmDh8X1w9vljWvnGnT0spNNRsGVtpIuCRPboDO+IyoOvMGeWNl2xMvewlRyeE9JExInEyrW8kOi7UyYoovCFcUdYN5PQ4TQgd3mI8BlAQ7oSavUkP8HaYb/y1bS3snCSypvFLAG/RmbjErMl2aiuwcacfqi8AxiPj++xDhnnHAACb+aJQxe6tQ19xgyNSA9e1E9fSZYgjdKYoAQm7Xbmp8gAeFKAdi1EimcG3zoN71mPcrG9YGKC3k0SPqMwNjCXK93ZT7i1PDJ+0E+xMTYY9zlQaJuwhUSeNY/vw== 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=Cd/RWGS8cY0XxNP2/duxFR3H2F23ilafDCilM7ofrkCSbTk5XKwNYz8PqDn5P2sHVyrzsLa1Iu/PeSWiTSFkfCwsnHw+6OzbdbADb1Qcm2qcxGLbDeSqhlm7KckCBfRI8O8jDXmMGhW+BWZdjE7COtDyXP5oZ0TfUxqW8j3m1gJSmEZvvubNZqwNbkTpQCjkJBPNll7kkDJqD0YYe8cok6Hr+2VhBfbRTJIzfDe46orj5ccL14IgWeWvPmy4XEa80AO4sA12Lw+JvZwa/Us12CCoQOUMRoEAcy7ZXg3DOfITZL2SIqEF1ujAvHDou7C6R/kk1Oz4SJ7mxtvsoUKwYw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) by TYZPR06MB6114.apcprd06.prod.outlook.com (2603:1096:400:33f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Thu, 22 Aug 2024 08:33:07 +0000 Received: from TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1]) by TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1%3]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 08:33:07 +0000 From: Yangtao Li To: clement.leger@bootlin.com, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ulli.kroll@googlemail.com, linus.walleij@linaro.org, marcin.s.wojtas@gmail.com, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com, hkallweit1@gmail.com, justinstitt@google.com, kees@kernel.org, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, horms@kernel.org, shannon.nelson@amd.com Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Yangtao Li Subject: [net-next 6/9] net: ethernet: broadcom: bcm63xx_enet: Convert to devm_clk_get_enabled() Date: Thu, 22 Aug 2024 02:47:30 -0600 Message-Id: <20240822084733.1599295-7-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822084733.1599295-1-frank.li@vivo.com> References: <20240822084733.1599295-1-frank.li@vivo.com> X-ClientProxiedBy: SGXP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::17) To TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5275:EE_|TYZPR06MB6114:EE_ X-MS-Office365-Filtering-Correlation-Id: eaf995f6-4c7a-444b-1ff4-08dcc2850c0d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|7416014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: ALqOZekPdtBqEgxTAdwfqtahYp635IieR0+tU0h0oQPXmfOvfzDY9OQjVA1hzm3iNWoFWPdRDuTX14U+IuiK50P6gKFtgwWt+8z54lmM6u6xwCIU+ONoEgnjKySC7v/vdyC1FVnZFu6kOdbR1sFLVhe9E4oUI/pv7eU8QtSMNgD/lVIKLDO+sNHURtA1whcf8vAzrZ4+nm0gjXv2d50c2l60nZ2bFnSLCTdlLlV9rDk5rawl5MeJZt/POD4iIaKDoXWJ+rg5MuU/4RQWGyaiqsdlOeUdKhBTaO2dGfTxoJPxc4+wMhuJ3O+k6QR6uy47+nLjIIPVkEJjezefGScTT6R8YrpyB6+r6vnoQJObEfT3bi13t6378Bh9vCPS3IJfiffC15BLXOGVg18PTQqdElZsfU5POfWaOy8NPsgVKEDmgcO85+HIKehIJ8OV5fQTRiiQhQtHw2Ec/rg0cMNpwnMDsZJC9dy0dB3TdZxIKUzLoYjfh6uzEKHOe2UpLqvmymdqS6SlT7/Z+Ws2D5DdsburIvxP1hzFiLh1E365yt9BOGlqOPQSlu46Ph8NOKI+5EZfp2k5C7Wg12IAfKmLDxQrlA42NH1b8DcZ4Oubgjpk45iYPHl1wPPaEQgfq29bfctdmpNBkq6hrZkp6Q1ezOaRAKmrO4ChyPv5VjdsqK//bzKWGWhHfVdLl+aOY/fiIR8uTiDI+5Qdi6t2fHZk1KUJTievS/Kidz4rrsrUeMiToVxaEGSFXatefTi3iZFlxjLScKJICFoape1n72RCqKWnndeKUDWp7qEgkd8k9qBweOmBPPvLAf0xyVkMmQse/i5azj/WkGW1oX9f0N7K0Q7L1hrrE3IsUAAolsQ2u/6Odvn94N/Q28tX5h+IUAV9xRtesZMgtMoJpzwm00lGFABAfVTzHrRr1BRgc3/SG67Hvv109XZ48+0DYv4WPtjkNqNIn2FwRKjCliMhnzFDy90Wngchs+E6nsoOvfZ/amKbyugRni5Qi8hDHsyriHYdS0eotpvYOY0jrsfSEOxrKPE/fSMAIzYZwLEwPODLW5UBbByNm9ORTwE0xQXbvnULSZL4dLp1ZOLoKF3TpG/pPBlMrv7D8rnyx84lY/acLxl8DbKbE47rI8i5M+HdWUSD5uqfuz6p1hotoOoUWNEZ3CEjPMzIWhN/SbH875ygdIsa/JyofP8WkcwfwWs6htZFig0VFKooGi2DMzzsBogd1TEPbbgrgSUvJU7l09QCKUh2Et5qVDQywWZ61MXp0IPz4PfAy99xTJPg2In9UN1PJzFwREiR5wllVlGL+5RnnWRuy7RS4U019ZUjgrB0QUC6cGOXtZE8rFCeqZGnjuC/AzeGZ15ZHZl7C0agddZmxmDYTHefsStHfII14j6iVBIlD02kAMzPeAEja6cJk0X3uYbJ8MOlycbXLzc8jjAKANA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB5275.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(7416014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WpAABnvwkGtn2QTO957FE0J9B2h67hDQLWi5V5ob+ee9g0lbuHeLayELZpErKVDb8LlCMSnmbRFupVJakkBSNHbKw2vt+V8i1zKQuOw4mVqqZZRwASu2mRzIYYPaOhp0fsXdadNyCPG5RYRzWVI2aAVlOpW5RXm9FUgjqHkKoZRc/wcIjd3LDoxBS6Ktw02jcwIOO2uH2qFfteGCD4fEgz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0BA7RW8uDB/8B9RYS70qPxE6A4zETXchOXLUzNuKHWxRrSo4lEC2wZcm4Mq7Lo5IiqH5fJUqNoK0e8KLfZu5YQ1r3vPuuLqwbZVxNMS7s0eMqSLRepZkrBGfNsniNfVrIXaBzECneqVvaumSPbsBi9aCcwv+VKbdVwKzG/0B14pJmgk79cnSleSCe3U9mzp/IuHfd7Y4k1ZGW0oUOPA2Ti5zcN6Nr9GjSGqW+LppDgE970ZWjleUZh9T5ZovtCfZPQDn8O7bkvOND3oZPKCWdeXzua4PSLoJyeA32QJYhlST4 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: eaf995f6-4c7a-444b-1ff4-08dcc2850c0d X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB5275.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 08:33:07.0008 (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: 6JIF22XhVbfk+tw18CkDmwsDnSUKzijVtux+vNSExnWx1opnGCK+V5dUe8FDWbj5kGUSZ9TXMgu7KFqWftgvQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6114 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 Thu Aug 22 08:47:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13772974 X-Patchwork-Delegate: geert@linux-m68k.org Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2052.outbound.protection.outlook.com [40.107.255.52]) (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 57468183063; Thu, 22 Aug 2024 08:33:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315595; cv=fail; b=W8ln0+lmANIMOdgLmXcaEsD9yr50j9pPiVncAISnKR/zUMbnjJJjZjiKhGiZBW896scuAqQC689vfLgDEM9XCb/Y9KKLoNTLd/aBLSff8XjGjNQEeu/OtRsEAUpiw33Ud5XGCZfC8iuhpSqGwPMp4M//hwc/kcu9FVqazLh7b/4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315595; c=relaxed/simple; bh=tF1/6c4FptYOvpC1fkCyunctJZIDcAH+jRIQKAomZYM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=bbanEYqf4Od2Kk69Oozn5lRGuF+3LDte3IAJ1D2S27MgNlo4kEFaxCaloJcpN3jNmSnSB8tHKXQG13z3Bd9E/XYB8pTogpttolOKQHvZHUJmcyd/bj+3Uydnj4290uaZKPVqaDbSN19RpK7ZRtN1Kd6+vRDo7jrEloYa89ftqJA= 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=ad19l5VY; arc=fail smtp.client-ip=40.107.255.52 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="ad19l5VY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IwfXHeUoMOC2QM0wuKpa5Xi+YeO+3cwhFm9+Bu8KbJmZfD1qM7Fdqqfbd8CZbA5PuhfxesU0gLtHz8TPqHeQ4oaUir2+MyQ2NvAe0B3v8wrHC9jxL0eRjhZUa/69augQ7W+S/MAKv0XMPHCscI3lpDiIJavlpqvN2Z7A65CWO7MdjSmnftvvoJ5tKb/mxTFmbXIU0OgI1FnRtg5EmKzeURZ5mz0YAgkVnAdFxwyBsBwsuOvG6jHKjDz5prbnITBh8Tt1jIPYTMoBh75pFX9+9hKNx2ylANBeV3NIq1rnYuKPWgc83J6zdT04qk4I5lEy5WFeq8wNLsX/F7sH6uJKEg== 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=q9ml6wQXYKRzKGJokBroA8S/s5yQ9E2DwJPNAgpUwEA=; b=vfvVCHpF+cLz3PHw9AD463oMs864wSnIVuJQ5fk1Kdeu1EKWNFfdzA1NdhZcY7rij9EauZwheZ02zlwshh4vAaJ26ngaBYT7RmMzFGhpmC6tNSBkATsI4qTgnvPHzFlfQUazLVlKFOXpexMK9pJZSLheEFVfXgYBOABYQ0RmyJnfyLQXey5f7SKhlDPcVzUPOO19kKPn5ILbxGIbRqOg83d/RcPdQWB6jKvOwmUkzw0yV/QWwNcILFTuaIeHye23TUZpLNo6EUYNMPRYiMHkK9v+CnZbWao+NIoVNKbbxgo+d1yws+RthehQ16+irf/DlZ3oQYg5T70JhPaBIV89wA== 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=q9ml6wQXYKRzKGJokBroA8S/s5yQ9E2DwJPNAgpUwEA=; b=ad19l5VYd02IusaeG/GnNJc4QPdhUeVDf4qP6CA/Qkv3Hvfq7f8Zj5aNlJ0gIrevmXTLcTY2ze2Hw3w7o4Q5p7mp6D/hVnCvptqwOGYokse57w9vnrdvru8Fledtc+F4ycu0EmcIG6nTPUPQRcGFl0DdoNJ5u+FZv21SfXg1oqfUl1jMEbbZA+Ux7uNhPxDJI9FlbOXAB9REAvYfeslmXw7NeSZJJ+K1AwGpQuEmnb3mXxeZBye9mt0pNYK4CIinZxhr+C8Qo2TYgwqCr31TxUgI5bdm9XdQyDcpgaN0LQEVN137TsMrVhWuZWWdPmT248mH2xf0koPdtw6bhTjffQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) by TYZPR06MB6114.apcprd06.prod.outlook.com (2603:1096:400:33f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Thu, 22 Aug 2024 08:33:12 +0000 Received: from TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1]) by TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1%3]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 08:33:12 +0000 From: Yangtao Li To: clement.leger@bootlin.com, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ulli.kroll@googlemail.com, linus.walleij@linaro.org, marcin.s.wojtas@gmail.com, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com, hkallweit1@gmail.com, justinstitt@google.com, kees@kernel.org, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, horms@kernel.org, shannon.nelson@amd.com Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Yangtao Li Subject: [net-next 7/9] net: ethernet: marvell: mvneta: Convert to devm_clk_get_enabled() Date: Thu, 22 Aug 2024 02:47:31 -0600 Message-Id: <20240822084733.1599295-8-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822084733.1599295-1-frank.li@vivo.com> References: <20240822084733.1599295-1-frank.li@vivo.com> X-ClientProxiedBy: SGXP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::17) To TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5275:EE_|TYZPR06MB6114:EE_ X-MS-Office365-Filtering-Correlation-Id: 356f1bb1-912d-4b6e-14a7-08dcc2850f0d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|7416014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: lUoIurbZ38t4ZFwS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NpiiOuAftA0Bnki7ju02USzBjMGVRZKoBF1FTLfiW9tIvcuzHoPf1q7mwOV3nt4jDByvvCNxYqQWvRopIttpNd9kOWcDkvATVDT895hqWLjkxkHndnSpC8jrZ6SLnl0NWKr6SvfKl6lfCp3CasYv3X7DA++LagffOZYrweH6gsE/O6yu1H8BK+3CMtd9q1Ue7m1xQIMIvA8yKNX7BjSLbSniyye01GfOt70Y2khpEXyQnnxGv88UY+yQqJ1xKMma72V8ytHnnDVd2jep09rZk8BbPS44FHxGEtP/HxegQ7LJX73w19xBPv0SrXj+tENvXIfSvH7nI7I51+ABJ8M2lDKf6szY61xIx1jgv8feXWCguAs= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB5275.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(7416014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B44ZHiyHn6Da/hWrs2NjE82okdCxeS8RO2LTBRYUzVSE54K7xWhQyJUJNlAGhtCD9KQ0E2K3hGHzH87Rd3UNb+eKx9oUf24iMFWUsqDR5xE0u2VS/Ope5VBJXYYO2oVNhR/s+07AKq+WzXJc0NgDQBpqnLb006ItEZ+ffUZMt9n3u/+vuQsLZvL0lXPkSCdtKUtSQ7+KdCGhgUZ1bhg2Hn5D7+Pdo2bS5o3zN5zEgJJ3A481u2OjxMAjVVPL++9/paA4/VwUSZcCKo4h43rFYxH+G9006ELoc4rJu1lrnq5ThJlE46KjXaFSiaBxUbJwKOQGrhtmSOGDd1A1fsOM5dwql1sTfCE3M7GImntPiytEl6gsWltaNIecKJtYafiYBtl8nabEW5venk09C2YjayyPz/MpmK8Z4UxIw0mFgUyKT/jBCluRmFG1uR9UqjzLRplDk82EgtlGpwqrGcmGzk+cfe4RT2LJDj3c1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ohrcjdyXLTrcF4kWx5BJjenHHpv5z5E8+JecQeRPX X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 356f1bb1-912d-4b6e-14a7-08dcc2850f0d X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB5275.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 08:33:12.0014 (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: BYW4E/CVvl6GY3mUcmZPunm0QBMPtS9eIHj7xmuzzH18ZUFbBluK+Zhq+QnjakkSQ+LlCirlLaGl62887lOPSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6114 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 --- 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 Thu Aug 22 08:47:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13772975 X-Patchwork-Delegate: geert@linux-m68k.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2053.outbound.protection.outlook.com [40.107.117.53]) (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 721AD183CC2; Thu, 22 Aug 2024 08:33:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315601; cv=fail; b=PdA9M0UJPS8gSmL6kdMXj56cGdZrMhSZfsi+FvtKdGOV4r+DbH5KRcK9ZsmGiIrDLiEyB1Rwjv5nwXOkSFZpZEcX1Rok/VRA8iV+cXYbvptHdnpybnsFT/klqBOeoglCjKzu1v1ZbkL0j8EqpihxdFasfhITx+R5N646p5amOyA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315601; c=relaxed/simple; bh=0CzW6+guxWyRVFpa7DMQLSohHbKjwhS6yk/KodkS6B4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=XZWF0egX53DF/ryLfcToFs5jH+uvS7Q/eNoy0kJS43RWeNYMMwqYQyJ/IOY9CtgSHm/rVmxt0ykM5v5C6JATGLBWkfXejvSuHQF2hMdSID+AAnRaRPJXnylpBGW7fuDA0uriNjkkkXqujvQ4eTnWFFm4B3mnbxP4qI/kbxxEyiY= 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=bXG0HzAl; arc=fail smtp.client-ip=40.107.117.53 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="bXG0HzAl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SjpXFaQ765kXbCPFdYxUqyfgqFkblfRz0WL3WAukdT8dSEQCI8TuPZgp+DIEinKR4UEIJUHaSBc2fTg7befo7gDD7n4WxUklUvuy09b/0mksIx6qdzZuVZ4b+GyQYFo7mT5Wd/4wkX94Kh1YaWjU952Rd6x6ZoS9ZjxHW4q1utzAjtfHIK25GKp4GcA1jAX5wKMiVPVp+he1S1KGncBtbaXOY8qQq1jcmw41CB10GpeHy7ipBJB/78YnxOBOswoyfMCnYF5gGM3mn7kvR/esi157ob2H7Ub/4zpgkbIFffKEktWPcDssTa1wkzt3XdSQxrXg1DzxwEkpBmZi8ZH8tQ== 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=iOgCG3VxnHRR710nCpxUh/XIt5vKoizKYTcHSiG3Gwo=; b=VFkwzm/XwjLbj4tOs9p80YE586aHMM04WlFfS4xW9Z/IjK/1H4lhWoN+zumQXGdfJVkKkfNVpvdzilqm9Xyrnrf3FgXr8FsBXLaP8vKOuddRYbnl5AVtBmiQ0RfkCpPF6vBb/aeOOhPYT5KeM8RtUvH/jy3atJVXRjOtN3axdl+xhHfmLJ5iyXLRj3K2UyE2qUJU6lxzfxGTK/2p53ky7UFDzCHKKO4Y8ye7JwmwpVMWGR2nj+67593lrcj4BNkQHZCOfJoSwHhRMDLuV3iMn9cB5N9rG5yFqvfgTGqvDR0WqYd3i5oRFlSZN3om1N55D8tsvAORNw8vr1kulRWlhw== 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=iOgCG3VxnHRR710nCpxUh/XIt5vKoizKYTcHSiG3Gwo=; b=bXG0HzAl9F8p56VuVzdw+0r7qq+gKF6BS3AyM1Y7VivaYDzci+cKXyb7JYcDE25V7W2DJVhsxnl35/nB2KiaQDGZjhGZ0bfMI29CwqTFZiu0dhbhWzelkeBsvbyfdNb5ursFcZTMRJ+rwwHKr0rJzgkqKLFZTXW+LV40Od4NpZvoAAQ+WuAx7VEbdkrWzKWSsIP9uq0MPujmag8oJP6NUmgrHlwbnKD4VNuQ28MnrBcSsxI6rsXiuawBJV6VuhkZ4hoLZcxbj/I2cT1yeKYfj7iJXKuOohq5wyCh+eYteWAJxFM8cA8j5uIxUeJnnUp7by/zrDW6Bo9XWzZDFaszpw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) by TYZPR06MB6114.apcprd06.prod.outlook.com (2603:1096:400:33f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Thu, 22 Aug 2024 08:33:16 +0000 Received: from TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1]) by TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1%3]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 08:33:16 +0000 From: Yangtao Li To: clement.leger@bootlin.com, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ulli.kroll@googlemail.com, linus.walleij@linaro.org, marcin.s.wojtas@gmail.com, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com, hkallweit1@gmail.com, justinstitt@google.com, kees@kernel.org, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, horms@kernel.org, shannon.nelson@amd.com Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Yangtao Li Subject: [net-next 8/9] net: mvpp2: Convert to devm_clk_get_enabled() and devm_clk_get_optional_enabled() Date: Thu, 22 Aug 2024 02:47:32 -0600 Message-Id: <20240822084733.1599295-9-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822084733.1599295-1-frank.li@vivo.com> References: <20240822084733.1599295-1-frank.li@vivo.com> X-ClientProxiedBy: SGXP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::17) To TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5275:EE_|TYZPR06MB6114:EE_ X-MS-Office365-Filtering-Correlation-Id: ed6d7ca2-8111-4299-25d4-08dcc28511ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|7416014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: zM1OmJAqpeFGmHGlo4vOo60GAsfFFLR8/2tehSMWfspzjvWTz4I/rpqy7xUKju9TGhns9H8RfpuzTzyN4hQVKc2gtX3dVnRXwth/mqY851ooikSg1apiGyrME2v7X9wRTI435O7pQhOUF6OYuDi996sw1hEvUZAnhJ0KJuyCUx84pw1I1k6eWjLhWWICKc/9HV+WDjUmklKSjgoccxhwZLiAjdLEZ9ks+A840RVSrzo5g0kCiYdZGuApi1VnkxwjBlVaNXmyE7ukFFQkBRixU6JhjWM2I4TFNdbABat8D+ZgYIuCyyFifGk1R/V6amwy1AMjXym+49rjNhB+pXGCn4/lBBBV9Ezb11iW6ZdQvMFLYWnfZh3CL227olW1JoT5r4K0Ciedj8vLWsfGhSepKVP9CWcA2AYnint7bdCpToQzw7ojt6286eZhe7w1zg58ue+1xv81NAK2gqy23StcgnHCSqfuD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:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(7416014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GJlsVvS9xFzFcIMg+JlqOxJNr3Fks+Cq+jf6laf13DrAc9Mwg646HmhYnTEX3obsEYgMqJ5D8LAS26lfl4ZncYCN2exsZ1/VfoartAa3CZ+05zZisnlar/uqwNy4K6BKZodZjKdaCSGbAd0ed3747TrSmj0V2wFQBBhRnCwfjjXutMsJToJcyxB0rS7x2LCW3/6h62jjDbU5XYUEnVnNS+pGqebOxJEwZ/EJFi65x5jSq7Lb3RPCGrApr9Y6MLWhCzTHG6evT7ean1bEXCv5y1PoScurzQQdjC6TA7uMPEthuvAKNb3M+YXe9wu3yr47bW3yLiyMB1lBUqwGavsLh/v4DIIjBTXjIfgbJ69Mjl9k8f8a8uM2T7R6T9FYnVVor+K2jEx3XUHfD/yzP5nf1QQGql3uElU0D1owm1NyeVGO3LxpJeSSKu0flk9Hl+uM6k4CG5wrGNCSsTPal3s2NC7uDCSn0htODF/RvTJtOWYzQSKvXSGwXE0c8R8AS/AVdhNJN01DZ1YdZbLkFXvLJ+y+PfOsUmkC9zxQVgbXdcNElQFZ9dAx+3sYyeulzJfQvLKDy/kPYNd2V7vEcPHfQQq7QMhzJdA/BtKzoHAyA6dyJeFE8Xs+C3Mhawtc2x95yjxnLkur1Z5gu2hqv7O67aThIBbAr0oi608rXTTAA061FTGdjDcpIl1KCVbJW7VG1ygswHxrTIrY6cpO7LeIAZdu8fQSvHmdGgI33yGAOQtdTsOMNMt/MP/WM0lO08LzHBeggqdlwvyffvZEydGDmTYAWVxhC2sfE7O1EX8TrConNzm+9e1aM8E57vQQnSFaScAukkT3+m7nIrjTX/Z6scI6gJJH9m7AhciAuHOo5Kb3sv19zIo2O94cNUBQLQa5gu8X0VxBM1vB50NaeEJ/TyDByUyer8nYkxt5tWGn9qdrv+sPFSrL+/ESQBaUIDDajyhruEHzBiNGk67/xid4SioAOPbzoylTBjejEda4rt3a0QHPOBTTqrXJJY8g2nXDPbCqZtTTUUfJtjFlQ4LTDPz3RKB+D8yNKWR/AIQ2P3qaNUzr+CRewkWS4LxxhzILp23R/dT7P5Adez7R2uNZOB7GGUaEkjJMh8BQo4jjC0tFmEnA39N1t8uyOgMtDqgOWNO6Iq4mLuMvscvZddKq5H9AKIano7kGM12cftw1EhwM9+0PdSjFjupmdPKrcocw7hUJtBlzoAeMaigb+MNTuo0MxcSmp5BG8d9sfIWU/DTl15gtGqxp1Vyo3Cx4XiQ7xRdYiBGLvbq42hfXdCP7sYl04mANqD3wxKR9+MMZYA8jpyJYVls0dK89Tp+jSJuda0oQnGDiZv01yeCQA4akKmA+ltPHt2W+Wdl3Ix/QkpB+waowbWIT/u4j0uGAQ5+BzD6gQF7VuVZUE29f1hxvqeIhAnJB1j4c14Z2mp7we0/3mCd7i7eFbNhlK8o/PmifCI7cHqOrZg6M+t86HaGCtNfrwpxw8ae58ESsaxVRo9KHLpwq63qCwouSk9m7cqnLqxajt856nS8wMDJHu34xZNspU/azmdY2sxUQOrByoruQSXMlSEKrTgDy+X+yx6c2 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed6d7ca2-8111-4299-25d4-08dcc28511ec X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB5275.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 08:33:16.8225 (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: u4K0jxKpij4A6krqVd/iOfTWb+VbyBWlJbjCr+maAEb/V870ehxHkeygbakJKowJo6AuM32vJzqh4TeYob9OEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6114 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 --- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 7 -- .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 86 +++++-------------- 2 files changed, 22 insertions(+), 71 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..0075499de29f 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -7462,6 +7462,7 @@ static int mvpp2_get_sram(struct platform_device *pdev, static int mvpp2_probe(struct platform_device *pdev) { + struct clk *pp_clk, *gop_clk, *mg_clk, *mg_core_clk, *axi_clk; struct mvpp2 *priv; struct resource *res; void __iomem *base; @@ -7561,56 +7562,30 @@ 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; + pp_clk = devm_clk_get_enabled(&pdev->dev, "pp_clk"); + if (IS_ERR(pp_clk)) + return PTR_ERR(pp_clk); - 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; + gop_clk = devm_clk_get_enabled(&pdev->dev, "gop_clk"); + if (IS_ERR(gop_clk)) + return PTR_ERR(gop_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; - } - - err = clk_prepare_enable(priv->mg_clk); - if (err < 0) - goto err_gop_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; - } + mg_clk = devm_clk_get_enabled(&pdev->dev, "mg_clk"); + if (IS_ERR(mg_clk)) + return PTR_ERR(mg_clk); - err = clk_prepare_enable(priv->mg_core_clk); - if (err < 0) - goto err_mg_clk; + mg_core_clk = devm_clk_get_optional_enabled(&pdev->dev, "mg_core_clk"); + if (IS_ERR(mg_core_clk)) + return PTR_ERR(mg_core_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; - } - - err = clk_prepare_enable(priv->axi_clk); - if (err < 0) - goto err_mg_core_clk; + axi_clk = devm_clk_get_optional_enabled(&pdev->dev, "axi_clk"); + if (IS_ERR(axi_clk)) + return PTR_ERR(axi_clk); /* Get system's tclk rate */ - priv->tclk = clk_get_rate(priv->pp_clk); + priv->tclk = clk_get_rate(pp_clk); } else { err = device_property_read_u32(&pdev->dev, "clock-frequency", &priv->tclk); if (err) { @@ -7622,7 +7597,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 +7605,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 +7624,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 +7640,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 +7672,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 +7709,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 Thu Aug 22 08:47:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 13772976 X-Patchwork-Delegate: geert@linux-m68k.org Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2081.outbound.protection.outlook.com [40.107.215.81]) (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 BB17317C21B; Thu, 22 Aug 2024 08:33:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315608; cv=fail; b=dZYTtQYdKvMwt+wMo5peA8zmKW2iO/zz2Wqyb0uM3TXmCLKaAsYlIuV3GaYiw0NnZvu3QkETFKglHYwW1UwcoYxs7A1/yI9D76t3EA5ysnZXllUctDd3Cmo9y3KGpaKPupOUrfH6l9OfllfA2TdynSKdj+/lQ6O5ycULQepywwo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724315608; c=relaxed/simple; bh=zeX/YnL+vXc3rtOcLL7mYLbRFsPSV5CJbQZUVBOm3VM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=GQFwWFpgxw6ZAsXpNFhfsFlJq70stEKZVbh9RakTD+OaJhn2cZQmrxzxscEWX2fGx7yHCPuk9jQn8avH9rHPvqJV5qNYHx0AoC0NF9KTT/s0hVp/c6QzgBUE0KQSf6F+jE1o2JSi6g3RQee3zD99gzALWxjyJ8rinHKVqGnTptg= 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=LkaAHOwq; arc=fail smtp.client-ip=40.107.215.81 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="LkaAHOwq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HboOP7w/9T6qO9DzT3K/riyoHX+AcItpajsGwiRZYbXq0pMyfJmO1t748HH4l8mWCUs2lNfeQMrdJbhb8N6qRYaEy9vQXp6w/JDgJNK0dxI6FZGuodLhzJgZePcIbG4lPSzxZRI4fdRxMfY+SrBqA0gJJVK3LvQV8SLmhMOpP6XZAvnTGsY3/EAE9BhHLzfs5oahOGxJhUk7AjElOn2rzegoyY3lMM2QHPIKHWcqdLYacU00YXAFMtKkfgkDMQhw7cr/fOtPnyL9Sp1pZxCZvGDwfn7sbkpQHfhG9YGOvWxa/EBrF+UpalpEuDPdzxp8boJggRcWxv9KAY5SXl8yRw== 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=JhrheUEqbj6J8Oa0KRmjQ2HoVaVILVd52x0GHmKxfWIo/oFA4+K+7cCD2fd0tJfiFBhGB9EmkHAi0YeptjtzgFhqGfh3lZMSMKav13LVYR+Lu2qxUm5ILhxyzDiEVXqNtaJLToeJYqbbqF2ZM155KX4ER8cs5IA7VpUCJczWreN8KXOk85hQuo/HTX4VpgaKQEAT7c4u6na4k5S/l8Z/IYMMFaUqx6lWM8Njv+xq7kC6v7ci+iVZA88rCX3p3DNR/DELIdLAx/JTf889aQWF3bBjfnERXIrxNbWjqxgtICUuzNm3y+3AKmP5UUVeJofhbkE0OWS5Wo13WoQk+4fwPQ== 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=LkaAHOwqIQk5n9K2J87RptvM/ecNsPdOLhC+Gjy//DLdLEBUIoUsFviRG3FevQLwAP7ABENlhYnjOy2ygd2mTQFQnfijA/FvSFfP3JIPeldb6udWecwnTYCuZd865NH/c2VG888rBHg/hpys8VOLWX+Je/0sonD529EFqJ5UC7pJVZq7G8pTkHMqO3hDY2Ilr8WsuBlc0JMGjJuVDqUNv9ce+vWpY3K2EHZXqvLexQ2H4lUnpjUDJ+KDBIQPbqhnCdpn/a9gB2nJKR1NwtnOTKcMN61uqkmz/HjG7r3xVmI8KlWbYWbq0lUGYIgtYsWQv9ovXyIpti3fEazfSh/nvg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) by TYZPR06MB6114.apcprd06.prod.outlook.com (2603:1096:400:33f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Thu, 22 Aug 2024 08:33:22 +0000 Received: from TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1]) by TYZPR06MB5275.apcprd06.prod.outlook.com ([fe80::6257:d19:a671:f4f1%3]) with mapi id 15.20.7897.014; Thu, 22 Aug 2024 08:33:22 +0000 From: Yangtao Li To: clement.leger@bootlin.com, andrew@lunn.ch, f.fainelli@gmail.com, olteanv@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ulli.kroll@googlemail.com, linus.walleij@linaro.org, marcin.s.wojtas@gmail.com, linux@armlinux.org.uk, alexandre.torgue@foss.st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com, hkallweit1@gmail.com, justinstitt@google.com, kees@kernel.org, u.kleine-koenig@pengutronix.de, jacob.e.keller@intel.com, horms@kernel.org, shannon.nelson@amd.com Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Yangtao Li Subject: [net-next 9/9] net: marvell: pxa168_eth: Convert to devm_clk_get_enabled() Date: Thu, 22 Aug 2024 02:47:33 -0600 Message-Id: <20240822084733.1599295-10-frank.li@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822084733.1599295-1-frank.li@vivo.com> References: <20240822084733.1599295-1-frank.li@vivo.com> X-ClientProxiedBy: SGXP274CA0005.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::17) To TYZPR06MB5275.apcprd06.prod.outlook.com (2603:1096:400:1f5::6) Precedence: bulk X-Mailing-List: linux-renesas-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB5275:EE_|TYZPR06MB6114:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a712ee5-f4d3-4e60-3fd3-08dcc28514fd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|7416014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: rdryva4G0kNzhtAeTQHh7nP6hBf7uwypokt/lY5pj3aS+X4B6RyEU3597H9OkUDm6c6lNztpqsC+K7Fww7dVLLD6fznLq5dTRK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oIg6UzPuU99KRoHTsENOKxdJTmYP+/QqAmOKJKJ6YcWG10AXLQ7M0Ohy5tk0Iia1Ym6iAsSSoWENEBcuElRJROKr3HVIJIXPy4AYVvnTpKUP7VvMXQRIJ9c/AnV9pN9fe3wAZG5Qtjv6JeqluZs2US0OZLYr4fPzH/cBB/yJf2w4xMeUBzJBMDTKSTKIb8pmW1U7ZqeOlDSR4D6ToAE/kYLfM4TD28ELLwgjs8m5jujgiCvbVi1Kv+ma9JKBQvyCL7BWq0nZyryMajlpOv5U= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB5275.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(7416014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AUJdUAi2K1q26PpAFhijnVXigNU7CDx8AfmAgw0BPT+1nFfuCP7miZCwYdoCzRpKOsSSCb7YAAWpjXxusJwKSbb6WwTIw6q/9ZaifMPtAKplviWwimXDIBFtzllauoEU6lWlbDpV9nqw4vp5rLiVIsK6Cf9/Q6uAYk6PIHw5P2/QQcapz7/CShTVwGLMGJT+nELcgR1dVcMeS9XAjtvg4UsGV7Ae5E4GLCCOon0T5EtFXxgnxsAA1MM69MTfJK6VjOXpSnahBYfAMWCL0y+DcBdvPG6v3cDl+UjR+Jkgpm+wcpS2TD9aST0eX3DBzZpxndNLkjlvtZlG32oXbTtqx7WZCjoRHGaQlomyGH9SaJk8/EjeePxVgI2lbzoyUX+0UeQ6y6dFLC/njXN724yqN2XACh7+2Vej0FOBtXsdz6tiCet5aKFNwHMSScf4TaFxsJkJscLyJaqa8mHuJoprQt1yh1jTy/MWnVPKvuGBpU3k/YUoH+TnQ3C11eyUsnepzhAYIUHscuZTP4G7U8VhMqwxOPaqKdvbVMHI80Rpf/T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: 3a712ee5-f4d3-4e60-3fd3-08dcc28514fd X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB5275.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Aug 2024 08:33:21.9508 (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: jcEkGWRkZm9ZewMI63vUCEeaTZb5FxEU7E4X40M6T0Hn1803tk4aqJvP2IiuVzO8/6tuCSEdkD41C5TyBbbkIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6114 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);