]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: phylink: add phylink_init_eee() helper
authorRussell King <rmk+kernel@armlinux.org.uk>
Mon, 11 Feb 2019 11:46:06 +0000 (11:46 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Feb 2019 17:22:41 +0000 (12:22 -0500)
Provide phylink_init_eee() to allow MAC drivers to initialise PHY EEE
from within the ethtool set_eee() method.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phylink.c
include/linux/phylink.h

index a148866cbb14bd7e98826947a20a98b2a019f3b9..33f66dcd369a67da39c6e3d482961531bedadf9e 100644 (file)
@@ -1271,6 +1271,24 @@ int phylink_get_eee_err(struct phylink *pl)
 }
 EXPORT_SYMBOL_GPL(phylink_get_eee_err);
 
+/**
+ * phylink_init_eee() - init and check the EEE features
+ * @pl: a pointer to a &struct phylink returned from phylink_create()
+ * @clk_stop_enable: allow PHY to stop receive clock
+ *
+ * Must be called either with RTNL held or within mac_link_up()
+ */
+int phylink_init_eee(struct phylink *pl, bool clk_stop_enable)
+{
+       int ret = -EOPNOTSUPP;
+
+       if (pl->phydev)
+               ret = phy_init_eee(pl->phydev, clk_stop_enable);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(phylink_init_eee);
+
 /**
  * phylink_ethtool_get_eee() - read the energy efficient ethernet parameters
  * @pl: a pointer to a &struct phylink returned from phylink_create()
index 021fc6595856e8ca4aabfda0fd72ce0551f05053..f57059e4353f7c018d0a6e07d7aced92870bc86e 100644 (file)
@@ -220,6 +220,7 @@ void phylink_ethtool_get_pauseparam(struct phylink *,
 int phylink_ethtool_set_pauseparam(struct phylink *,
                                   struct ethtool_pauseparam *);
 int phylink_get_eee_err(struct phylink *);
+int phylink_init_eee(struct phylink *, bool);
 int phylink_ethtool_get_eee(struct phylink *, struct ethtool_eee *);
 int phylink_ethtool_set_eee(struct phylink *, struct ethtool_eee *);
 int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);