Skip to contentSkip to conversation

i2c: i2c-stm32f7: improve loopback in timing algorithm

PATCH Applied Bich HEMON 3 participants 3 messages Mar 6, 2019 – Mar 20, 2019

Subsystems (3)
lore
Share & tools
lore

Bich HEMON

author
#0 lore raw

PATCH 1/1 i2c: i2c-stm32f7: improve loopback in timing algorithm

From: Nicolas Le Bayon <[email protected]>

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.

---
 drivers/i2c/busses/i2c-stm32f7.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/i2c/busses/i2c-stm32f7.c +4 -0
index 4284fc9..48337be 100644
@@ -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;
 		}
 	}
 
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw

Hi

Thanks

Quoted 31 lines · Bich HEMON

From: Nicolas Le Bayon <[email protected]>

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.

---
 drivers/i2c/busses/i2c-stm32f7.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/i2c/busses/i2c-stm32f7.c +4 -0
index 4284fc9..48337be 100644
@@ -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;
 		}
 	}
 
Applied
#2 lore raw
In reply to Bich HEMON
Quoted 9 lines · Bich HEMON

From: Nicolas Le Bayon <[email protected]>

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.

Applied to for-next, thanks!

Pierre-Yves, there are two binding patches for stm32 still open, if you have some time for it...