/* Description: Sanitizes the settings (if we're not autonegotiating them), and then calls the driver's config_aneg function. If the PHYCONTROL Layer is operating, we change the state to reflect the beginning of Auto-negotiation or forcing.  */
int phy_start_aneg(struct phy_device *phydev)
/* Description: Sanitizes the settings (if we're not autonegotiating them), and then calls the driver's config_aneg function. If the PHYCONTROL Layer is operating, we change the state to reflect the beginning of Auto-negotiation or forcing.  */
int phy_start_aneg(struct phy_device *phydev)
{
	int err;
	mutex_lock(&phydev->lock);
	if (AUTONEG_DISABLE == phydev->autoneg)
		phy_sanitize_settings(phydev);
	err = phydev->drv->config_aneg(phydev);
	if (err < 0)
		goto out_unlock;
	if (phydev->state != PHY_HALTED) {
		if (AUTONEG_ENABLE == phydev->autoneg) {
			phydev->state = PHY_AN;
			phydev->link_timeout = PHY_AN_TIMEOUT;
		} else {
			phydev->state = PHY_FORCING;
			phydev->link_timeout = PHY_FORCE_TIMEOUT;
		}
	}
out_unlock:
	mutex_unlock(&phydev->lock);
	return err;
}