drivers: fix double promotion warnings

With -Wdouble-promotion added to the warning base, fix warnings given
by the compiler.

Signed-off-by: Ryan McClelland <ryanmcclelland@fb.com>
This commit is contained in:
Ryan McClelland 2021-10-03 13:53:14 -07:00 committed by Christopher Friedt
commit b7bedb5c1e
9 changed files with 45 additions and 45 deletions

View file

@ -1483,27 +1483,27 @@ static int ptp_clock_mcux_rate_adjust(const struct device *dev, float ratio)
float val;
/* No change needed. */
if (ratio == 1.0) {
if (ratio == 1.0f) {
return 0;
}
ratio *= context->clk_ratio;
/* Limit possible ratio. */
if ((ratio > 1.0 + 1.0/(2 * hw_inc)) ||
(ratio < 1.0 - 1.0/(2 * hw_inc))) {
if ((ratio > 1.0f + 1.0f/(2 * hw_inc)) ||
(ratio < 1.0f - 1.0f/(2 * hw_inc))) {
return -EINVAL;
}
/* Save new ratio. */
context->clk_ratio = ratio;
if (ratio < 1.0) {
if (ratio < 1.0f) {
corr = hw_inc - 1;
val = 1.0 / (hw_inc * (1.0 - ratio));
} else if (ratio > 1.0) {
val = 1.0f / (hw_inc * (1.0f - ratio));
} else if (ratio > 1.0f) {
corr = hw_inc + 1;
val = 1.0 / (hw_inc * (ratio-1.0));
val = 1.0f / (hw_inc * (ratio - 1.0f));
} else {
val = 0;
corr = hw_inc;