mirror of
https://xff.cz/git/u-boot/
synced 2025-09-26 21:11:18 +02:00
i2c: stm32f7_i2c: Fix warnings when compiling with W=1
This patch solves the following warnings: drivers/i2c/stm32f7_i2c.c: In function 'stm32_i2c_compute_solutions': warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (scldel < scldel_min) ^ warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (((sdadel >= sdadel_min) && ^~ warning: comparison between signed and unsigned integer expressions [-Wsign-compare] (sdadel <= sdadel_max)) && ^~ drivers/i2c/stm32f7_i2c.c: In function 'stm32_i2c_choose_solution': warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (clk_error < clk_error_prev) { ^ Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
@@ -519,13 +519,13 @@ static int stm32_i2c_compute_solutions(struct stm32_i2c_setup *setup,
|
|||||||
/* Compute possible values for PRESC, SCLDEL and SDADEL */
|
/* Compute possible values for PRESC, SCLDEL and SDADEL */
|
||||||
for (p = 0; p < STM32_PRESC_MAX; p++) {
|
for (p = 0; p < STM32_PRESC_MAX; p++) {
|
||||||
for (l = 0; l < STM32_SCLDEL_MAX; l++) {
|
for (l = 0; l < STM32_SCLDEL_MAX; l++) {
|
||||||
u32 scldel = (l + 1) * (p + 1) * i2cclk;
|
int scldel = (l + 1) * (p + 1) * i2cclk;
|
||||||
|
|
||||||
if (scldel < scldel_min)
|
if (scldel < scldel_min)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (a = 0; a < STM32_SDADEL_MAX; a++) {
|
for (a = 0; a < STM32_SDADEL_MAX; a++) {
|
||||||
u32 sdadel = (a * (p + 1) + 1) * i2cclk;
|
int sdadel = (a * (p + 1) + 1) * i2cclk;
|
||||||
|
|
||||||
if (((sdadel >= sdadel_min) &&
|
if (((sdadel >= sdadel_min) &&
|
||||||
(sdadel <= sdadel_max)) &&
|
(sdadel <= sdadel_max)) &&
|
||||||
@@ -613,10 +613,12 @@ static int stm32_i2c_choose_solution(struct stm32_i2c_setup *setup,
|
|||||||
if ((tscl >= clk_min) && (tscl <= clk_max) &&
|
if ((tscl >= clk_min) && (tscl <= clk_max) &&
|
||||||
(tscl_h >= i2c_specs[setup->speed].h_min) &&
|
(tscl_h >= i2c_specs[setup->speed].h_min) &&
|
||||||
(i2cclk < tscl_h)) {
|
(i2cclk < tscl_h)) {
|
||||||
int clk_error = tscl - i2cbus;
|
u32 clk_error;
|
||||||
|
|
||||||
if (clk_error < 0)
|
if (tscl > i2cbus)
|
||||||
clk_error = -clk_error;
|
clk_error = tscl - i2cbus;
|
||||||
|
else
|
||||||
|
clk_error = i2cbus - tscl;
|
||||||
|
|
||||||
if (clk_error < clk_error_prev) {
|
if (clk_error < clk_error_prev) {
|
||||||
clk_error_prev = clk_error;
|
clk_error_prev = clk_error;
|
||||||
|
Reference in New Issue
Block a user