From: Nicolas Le Bayon Date: Thu, 18 Apr 2019 15:32:43 +0000 (+0200) Subject: i2c: stm32f7: improve loopback in timing algorithm X-Git-Tag: v2019.07-rc3~8^2~17 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5237f37e5c35052533588fe0a53febad2f047d70;p=oweals%2Fu-boot.git i2c: stm32f7: improve loopback in timing algorithm 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 Reviewed-by: Patrick DELAUNAY Signed-off-by: Patrick Delaunay --- diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c index e7e0268ebe..50c4fd0de2 100644 --- a/drivers/i2c/stm32f7_i2c.c +++ b/drivers/i2c/stm32f7_i2c.c @@ -540,8 +540,12 @@ static int stm32_i2c_compute_solutions(struct stm32_i2c_setup *setup, p_prev = p; list_add_tail(&v->node, solutions); + break; } } + + if (p_prev == p) + break; } }