* [PATCH net-next] ethernet: remove superfluous clearing of phydev
@ 2023-03-21 13:17 Wolfram Sang
2023-03-21 20:17 ` Andrew Lunn
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Wolfram Sang @ 2023-03-21 13:17 UTC (permalink / raw)
To: netdev
Cc: linux-renesas-soc, Wolfram Sang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Bryan Whitehead, UNGLinuxDriver,
Sergey Shtylyov, Steve Glendinning, Wells Lu, linux-kernel
phy_disconnect() calls phy_detach() which already clears 'phydev' if it
is attached to a struct net_device.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Tested with an Renesas APE6-EK (SMSC911x). Because this is more of a
mechanical change, I opted to put all occurences into one patch. I can
break out, of course, if this is preferred.
drivers/net/ethernet/engleder/tsnep_main.c | 1 -
drivers/net/ethernet/microchip/lan743x_main.c | 1 -
drivers/net/ethernet/renesas/rswitch.c | 4 +---
drivers/net/ethernet/smsc/smsc911x.c | 2 --
drivers/net/ethernet/sunplus/spl2sw_phy.c | 4 +---
5 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c
index 6982aaa928b5..ed1b6102cfeb 100644
--- a/drivers/net/ethernet/engleder/tsnep_main.c
+++ b/drivers/net/ethernet/engleder/tsnep_main.c
@@ -246,7 +246,6 @@ static void tsnep_phy_close(struct tsnep_adapter *adapter)
{
phy_stop(adapter->netdev->phydev);
phy_disconnect(adapter->netdev->phydev);
- adapter->netdev->phydev = NULL;
}
static void tsnep_tx_ring_cleanup(struct tsnep_tx *tx)
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index 7e0871b631e4..957d96a91a8a 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -1466,7 +1466,6 @@ static void lan743x_phy_close(struct lan743x_adapter *adapter)
phy_stop(netdev->phydev);
phy_disconnect(netdev->phydev);
- netdev->phydev = NULL;
}
static void lan743x_phy_interface_select(struct lan743x_adapter *adapter)
diff --git a/drivers/net/ethernet/renesas/rswitch.c b/drivers/net/ethernet/renesas/rswitch.c
index c4f93d24c6a4..29afaddb598d 100644
--- a/drivers/net/ethernet/renesas/rswitch.c
+++ b/drivers/net/ethernet/renesas/rswitch.c
@@ -1324,10 +1324,8 @@ static int rswitch_phy_device_init(struct rswitch_device *rdev)
static void rswitch_phy_device_deinit(struct rswitch_device *rdev)
{
- if (rdev->ndev->phydev) {
+ if (rdev->ndev->phydev)
phy_disconnect(rdev->ndev->phydev);
- rdev->ndev->phydev = NULL;
- }
}
static int rswitch_serdes_set_params(struct rswitch_device *rdev)
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 3a9e587f7452..037a2b6b89d7 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1744,7 +1744,6 @@ static int smsc911x_open(struct net_device *dev)
free_irq(dev->irq, dev);
mii_free_out:
phy_disconnect(dev->phydev);
- dev->phydev = NULL;
out:
pm_runtime_put(dev->dev.parent);
return retval;
@@ -1775,7 +1774,6 @@ static int smsc911x_stop(struct net_device *dev)
if (dev->phydev) {
phy_stop(dev->phydev);
phy_disconnect(dev->phydev);
- dev->phydev = NULL;
}
netif_carrier_off(dev);
pm_runtime_put(dev->dev.parent);
diff --git a/drivers/net/ethernet/sunplus/spl2sw_phy.c b/drivers/net/ethernet/sunplus/spl2sw_phy.c
index 404f508a54d4..6f899e48f51d 100644
--- a/drivers/net/ethernet/sunplus/spl2sw_phy.c
+++ b/drivers/net/ethernet/sunplus/spl2sw_phy.c
@@ -84,9 +84,7 @@ void spl2sw_phy_remove(struct spl2sw_common *comm)
for (i = 0; i < MAX_NETDEV_NUM; i++)
if (comm->ndev[i]) {
ndev = comm->ndev[i];
- if (ndev) {
+ if (ndev)
phy_disconnect(ndev->phydev);
- ndev->phydev = NULL;
- }
}
}
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] ethernet: remove superfluous clearing of phydev
2023-03-21 13:17 [PATCH net-next] ethernet: remove superfluous clearing of phydev Wolfram Sang
@ 2023-03-21 20:17 ` Andrew Lunn
2023-03-21 20:38 ` Florian Fainelli
2023-03-23 3:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2023-03-21 20:17 UTC (permalink / raw)
To: Wolfram Sang
Cc: netdev, linux-renesas-soc, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Bryan Whitehead, UNGLinuxDriver,
Sergey Shtylyov, Steve Glendinning, Wells Lu, linux-kernel
On Tue, Mar 21, 2023 at 02:17:45PM +0100, Wolfram Sang wrote:
> phy_disconnect() calls phy_detach() which already clears 'phydev' if it
> is attached to a struct net_device.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] ethernet: remove superfluous clearing of phydev
2023-03-21 13:17 [PATCH net-next] ethernet: remove superfluous clearing of phydev Wolfram Sang
2023-03-21 20:17 ` Andrew Lunn
@ 2023-03-21 20:38 ` Florian Fainelli
2023-03-23 3:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2023-03-21 20:38 UTC (permalink / raw)
To: Wolfram Sang, netdev
Cc: linux-renesas-soc, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Bryan Whitehead, UNGLinuxDriver, Sergey Shtylyov,
Steve Glendinning, Wells Lu, linux-kernel
On 3/21/23 06:17, Wolfram Sang wrote:
> phy_disconnect() calls phy_detach() which already clears 'phydev' if it
> is attached to a struct net_device.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] ethernet: remove superfluous clearing of phydev
2023-03-21 13:17 [PATCH net-next] ethernet: remove superfluous clearing of phydev Wolfram Sang
2023-03-21 20:17 ` Andrew Lunn
2023-03-21 20:38 ` Florian Fainelli
@ 2023-03-23 3:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-23 3:50 UTC (permalink / raw)
To: Wolfram Sang
Cc: netdev, linux-renesas-soc, davem, edumazet, kuba, pabeni,
bryan.whitehead, UNGLinuxDriver, s.shtylyov, steve.glendinning,
wellslutw, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 21 Mar 2023 14:17:45 +0100 you wrote:
> phy_disconnect() calls phy_detach() which already clears 'phydev' if it
> is attached to a struct net_device.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>
> Tested with an Renesas APE6-EK (SMSC911x). Because this is more of a
> mechanical change, I opted to put all occurences into one patch. I can
> break out, of course, if this is preferred.
>
> [...]
Here is the summary with links:
- [net-next] ethernet: remove superfluous clearing of phydev
https://git.kernel.org/netdev/net-next/c/22f5c234141d
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] 4+ messages in thread
end of thread, other threads:[~2023-03-23 3:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 13:17 [PATCH net-next] ethernet: remove superfluous clearing of phydev Wolfram Sang
2023-03-21 20:17 ` Andrew Lunn
2023-03-21 20:38 ` Florian Fainelli
2023-03-23 3:50 ` 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).