Commit a60323e6 authored by Yonglong Liu's avatar Yonglong Liu Committed by Greg Kroah-Hartman

net: hns: Restart autoneg need return failed when autoneg off

[ Upstream commit ed29ca8b ]

The hns driver of earlier devices, when autoneg off, restart autoneg
will return -EINVAL, so make the hns driver for the latest devices
do the same.
Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent d7032947
...@@ -1154,16 +1154,18 @@ static int hns_get_regs_len(struct net_device *net_dev) ...@@ -1154,16 +1154,18 @@ static int hns_get_regs_len(struct net_device *net_dev)
*/ */
static int hns_nic_nway_reset(struct net_device *netdev) static int hns_nic_nway_reset(struct net_device *netdev)
{ {
int ret = 0;
struct phy_device *phy = netdev->phydev; struct phy_device *phy = netdev->phydev;
if (netif_running(netdev)) { if (!netif_running(netdev))
/* if autoneg is disabled, don't restart auto-negotiation */ return 0;
if (phy && phy->autoneg == AUTONEG_ENABLE)
ret = genphy_restart_aneg(phy);
}
return ret; if (!phy)
return -EOPNOTSUPP;
if (phy->autoneg != AUTONEG_ENABLE)
return -EINVAL;
return genphy_restart_aneg(phy);
} }
static u32 static u32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment