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

net: usb: asix: unify ax88772_resume code

The only difference is the reset code, so remove not needed duplicates.
Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 625788b5
......@@ -177,6 +177,7 @@ struct asix_rx_fixup_info {
struct asix_common_private {
void (*resume)(struct usbnet *dev);
void (*suspend)(struct usbnet *dev);
int (*reset)(struct usbnet *dev, int in_pm);
u16 presvd_phy_advertise;
u16 presvd_phy_bmcr;
struct asix_rx_fixup_info rx_fixup_info;
......
......@@ -625,27 +625,13 @@ static void ax88772_resume(struct usbnet *dev)
int i;
for (i = 0; i < 3; i++)
if (!ax88772_hw_reset(dev, 1))
if (!priv->reset(dev, 1))
break;
if (netif_running(dev->net))
phy_start(priv->phydev);
}
static void ax88772a_resume(struct usbnet *dev)
{
struct asix_common_private *priv = dev->driver_priv;
int i;
for (i = 0; i < 3; i++) {
if (!ax88772a_hw_reset(dev, 1))
break;
}
if (netif_running(dev->net))
phy_start(priv->phydev);
}
static int asix_resume(struct usb_interface *intf)
{
struct usbnet *dev = usb_get_intfdata(intf);
......@@ -763,9 +749,14 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
chipcode &= AX_CHIPCODE_MASK;
ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) :
ax88772a_hw_reset(dev, 0);
priv->resume = ax88772_resume;
priv->suspend = ax88772_suspend;
if (chipcode == AX_AX88772_CHIPCODE)
priv->reset = ax88772_hw_reset;
else
priv->reset = ax88772a_hw_reset;
ret = priv->reset(dev, 0);
if (ret < 0) {
netdev_dbg(dev->net, "Failed to reset AX88772: %d\n", ret);
return ret;
......@@ -780,13 +771,6 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
priv->presvd_phy_bmcr = 0;
priv->presvd_phy_advertise = 0;
if (chipcode == AX_AX88772_CHIPCODE) {
priv->resume = ax88772_resume;
priv->suspend = ax88772_suspend;
} else {
priv->resume = ax88772a_resume;
priv->suspend = ax88772_suspend;
}
ret = ax88772_init_mdio(dev);
if (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