[net-next,v1,6/7] net: phy: add phy_has_smarteee() helper

Message ID 20230214090314.2026067-7-o.rempel@pengutronix.de
State New
Headers
Series make SmartEEE support controllable |

Commit Message

Oleksij Rempel Feb. 14, 2023, 9:03 a.m. UTC
  Add helper to identify PHYs with SmartEEE support.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 include/linux/phy.h | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Patch

diff --git a/include/linux/phy.h b/include/linux/phy.h
index e6b12653c655..2e726450d3c3 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1408,6 +1408,15 @@  static inline bool phy_polling_mode(struct phy_device *phydev)
 	return phydev->irq == PHY_POLL;
 }
 
+/**
+ * phy_has_smarteee - Tests whether a PHY supports SmartEEE.
+ * @phydev: the phy_device struct
+ */
+static inline bool phy_has_smarteee(struct phy_device *phydev)
+{
+	return phydev && phydev->drv && !!(phydev->drv->flags & PHY_SMART_EEE);
+}
+
 /**
  * phy_has_hwtstamp - Tests whether a PHY time stamp configuration.
  * @phydev: the phy_device struct