* [PATCH net-next] net: stmmac: mdio: clean up c22/c45 accessor split
@ 2025-08-27 13:27 Russell King (Oracle)
2025-08-28 15:28 ` Simon Horman
2025-08-29 0:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Russell King (Oracle) @ 2025-08-27 13:27 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
The C45 accessors were setting the GR (register number) field twice,
once with the 16-bit register address truncated to five bits, and
then overwritten with the C45 devad. This is harmless since the field
was being cleared prior to being updated with the C45 devad, except
for the extra work.
Remove the redundant code.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
Untested, as I don't have my Jetson Xavier NX platform with me (and
probably won't do for a few weeks.)
While this patch has been prepared on top of "net: stmmac: mdio: use
netdev_priv() directly" it shouldn't conflict if that patch is not
applied before this one.
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 86021e6b67b2..da4542be756a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -311,12 +311,10 @@ static int stmmac_mdio_read_c45(struct mii_bus *bus, int phyaddr, int devad,
value |= (phyaddr << priv->hw->mii.addr_shift)
& priv->hw->mii.addr_mask;
- value |= (phyreg << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask;
value |= (priv->clk_csr << priv->hw->mii.clk_csr_shift)
& priv->hw->mii.clk_csr_mask;
value |= MII_GMAC4_READ;
value |= MII_GMAC4_C45E;
- value &= ~priv->hw->mii.reg_mask;
value |= (devad << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask;
data |= phyreg << MII_GMAC4_REG_ADDR_SHIFT;
@@ -409,14 +407,12 @@ static int stmmac_mdio_write_c45(struct mii_bus *bus, int phyaddr,
value |= (phyaddr << priv->hw->mii.addr_shift)
& priv->hw->mii.addr_mask;
- value |= (phyreg << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask;
value |= (priv->clk_csr << priv->hw->mii.clk_csr_shift)
& priv->hw->mii.clk_csr_mask;
value |= MII_GMAC4_WRITE;
value |= MII_GMAC4_C45E;
- value &= ~priv->hw->mii.reg_mask;
value |= (devad << priv->hw->mii.reg_shift) & priv->hw->mii.reg_mask;
data |= phyreg << MII_GMAC4_REG_ADDR_SHIFT;
--
2.47.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: stmmac: mdio: clean up c22/c45 accessor split
2025-08-27 13:27 [PATCH net-next] net: stmmac: mdio: clean up c22/c45 accessor split Russell King (Oracle)
@ 2025-08-28 15:28 ` Simon Horman
2025-08-29 0:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-08-28 15:28 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Andrew Lunn, Heiner Kallweit, Alexandre Torgue, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, linux-arm-kernel,
linux-stm32, Maxime Coquelin, netdev, Paolo Abeni
On Wed, Aug 27, 2025 at 02:27:47PM +0100, Russell King (Oracle) wrote:
> The C45 accessors were setting the GR (register number) field twice,
> once with the 16-bit register address truncated to five bits, and
> then overwritten with the C45 devad. This is harmless since the field
> was being cleared prior to being updated with the C45 devad, except
> for the extra work.
>
> Remove the redundant code.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> Untested, as I don't have my Jetson Xavier NX platform with me (and
> probably won't do for a few weeks.)
>
> While this patch has been prepared on top of "net: stmmac: mdio: use
> netdev_priv() directly" it shouldn't conflict if that patch is not
> applied before this one.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: stmmac: mdio: clean up c22/c45 accessor split
2025-08-27 13:27 [PATCH net-next] net: stmmac: mdio: clean up c22/c45 accessor split Russell King (Oracle)
2025-08-28 15:28 ` Simon Horman
@ 2025-08-29 0:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-08-29 0:00 UTC (permalink / raw)
To: Russell King
Cc: andrew, hkallweit1, alexandre.torgue, andrew+netdev, davem,
edumazet, kuba, linux-arm-kernel, linux-stm32, mcoquelin.stm32,
netdev, pabeni
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 27 Aug 2025 14:27:47 +0100 you wrote:
> The C45 accessors were setting the GR (register number) field twice,
> once with the 16-bit register address truncated to five bits, and
> then overwritten with the C45 devad. This is harmless since the field
> was being cleared prior to being updated with the C45 devad, except
> for the extra work.
>
> Remove the redundant code.
>
> [...]
Here is the summary with links:
- [net-next] net: stmmac: mdio: clean up c22/c45 accessor split
https://git.kernel.org/netdev/net-next/c/24eb86a8170f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-29 0:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-27 13:27 [PATCH net-next] net: stmmac: mdio: clean up c22/c45 accessor split Russell King (Oracle)
2025-08-28 15:28 ` Simon Horman
2025-08-29 0:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).