drivers: eth_stm32_hal: Fix compilation warnings

Promote clk_ratio_adj to double for internal calculations related to ratio
to avoid compilation warnings related to implicit conversion from float
to double.

Signed-off-by: Mateusz Hołenko <mholenko@antmicro.com>
This commit is contained in:
Mateusz Holenko 2024-01-30 18:47:31 +01:00 committed by Henrik Brix Andersen
parent f033f31728
commit 516fc76f84

View file

@ -1844,13 +1844,13 @@ static int ptp_clock_stm32_rate_adjust(const struct device *dev, double ratio)
uint32_t addend_val;
/* No change needed */
if (ratio == 1.0f) {
if (ratio == 1.0L) {
return 0;
}
key = irq_lock();
ratio *= eth_dev_data->clk_ratio_adj;
ratio *= (double)eth_dev_data->clk_ratio_adj;
/* Limit possible ratio */
if (ratio * 100 < CONFIG_ETH_STM32_HAL_PTP_CLOCK_ADJ_MIN_PCT ||
@ -1863,7 +1863,7 @@ static int ptp_clock_stm32_rate_adjust(const struct device *dev, double ratio)
eth_dev_data->clk_ratio_adj = ratio;
/* Update addend register */
addend_val = UINT32_MAX * eth_dev_data->clk_ratio * ratio;
addend_val = UINT32_MAX * (double)eth_dev_data->clk_ratio * ratio;
#if defined(CONFIG_SOC_SERIES_STM32H7X) || defined(CONFIG_SOC_SERIES_STM32H5X)
heth->Instance->MACTSAR = addend_val;