2019-03-06 15:55:27

by Bich HEMON

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Nicolas Le Bayon <[email protected]>
Signed-off-by: Bich Hemon <[email protected]>
---
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


2019-03-07 10:23:45

by Pierre-Yves MORDRET

[permalink] [raw]
Subject: Re: [PATCH] i2c: i2c-stm32f7: improve loopback in timing algorithm

Hi

Reviewed-by: Pierre-Yves MORDRET <[email protected]>

Thanks

On 3/6/19 4:12 PM, Bich HEMON wrote:
> 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.
>
> Signed-off-by: Nicolas Le Bayon <[email protected]>
> Signed-off-by: Bich Hemon <[email protected]>
> ---
> 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;
> }
> }
>
>

2019-03-20 17:03:23

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH] i2c: i2c-stm32f7: improve loopback in timing algorithm

On Wed, Mar 06, 2019 at 03:12:32PM +0000, Bich HEMON wrote:
> 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.
>
> Signed-off-by: Nicolas Le Bayon <[email protected]>
> Signed-off-by: Bich Hemon <[email protected]>

Applied to for-next, thanks!

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


Attachments:
(No filename) (615.00 B)
signature.asc (849.00 B)
Download all attachments