net: stmmac: rk: more cleanups
Subsystems (5)
cover net: stmmac: rk: more cleanups
Hi,
Another couple of cleanups removing pointless code.
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
PATCH 1/3 net: stmmac: rk: fix code formmating issue
Fix a code formatting issue introduced in the previous series, no space after , before "int".
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +1 -1
@@ -904,7 +904,7 @@ static const struct rk_reg_speed_data rk3528_gmac1_reg_speed_data = { };static int rk3528_set_speed (struct rk_priv_data *bsp_priv, -phy_interface_t interface,int speed) +phy_interface_t interface,int speed) {const struct rk_reg_speed_data *rsd;unsigned int reg;
Signature · 1 line
2.30.2
PATCH 2/3 net: stmmac: rk: use device rather than platform device in rk_priv_data
In reply to Russell King (Oracle)All the code in dwmac-rk uses &bsp_priv->pdev->dev, nothing uses bsp_priv->pdev directly. Store the struct device rather than the struct platform_device in struct rk_priv_data, and simplifying the code.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +8 -8
@@ -67,7 +67,7 @@ enum rk_clocks_index { };struct rk_priv_data { -struct platform_device *pdev; +struct device *dev;phy_interface_t phy_iface;int id;struct regulator *regulator;
@@ -248,7 +248,7 @@ static int px30_set_speed(struct rk_priv_data *bsp_priv, phy_interface_t interface, int speed) {struct clk *clk_mac_speed = bsp_priv->clks[RK_CLK_MAC_SPEED ].clk; -struct device *dev = &bsp_priv->pdev->dev; +struct device *dev = bsp_priv->dev;unsigned int con1;long rate;
@@ -1380,8 +1380,8 @@ static const struct rk_gmac_ops rv1126_ops = {static int rk_gmac_clk_init (struct plat_stmmacenet_data *plat) {struct rk_priv_data *bsp_priv = plat->bsp_priv; -struct device *dev = &bsp_priv->pdev->dev;int phy_iface = bsp_priv->phy_iface; +struct device *dev = bsp_priv->dev;int i, j, ret; bsp_priv->clk_enabled = false;
@@ -1473,8 +1473,8 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable)static int phy_power_on (struct rk_priv_data *bsp_priv,bool enable) {struct regulator *ldo = bsp_priv->regulator; +struct device *dev = bsp_priv->dev;int ret; -struct device *dev = &bsp_priv->pdev->dev;if (enable) { ret =regulator_enable (ldo);
@@ -1598,7 +1598,7 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,dev_info (dev,"integrated PHY? (%s).\n" , bsp_priv->integrated_phy ?"yes" :"no" ); - bsp_priv->pdev = pdev; + bsp_priv->dev = dev;return bsp_priv; }
@@ -1618,7 +1618,7 @@ static int rk_gmac_check_ops(struct rk_priv_data *bsp_priv)return -EINVAL ;break ;default : -dev_err (&bsp_priv->pdev->dev, +dev_err (bsp_priv->dev,"unsupported interface %d" , bsp_priv->phy_iface); }return 0 ;
@@ -1626,8 +1626,8 @@ static int rk_gmac_check_ops(struct rk_priv_data *bsp_priv)static int rk_gmac_powerup (struct rk_priv_data *bsp_priv) { +struct device *dev = bsp_priv->dev;int ret; -struct device *dev = &bsp_priv->pdev->dev; ret =rk_gmac_check_ops (bsp_priv);if (ret)
@@ -1683,7 +1683,7 @@ static void rk_gmac_powerdown(struct rk_priv_data *gmac)if (gmac->integrated_phy && gmac->ops->integrated_phy_powerdown) gmac->ops->integrated_phy_powerdown (gmac); -pm_runtime_put_sync (&gmac->pdev->dev); +pm_runtime_put_sync (gmac->dev);phy_power_on (gmac, false);gmac_clk_enable (gmac, false);
Signature · 1 line
2.30.2
PATCH 3/3 net: stmmac: rk: remove unnecessary clk_mac
In reply to Russell King (Oracle)The stmmac platform code already gets the "stmmaceth" clock, so there is no need for drivers to get it. Use the stored pointer in struct plat_stmmacenet_data instead of getting and storing our own pointer.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +1 -8
@@ -80,7 +80,6 @@ struct rk_priv_data {struct clk_bulk_data *clks;int num_clks; -struct clk *clk_mac;struct clk *clk_phy;struct reset_control *phy_reset;
@@ -1408,16 +1407,10 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat)if (ret)return dev_err_probe (dev, ret,"Failed to get clocks\n" ); -/* "stmmaceth" will be enabled by the core */ - bsp_priv->clk_mac =devm_clk_get (dev,"stmmaceth" ); - ret =PTR_ERR_OR_ZERO (bsp_priv->clk_mac); -if (ret) -return dev_err_probe (dev, ret,"Cannot get stmmaceth clock\n" ); -if (bsp_priv->clock_input) {dev_info (dev,"clock input from PHY\n" ); }else if (phy_iface ==PHY_INTERFACE_MODE_RMII ) { -clk_set_rate (bsp_priv->clk_mac,50000000 ); +clk_set_rate (plat->stmmac_clk,50000000 ); }if (plat->phy_node && bsp_priv->integrated_phy) {
Signature · 1 line
2.30.2
Re: [PATCH net-next 1/3] net: stmmac: rk: fix code formmating issue
In reply to Russell King (Oracle)Quoted 4 lines · Russell King (Oracle)
Fix a code formatting issue introduced in the previous series, no space after , before "int".
Signed-off-by Russell King (Oracle) <[email protected]>
Andrew
Re: [PATCH net-next 2/3] net: stmmac: rk: use device rather than platform device in rk_priv_data
In reply to Russell King (Oracle)Quoted 6 lines · Russell King (Oracle)
All the code in dwmac-rk uses
&bsp_priv->pdev->dev, nothing usesbsp_priv->pdevdirectly. Store the struct device rather than the structplatform_devicein structrk_priv_data, and simplifying the code.Signed-off-by Russell King (Oracle) <[email protected]>
Andrew
Re: [PATCH net-next 3/3] net: stmmac: rk: remove unnecessary clk_mac
In reply to Russell King (Oracle)Quoted 5 lines · Russell King (Oracle)
The stmmac platform code already gets the "stmmaceth" clock, so there is no need for drivers to get it. Use the stored pointer in struct
plat_stmmacenet_datainstead of getting and storing our own pointer.Signed-off-by Russell King (Oracle) <[email protected]>
Andrew
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 6 lines · On Mon, 16 Jun 2025 11:16:18 +0100 you wrote:
Hi,
Another couple of cleanups removing pointless code.
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
Here is the summary with links:
- [net-next,1/3] net: stmmac: rk: fix code formmating issue
https://git.kernel.org/netdev/net-next/c/a44769c97e9a - [net-next,2/3] net: stmmac: rk: use device rather than platform device in rk_priv_data https://git.kernel.org/netdev/net-next/c/8f6503993911 - [net-next,3/3] net: stmmac: rk: remove unnecessary clk_mac https://git.kernel.org/netdev/net-next/c/cf283fd6b8be
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html