Skip to content

Commit b0048e3

Browse files
maass-hamburgdkalowsk
authored andcommitted
drivers: ethernet: phy: use kernel timepoint api
use kernel timepoint api. Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
1 parent 5aacf59 commit b0048e3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/ethernet/phy/phy_mii.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct phy_mii_dev_data {
4141
struct k_work_delayable autoneg_work;
4242
bool gigabit_supported;
4343
bool restart_autoneg;
44-
uint32_t autoneg_timeout;
44+
k_timepoint_t autoneg_timeout;
4545
#endif
4646
};
4747

@@ -213,7 +213,7 @@ static int update_link_state(const struct device *dev)
213213
data->restart_autoneg = false;
214214

215215
/* We have to wait for the auto-negotiation process to complete */
216-
data->autoneg_timeout = CONFIG_PHY_AUTONEG_TIMEOUT_MS / MII_AUTONEG_POLL_INTERVAL_MS;
216+
data->autoneg_timeout = sys_timepoint_calc(K_MSEC(CONFIG_PHY_AUTONEG_TIMEOUT_MS));
217217
return -EINPROGRESS;
218218
}
219219

@@ -245,7 +245,7 @@ static int check_autonegotiation_completion(const struct device *dev)
245245
}
246246

247247
if (!(bmsr_reg & MII_BMSR_AUTONEG_COMPLETE)) {
248-
if (data->autoneg_timeout-- == 0U) {
248+
if (sys_timepoint_expired(data->autoneg_timeout)) {
249249
LOG_DBG("PHY (%d) auto-negotiate timedout", cfg->phy_addr);
250250
return -ETIMEDOUT;
251251
}

0 commit comments

Comments
 (0)