From b0048e34cdce4bbcecfa8c640d1a3145ea190511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fin=20Maa=C3=9F?= Date: Wed, 11 Jun 2025 16:51:10 +0200 Subject: [PATCH] drivers: ethernet: phy: use kernel timepoint api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit use kernel timepoint api. Signed-off-by: Fin Maaß --- drivers/ethernet/phy/phy_mii.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/ethernet/phy/phy_mii.c b/drivers/ethernet/phy/phy_mii.c index 2f7654a4f14..a623685b8b5 100644 --- a/drivers/ethernet/phy/phy_mii.c +++ b/drivers/ethernet/phy/phy_mii.c @@ -41,7 +41,7 @@ struct phy_mii_dev_data { struct k_work_delayable autoneg_work; bool gigabit_supported; bool restart_autoneg; - uint32_t autoneg_timeout; + k_timepoint_t autoneg_timeout; #endif }; @@ -213,7 +213,7 @@ static int update_link_state(const struct device *dev) data->restart_autoneg = false; /* We have to wait for the auto-negotiation process to complete */ - data->autoneg_timeout = CONFIG_PHY_AUTONEG_TIMEOUT_MS / MII_AUTONEG_POLL_INTERVAL_MS; + data->autoneg_timeout = sys_timepoint_calc(K_MSEC(CONFIG_PHY_AUTONEG_TIMEOUT_MS)); return -EINPROGRESS; } @@ -245,7 +245,7 @@ static int check_autonegotiation_completion(const struct device *dev) } if (!(bmsr_reg & MII_BMSR_AUTONEG_COMPLETE)) { - if (data->autoneg_timeout-- == 0U) { + if (sys_timepoint_expired(data->autoneg_timeout)) { LOG_DBG("PHY (%d) auto-negotiate timedout", cfg->phy_addr); return -ETIMEDOUT; }