public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org,
	linux-stm32@st-md-mailman.stormreply.com, netdev@vger.kernel.org,
	Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH net-next 02/21] net: stmmac: rk: get rid of rk_phy_power_ctl()
Date: Fri, 23 Jan 2026 11:00:27 +0000	[thread overview]
Message-ID: <E1vjEtv-00000005gfk-3npH@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <aXNUlVZilT-CTgph@shell.armlinux.org.uk>

It is not worth having a common rk_phy_power_ctl() when the only
difference is which regulator function is called. Also, passing
true/false is non-descriptive. Split this function, moving the code
appropriately into rk_phy_powerup() and rk_phy_powerdown().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 .../net/ethernet/stmicro/stmmac/dwmac-rk.c    | 31 ++++++++++---------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index de420997e21f..0e66252eb5ae 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -1498,23 +1498,26 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)
 	return 0;
 }
 
-static int rk_phy_power_ctl(struct rk_priv_data *bsp_priv, bool enable)
+static int rk_phy_powerup(struct rk_priv_data *bsp_priv)
 {
 	struct regulator *ldo = bsp_priv->regulator;
-	struct device *dev = bsp_priv->dev;
 	int ret;
 
-	if (enable) {
-		ret = regulator_enable(ldo);
-		if (ret)
-			dev_err(dev, "fail to enable phy-supply\n");
-	} else {
-		ret = regulator_disable(ldo);
-		if (ret)
-			dev_err(dev, "fail to disable phy-supply\n");
-	}
+	ret = regulator_enable(ldo);
+	if (ret)
+		dev_err(bsp_priv->dev, "fail to enable phy-supply\n");
 
-	return 0;
+	return ret;
+}
+
+static void rk_phy_powerdown(struct rk_priv_data *bsp_priv)
+{
+	struct regulator *ldo = bsp_priv->regulator;
+	int ret;
+
+	ret = regulator_disable(ldo);
+	if (ret)
+		dev_err(bsp_priv->dev, "fail to disable phy-supply\n");
 }
 
 static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,
@@ -1692,7 +1695,7 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
 		dev_err(dev, "NO interface defined!\n");
 	}
 
-	ret = rk_phy_power_ctl(bsp_priv, true);
+	ret = rk_phy_powerup(bsp_priv);
 	if (ret) {
 		gmac_clk_enable(bsp_priv, false);
 		return ret;
@@ -1713,7 +1716,7 @@ static void rk_gmac_powerdown(struct rk_priv_data *gmac)
 
 	pm_runtime_put_sync(gmac->dev);
 
-	rk_phy_power_ctl(gmac, false);
+	rk_phy_powerdown(gmac);
 	gmac_clk_enable(gmac, false);
 }
 
-- 
2.47.3


  parent reply	other threads:[~2026-01-23 11:00 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23 10:59 [PATCH net-next 00/21] net: stmmac: rk: simplify per-SoC configuration Russell King (Oracle)
2026-01-23 11:00 ` [PATCH net-next 01/21] net: stmmac: rk: avoid phy_power_on() Russell King (Oracle)
2026-01-23 11:00 ` Russell King (Oracle) [this message]
2026-01-23 11:00 ` [PATCH net-next 03/21] net: stmmac: rk: convert rk3328 to use bsp_priv->id Russell King (Oracle)
2026-01-25 22:16   ` [net-next,03/21] " Jakub Kicinski
2026-01-23 11:00 ` [PATCH net-next 04/21] net: stmmac: rk: group MACPHY register offset and fields together Russell King (Oracle)
2026-01-23 11:00 ` [PATCH net-next 05/21] net: stmmac: rk: add GMAC_CLK_xx constants, simplify RGMII definitions Russell King (Oracle)
2026-01-23 11:00 ` [PATCH net-next 06/21] net: stmmac: rk: add SoC specific ->init() method Russell King (Oracle)
2026-01-23 11:00 ` [PATCH net-next 07/21] net: stmmac: rk: convert to mask-based interface mode configuration Russell King (Oracle)
2026-01-25 22:16   ` [net-next,07/21] " Jakub Kicinski
2026-01-23 11:00 ` [PATCH net-next 08/21] net: stmmac: rk: move speed GRF register offset to private data Russell King (Oracle)
2026-01-23 11:01 ` [PATCH net-next 09/21] net: stmmac: rk: convert rk3588 to rk_set_reg_speed() Russell King (Oracle)
2026-01-23 11:01 ` [PATCH net-next 10/21] net: stmmac: rk: remove rk3528 RMII clock initialisation Russell King (Oracle)
2026-01-23 11:01 ` [PATCH net-next 11/21] net: stmmac: rk: use rk_encode_wm16() for RGMII clocks Russell King (Oracle)
2026-01-23 11:01 ` [PATCH net-next 12/21] net: stmmac: rk: use rk_encode_wm16() for RMII speed Russell King (Oracle)
2026-01-23 11:01 ` [PATCH net-next 13/21] net: stmmac: rk: use rk_encode_wm16() for RMII clock Russell King (Oracle)
2026-01-23 11:01 ` [PATCH net-next 14/21] net: stmmac: rk: remove need for ->set_speed() method Russell King (Oracle)
2026-01-23 11:01 ` [PATCH net-next 15/21] net: stmmac: rk: convert px30 Russell King (Oracle)
2026-01-23 11:01 ` [PATCH net-next 16/21] net: stmmac: rk: introduce flags indicating support for RGMII/RMII Russell King (Oracle)
2026-01-23 11:01 ` [PATCH net-next 17/21] net: stmmac: rk: replace empty set_to_rmii() with supports_rmii Russell King (Oracle)
2026-01-25 22:16   ` [net-next,17/21] " Jakub Kicinski
2026-01-23 11:01 ` [PATCH net-next 18/21] net: stmmac: rk: rk3328: gmac2phy only supports RMII Russell King (Oracle)
2026-01-25 22:16   ` [net-next,18/21] " Jakub Kicinski
2026-01-25 22:27     ` Russell King (Oracle)
2026-01-25 23:04       ` Jakub Kicinski
2026-01-23 11:01 ` [PATCH net-next 19/21] net: stmmac: rk: rk3528: gmac0 " Russell King (Oracle)
2026-01-25 22:16   ` [net-next,19/21] " Jakub Kicinski
2026-01-23 11:02 ` [PATCH net-next 20/21] net: stmmac: rk: use rk_encode_wm16() for clock selection Russell King (Oracle)
2026-01-25 22:16   ` [net-next,20/21] " Jakub Kicinski
2026-01-23 11:02 ` [PATCH net-next 21/21] net: stmmac: rk: rk3506, rk3528 and kk3588 have rmii_mode in clock register Russell King (Oracle)
2026-01-25 22:16   ` [net-next,21/21] " Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1vjEtv-00000005gfk-3npH@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=heiko@sntech.de \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox