devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: i2c-stm32f7: improve loopback in timing algorithm
@ 2019-03-06 15:12 Bich HEMON
  2019-03-07 10:22 ` Pierre Yves MORDRET
  2019-03-20 17:00 ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Bich HEMON @ 2019-03-06 15:12 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre TORGUE,
	Pierre Yves MORDRET, Wolfram Sang, linux-i2c@vger.kernel.org,
	devicetree@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
  Cc: Bich HEMON

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

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@st.com>
Signed-off-by: Bich Hemon <bich.hemon@st.com>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-20 17:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-06 15:12 [PATCH] i2c: i2c-stm32f7: improve loopback in timing algorithm Bich HEMON
2019-03-07 10:22 ` Pierre Yves MORDRET
2019-03-20 17:00 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).