/* phy_device_register - Register the phy device on the MDIO bus @phydev: phy_device structure to be added to the MDIO bus  */
int phy_device_register(struct phy_device *phydev)
/* phy_device_register - Register the phy device on the MDIO bus @phydev: phy_device structure to be added to the MDIO bus  */
int phy_device_register(struct phy_device *phydev)
{
	int err;
	if (phydev->bus->phy_map[phydev->addr])
		return -EINVAL;
	phydev->bus->phy_map[phydev->addr] = phydev;
	phy_scan_fixups(phydev);
	err = device_register(&phydev->dev);
	if (err) {
		pr_err("phy %d failed to register\n", phydev->addr);
		goto out;
	}
	return 0;
 out:
	phydev->bus->phy_map[phydev->addr] = NULL;
	return err;
}