diff options
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r-- | drivers/net/phy/phy_device.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 3fc91e89f5a5..bdfe51fc3a65 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -699,6 +699,7 @@ int phy_suspend(struct phy_device *phydev) | |||
699 | { | 699 | { |
700 | struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver); | 700 | struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver); |
701 | struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; | 701 | struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; |
702 | int ret = 0; | ||
702 | 703 | ||
703 | /* If the device has WOL enabled, we cannot suspend the PHY */ | 704 | /* If the device has WOL enabled, we cannot suspend the PHY */ |
704 | phy_ethtool_get_wol(phydev, &wol); | 705 | phy_ethtool_get_wol(phydev, &wol); |
@@ -706,18 +707,31 @@ int phy_suspend(struct phy_device *phydev) | |||
706 | return -EBUSY; | 707 | return -EBUSY; |
707 | 708 | ||
708 | if (phydrv->suspend) | 709 | if (phydrv->suspend) |
709 | return phydrv->suspend(phydev); | 710 | ret = phydrv->suspend(phydev); |
710 | return 0; | 711 | |
712 | if (ret) | ||
713 | return ret; | ||
714 | |||
715 | phydev->suspended = true; | ||
716 | |||
717 | return ret; | ||
711 | } | 718 | } |
712 | EXPORT_SYMBOL(phy_suspend); | 719 | EXPORT_SYMBOL(phy_suspend); |
713 | 720 | ||
714 | int phy_resume(struct phy_device *phydev) | 721 | int phy_resume(struct phy_device *phydev) |
715 | { | 722 | { |
716 | struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver); | 723 | struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver); |
724 | int ret = 0; | ||
717 | 725 | ||
718 | if (phydrv->resume) | 726 | if (phydrv->resume) |
719 | return phydrv->resume(phydev); | 727 | ret = phydrv->resume(phydev); |
720 | return 0; | 728 | |
729 | if (ret) | ||
730 | return ret; | ||
731 | |||
732 | phydev->suspended = false; | ||
733 | |||
734 | return ret; | ||
721 | } | 735 | } |
722 | EXPORT_SYMBOL(phy_resume); | 736 | EXPORT_SYMBOL(phy_resume); |
723 | 737 | ||