diff --git a/drivers/ethernet/eth_e1000.c b/drivers/ethernet/eth_e1000.c index 766ed79dec43..31dd7e28b24c 100644 --- a/drivers/ethernet/eth_e1000.c +++ b/drivers/ethernet/eth_e1000.c @@ -371,27 +371,27 @@ static int ptp_clock_e1000_rate_adjust(const struct device *dev, double ratio) float val; /* No change needed. */ - if (ratio == 1.0f) { + if (ratio == 1.0) { return 0; } ratio *= context->clk_ratio; /* Limit possible ratio. */ - if ((ratio > 1.0f + 1.0f/(2 * hw_inc)) || - (ratio < 1.0f - 1.0f/(2 * hw_inc))) { + if ((ratio > 1.0 + 1.0/(2.0 * hw_inc)) || + (ratio < 1.0 - 1.0/(2.0 * hw_inc))) { return -EINVAL; } /* Save new ratio. */ context->clk_ratio = ratio; - if (ratio < 1.0f) { + if (ratio < 1.0) { corr = hw_inc - 1; - val = 1.0f / (hw_inc * (1.0f - ratio)); - } else if (ratio > 1.0f) { + val = 1.0 / (hw_inc * (1.0 - ratio)); + } else if (ratio > 1.0) { corr = hw_inc + 1; - val = 1.0f / (hw_inc * (ratio - 1.0f)); + val = 1.0 / (hw_inc * (ratio - 1.0)); } else { val = 0; corr = hw_inc; diff --git a/drivers/ethernet/eth_e1000_priv.h b/drivers/ethernet/eth_e1000_priv.h index 2d0b6afa26d2..64b7497b917e 100644 --- a/drivers/ethernet/eth_e1000_priv.h +++ b/drivers/ethernet/eth_e1000_priv.h @@ -92,7 +92,7 @@ struct e1000_dev { uint8_t rxb[NET_ETH_MTU]; #if defined(CONFIG_ETH_E1000_PTP_CLOCK) const struct device *ptp_clock; - float clk_ratio; + double clk_ratio; #endif };