/* Description: Update the value in phydev->link to reflect the current link value. In order to do this, we need to read the status register twice, keeping the second value.  */
int genphy_update_link(struct phy_device *phydev)
/* Description: Update the value in phydev->link to reflect the current link value. In order to do this, we need to read the status register twice, keeping the second value.  */
int genphy_update_link(struct phy_device *phydev)
{
	int status;
	status = phy_read(phydev, MII_BMSR);
	if (status < 0)
		return status;
	status = phy_read(phydev, MII_BMSR);
	if (status < 0)
		return status;
	if ((status & BMSR_LSTATUS) == 0)
		phydev->link = 0;
	else
		phydev->link = 1;
	return 0;
}