Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76299580 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by David S. Miller
Browse files

net: phy: add helper phy_config_aneg



This functionality will also be needed in subsequent patches of this
series, therefore factor it out to a helper.

Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7f657d5b
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -467,6 +467,14 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
}
EXPORT_SYMBOL(phy_mii_ioctl);

static int phy_config_aneg(struct phy_device *phydev)
{
	if (phydev->drv->config_aneg)
		return phydev->drv->config_aneg(phydev);
	else
		return genphy_config_aneg(phydev);
}

/**
 * phy_start_aneg_priv - start auto-negotiation for this PHY device
 * @phydev: the phy_device struct
@@ -493,10 +501,7 @@ static int phy_start_aneg_priv(struct phy_device *phydev, bool sync)
	/* Invalidate LP advertising flags */
	phydev->lp_advertising = 0;

	if (phydev->drv->config_aneg)
		err = phydev->drv->config_aneg(phydev);
	else
		err = genphy_config_aneg(phydev);
	err = phy_config_aneg(phydev);
	if (err < 0)
		goto out_unlock;