[PATCH net v1 1/2] net: phy: enable polling when driver implements get_next_update_time

Oleksij Rempel posted 2 patches 5 months, 1 week ago
There is a newer version of this series
[PATCH net v1 1/2] net: phy: enable polling when driver implements get_next_update_time
Posted by Oleksij Rempel 5 months, 1 week ago
Make phylib’s state-machine timer run for drivers that provide
get_next_update_time() but not update_stats().

phy_polling_mode() currently switches to polling only when either
- the PHY runs in interrupt-less mode, or
- the driver exposes update_stats() (needed by several
  statistics-gathering drivers).

Upcoming support for adaptive polling in the SMSC LAN9512/LAN8700 family
relies on get_next_update_time() alone, so the helper must also trigger
polling for that callback. No in-tree drivers have required this until
now, so the change does not alter existing behaviour.

Fixes: 8bf47e4d7b87 ("net: phy: Add support for driver-specific next update time")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 include/linux/phy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/phy.h b/include/linux/phy.h
index 74c1bcf64b3c..b37b981fc9be 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -1628,7 +1628,7 @@ static inline bool phy_polling_mode(struct phy_device *phydev)
 		if (phydev->drv->flags & PHY_POLL_CABLE_TEST)
 			return true;
 
-	if (phydev->drv->update_stats)
+	if (phydev->drv->update_stats || phydev->drv->get_next_update_time)
 		return true;
 
 	return phydev->irq == PHY_POLL;
-- 
2.39.5