All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: rcar: clean up after refactoring i2c_timings
@ 2020-03-26 10:07 Wolfram Sang
  2020-03-26 10:19 ` Geert Uytterhoeven
  2020-03-31 15:35 ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Wolfram Sang @ 2020-03-26 10:07 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-renesas-soc, Wolfram Sang

The pointer is not really needed anymore since we have the timings
struct available in the function itself now. Remove the pointer and
access the struct directly.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-rcar.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 25013641a85d..3b5397aa4ca6 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -240,15 +240,15 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv)
 	u32 scgd, cdf, round, ick, sum, scl, cdf_width;
 	unsigned long rate;
 	struct device *dev = rcar_i2c_priv_to_dev(priv);
-	struct i2c_timings i2c_t = {
+	struct i2c_timings t = {
 		.bus_freq_hz		= I2C_MAX_STANDARD_MODE_FREQ,
 		.scl_fall_ns		= 35,
 		.scl_rise_ns		= 200,
 		.scl_int_delay_ns	= 50,
-	}, *t = &i2c_t;
+	};
 
 	/* Fall back to previously used values if not supplied */
-	i2c_parse_fw_timings(dev, &i2c_t, false);
+	i2c_parse_fw_timings(dev, &t, false);
 
 	switch (priv->devtype) {
 	case I2C_RCAR_GEN1:
@@ -294,7 +294,7 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv)
 	 *  = F[sum * ick / 1000000000]
 	 *  = F[(ick / 1000000) * sum / 1000]
 	 */
-	sum = t->scl_fall_ns + t->scl_rise_ns + t->scl_int_delay_ns;
+	sum = t.scl_fall_ns + t.scl_rise_ns + t.scl_int_delay_ns;
 	round = (ick + 500000) / 1000000 * sum;
 	round = (round + 500) / 1000;
 
@@ -312,7 +312,7 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv)
 	 */
 	for (scgd = 0; scgd < 0x40; scgd++) {
 		scl = ick / (20 + (scgd * 8) + round);
-		if (scl <= t->bus_freq_hz)
+		if (scl <= t.bus_freq_hz)
 			goto scgd_find;
 	}
 	dev_err(dev, "it is impossible to calculate best SCL\n");
@@ -320,7 +320,7 @@ static int rcar_i2c_clock_calculate(struct rcar_i2c_priv *priv)
 
 scgd_find:
 	dev_dbg(dev, "clk %d/%d(%lu), round %u, CDF:0x%x, SCGD: 0x%x\n",
-		scl, t->bus_freq_hz, rate, round, cdf, scgd);
+		scl, t.bus_freq_hz, rate, round, cdf, scgd);
 
 	/* keep icccr value */
 	priv->icccr = scgd << cdf_width | cdf;
-- 
2.20.1

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

* Re: [PATCH] i2c: rcar: clean up after refactoring i2c_timings
  2020-03-26 10:07 [PATCH] i2c: rcar: clean up after refactoring i2c_timings Wolfram Sang
@ 2020-03-26 10:19 ` Geert Uytterhoeven
  2020-03-31 15:35 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2020-03-26 10:19 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Linux I2C, Linux-Renesas

On Thu, Mar 26, 2020 at 11:07 AM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> The pointer is not really needed anymore since we have the timings
> struct available in the function itself now. Remove the pointer and
> access the struct directly.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

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] 3+ messages in thread

* Re: [PATCH] i2c: rcar: clean up after refactoring i2c_timings
  2020-03-26 10:07 [PATCH] i2c: rcar: clean up after refactoring i2c_timings Wolfram Sang
  2020-03-26 10:19 ` Geert Uytterhoeven
@ 2020-03-31 15:35 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2020-03-31 15:35 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-renesas-soc

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

On Thu, Mar 26, 2020 at 11:07:21AM +0100, Wolfram Sang wrote:
> The pointer is not really needed anymore since we have the timings
> struct available in the function itself now. Remove the pointer and
> access the struct directly.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


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

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

end of thread, other threads:[~2020-03-31 15:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 10:07 [PATCH] i2c: rcar: clean up after refactoring i2c_timings Wolfram Sang
2020-03-26 10:19 ` Geert Uytterhoeven
2020-03-31 15:35 ` Wolfram Sang

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.