diff mbox series

i2c: rcar: Remove superfluous call to clk_get_rate()

Message ID 20191113101453.28157-1-geert+renesas@glider.be
State Accepted
Headers show
Series i2c: rcar: Remove superfluous call to clk_get_rate() | expand

Commit Message

Geert Uytterhoeven Nov. 13, 2019, 10:14 a.m. UTC
Variable "rate" already contains the current clock rate, so use that
rather than calling clk_get_rate() again.

Fixes: 8d0494037bb2af32 ("i2c: rcar: get clock rate only once and simplify calculation")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/i2c/busses/i2c-rcar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Luca Ceresoli Nov. 13, 2019, 10:52 a.m. UTC | #1
Hi Geert,

On 13/11/19 11:14, Geert Uytterhoeven wrote:
> Variable "rate" already contains the current clock rate, so use that
> rather than calling clk_get_rate() again.
> 
> Fixes: 8d0494037bb2af32 ("i2c: rcar: get clock rate only once and simplify calculation")

Not sure this should be considered a fix. The code is not broken, it's
only non-optimal.

But anyway, with or without the "Fixes" line:

Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>
Niklas Söderlund Nov. 14, 2019, 7:31 a.m. UTC | #2
Hi Geert,

Thanks for your work.

On 2019-11-13 11:14:53 +0100, Geert Uytterhoeven wrote:
> Variable "rate" already contains the current clock rate, so use that
> rather than calling clk_get_rate() again.
> 
> Fixes: 8d0494037bb2af32 ("i2c: rcar: get clock rate only once and simplify calculation")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  drivers/i2c/busses/i2c-rcar.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 531c01100b560be3..879f0e61a4968a08 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -317,7 +317,7 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv, struct i2c_timin
>  
>  scgd_find:
>  	dev_dbg(dev, "clk %d/%d(%lu), round %u, CDF:0x%x, SCGD: 0x%x\n",
> -		scl, t->bus_freq_hz, clk_get_rate(priv->clk), round, cdf, scgd);
> +		scl, t->bus_freq_hz, rate, round, cdf, scgd);
>  
>  	/* keep icccr value */
>  	priv->icccr = scgd << cdf_width | cdf;
> -- 
> 2.17.1
>
Wolfram Sang Nov. 14, 2019, 8:39 p.m. UTC | #3
On Wed, Nov 13, 2019 at 11:14:53AM +0100, Geert Uytterhoeven wrote:
> Variable "rate" already contains the current clock rate, so use that
> rather than calling clk_get_rate() again.
> 
> Fixes: 8d0494037bb2af32 ("i2c: rcar: get clock rate only once and simplify calculation")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Applied to for-next, thanks! I agree with Luca, though, and dropped the
Fixes: line because this is not a bugfix.
Geert Uytterhoeven Nov. 15, 2019, 7:53 a.m. UTC | #4
Hi Wolfram,

On Thu, Nov 14, 2019 at 9:39 PM Wolfram Sang <wsa@the-dreams.de> wrote:
> On Wed, Nov 13, 2019 at 11:14:53AM +0100, Geert Uytterhoeven wrote:
> > Variable "rate" already contains the current clock rate, so use that
> > rather than calling clk_get_rate() again.
> >
> > Fixes: 8d0494037bb2af32 ("i2c: rcar: get clock rate only once and simplify calculation")
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> Applied to for-next, thanks! I agree with Luca, though, and dropped the
> Fixes: line because this is not a bugfix.

OK, thanks!

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 531c01100b560be3..879f0e61a4968a08 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -317,7 +317,7 @@  static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv, struct i2c_timin
 
 scgd_find:
 	dev_dbg(dev, "clk %d/%d(%lu), round %u, CDF:0x%x, SCGD: 0x%x\n",
-		scl, t->bus_freq_hz, clk_get_rate(priv->clk), round, cdf, scgd);
+		scl, t->bus_freq_hz, rate, round, cdf, scgd);
 
 	/* keep icccr value */
 	priv->icccr = scgd << cdf_width | cdf;