All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: rcar: Remove superfluous call to clk_get_rate()
@ 2019-11-13 10:14 Geert Uytterhoeven
  2019-11-13 10:52 ` Luca Ceresoli
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2019-11-13 10:14 UTC (permalink / raw)
  To: Wolfram Sang, Guennadi Liakhovetski
  Cc: linux-i2c, linux-renesas-soc, Geert Uytterhoeven

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(-)

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


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

* Re: [PATCH] i2c: rcar: Remove superfluous call to clk_get_rate()
  2019-11-13 10:14 [PATCH] i2c: rcar: Remove superfluous call to clk_get_rate() Geert Uytterhoeven
@ 2019-11-13 10:52 ` Luca Ceresoli
  2019-11-14  7:31 ` Niklas Söderlund
  2019-11-14 20:39 ` Wolfram Sang
  2 siblings, 0 replies; 5+ messages in thread
From: Luca Ceresoli @ 2019-11-13 10:52 UTC (permalink / raw)
  To: Geert Uytterhoeven, Wolfram Sang, Guennadi Liakhovetski
  Cc: linux-i2c, linux-renesas-soc

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>

-- 
Luca

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

* Re: [PATCH] i2c: rcar: Remove superfluous call to clk_get_rate()
  2019-11-13 10:14 [PATCH] i2c: rcar: Remove superfluous call to clk_get_rate() Geert Uytterhoeven
  2019-11-13 10:52 ` Luca Ceresoli
@ 2019-11-14  7:31 ` Niklas Söderlund
  2019-11-14 20:39 ` Wolfram Sang
  2 siblings, 0 replies; 5+ messages in thread
From: Niklas Söderlund @ 2019-11-14  7:31 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfram Sang, Guennadi Liakhovetski, linux-i2c, linux-renesas-soc

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
> 

-- 
Regards,
Niklas Söderlund

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

* Re: [PATCH] i2c: rcar: Remove superfluous call to clk_get_rate()
  2019-11-13 10:14 [PATCH] i2c: rcar: Remove superfluous call to clk_get_rate() Geert Uytterhoeven
  2019-11-13 10:52 ` Luca Ceresoli
  2019-11-14  7:31 ` Niklas Söderlund
@ 2019-11-14 20:39 ` Wolfram Sang
  2019-11-15  7:53   ` Geert Uytterhoeven
  2 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2019-11-14 20:39 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Guennadi Liakhovetski, linux-i2c, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 465 bytes --]

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.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] i2c: rcar: Remove superfluous call to clk_get_rate()
  2019-11-14 20:39 ` Wolfram Sang
@ 2019-11-15  7:53   ` Geert Uytterhoeven
  0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2019-11-15  7:53 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Geert Uytterhoeven, Guennadi Liakhovetski, Linux I2C, Linux-Renesas

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

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2019-11-15  7:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 10:14 [PATCH] i2c: rcar: Remove superfluous call to clk_get_rate() Geert Uytterhoeven
2019-11-13 10:52 ` Luca Ceresoli
2019-11-14  7:31 ` Niklas Söderlund
2019-11-14 20:39 ` Wolfram Sang
2019-11-15  7:53   ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.