Commit d5f3c81c authored by Oleksij Rempel's avatar Oleksij Rempel Committed by David S. Miller

net: usb: asix: make use of mdiobus_get_phy and phy_connect_direct

In most cases we use own mdio bus, there is no need to create and store
string for the PHY address.
Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5436fb3f
...@@ -184,7 +184,6 @@ struct asix_common_private { ...@@ -184,7 +184,6 @@ struct asix_common_private {
struct mii_bus *mdio; struct mii_bus *mdio;
struct phy_device *phydev; struct phy_device *phydev;
u16 phy_addr; u16 phy_addr;
char phy_name[20];
bool embd_phy; bool embd_phy;
u8 chipcode; u8 chipcode;
}; };
......
...@@ -661,15 +661,16 @@ static int ax88772_init_phy(struct usbnet *dev) ...@@ -661,15 +661,16 @@ static int ax88772_init_phy(struct usbnet *dev)
struct asix_common_private *priv = dev->driver_priv; struct asix_common_private *priv = dev->driver_priv;
int ret; int ret;
snprintf(priv->phy_name, sizeof(priv->phy_name), PHY_ID_FMT, priv->phydev = mdiobus_get_phy(priv->mdio, priv->phy_addr);
priv->mdio->id, priv->phy_addr); if (!priv->phydev) {
netdev_err(dev->net, "Could not find PHY\n");
priv->phydev = phy_connect(dev->net, priv->phy_name, &asix_adjust_link, return -ENODEV;
PHY_INTERFACE_MODE_INTERNAL); }
if (IS_ERR(priv->phydev)) {
netdev_err(dev->net, "Could not connect to PHY device %s\n", ret = phy_connect_direct(dev->net, priv->phydev, &asix_adjust_link,
priv->phy_name); PHY_INTERFACE_MODE_INTERNAL);
ret = PTR_ERR(priv->phydev); if (ret) {
netdev_err(dev->net, "Could not connect PHY\n");
return ret; return ret;
} }
......
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