[PATCH] i2c: i2c-stm32f7: improve loopback in timing algorithm

From: Bich HEMON
Date: Wed Mar 06 2019 - 10:12:49 EST


From: Nicolas Le Bayon <nicolas.le.bayon@xxxxxx>

This avoids useless loops inside the I2C timing algorithm.
Actually, we support only one possible solution per prescaler value.
So after finding a solution with a prescaler, the algorithm can
switch directly to the next prescaler value.

Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@xxxxxx>
Signed-off-by: Bich Hemon <bich.hemon@xxxxxx>
---
drivers/i2c/busses/i2c-stm32f7.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index 4284fc9..48337be 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -476,8 +476,12 @@ static int stm32f7_i2c_compute_timing(struct stm32f7_i2c_dev *i2c_dev,

list_add_tail(&v->node,
&solutions);
+ break;
}
}
+
+ if (p_prev == p)
+ break;
}
}

--
1.9.1