Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: microchip: lan743x: add fixed phy unregister support

When operating in fixed phy mode and if there is repeated open/close
phy test cases, everytime the fixed phy is registered as a new phy
which leads to overrun after 32 iterations. It is solved by adding
fixed_phy_unregister() in the phy_close path.

In phy_close path, netdev->phydev cannot be used directly in
fixed_phy_unregister() due to two reasons,
- netdev->phydev is set to NULL in phy_disconnect()
- fixed_phy_unregister() can be called only after phy_disconnect()
So saving the netdev->phydev in local variable 'phydev' and
passing it to phy_disconnect().

Signed-off-by: Pavithra Sathyanarayanan <Pavithra.Sathyanarayanan@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Pavithra Sathyanarayanan and committed by
David S. Miller
1e73cfe8 037dbd12

+6
+6
drivers/net/ethernet/microchip/lan743x_main.c
··· 1466 1466 static void lan743x_phy_close(struct lan743x_adapter *adapter) 1467 1467 { 1468 1468 struct net_device *netdev = adapter->netdev; 1469 + struct phy_device *phydev = netdev->phydev; 1469 1470 1470 1471 phy_stop(netdev->phydev); 1471 1472 phy_disconnect(netdev->phydev); 1473 + 1474 + /* using phydev here as phy_disconnect NULLs netdev->phydev */ 1475 + if (phy_is_pseudo_fixed_link(phydev)) 1476 + fixed_phy_unregister(phydev); 1477 + 1472 1478 } 1473 1479 1474 1480 static void lan743x_phy_interface_select(struct lan743x_adapter *adapter)