diff mbox series

[v3] i2c: rcar: tidyup priv->devtype handling on rcar_i2c_probe()

Message ID 87a5ghsaii.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State Accepted
Delegated to: Geert Uytterhoeven
Headers show
Series [v3] i2c: rcar: tidyup priv->devtype handling on rcar_i2c_probe() | expand

Commit Message

Kuninori Morimoto Sept. 9, 2024, 4:42 a.m. UTC
rcar_i2c_probe() has priv->devtype operation, but handling (A) and (C)
in same place is more understandable ( (A) and (B) are independent).

(A)	if (priv->devtype < I2C_RCAR_GEN3) {
		...
	}

(B)	...

(C)	if (priv->devtype >= I2C_RCAR_GEN3) {
		...
	}

Let's merge it with if-else

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v2 -> v3
	- based on latest linux-next/master branch
	- add Reviewed-by from Wolfram

 drivers/i2c/busses/i2c-rcar.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Andi Shyti Sept. 9, 2024, 6:51 p.m. UTC | #1
Hi Kuninori,

On Mon, Sep 09, 2024 at 04:42:45AM GMT, Kuninori Morimoto wrote:
> rcar_i2c_probe() has priv->devtype operation, but handling (A) and (C)
> in same place is more understandable ( (A) and (B) are independent).
> 
> (A)	if (priv->devtype < I2C_RCAR_GEN3) {
> 		...
> 	}
> 
> (B)	...
> 
> (C)	if (priv->devtype >= I2C_RCAR_GEN3) {
> 		...
> 	}
> 
> Let's merge it with if-else
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Merged to i2c/i2c-host.

Thanks,
Andi
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index da4b07c0ed4c..9267df38c2d0 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -1164,11 +1164,6 @@  static int rcar_i2c_probe(struct platform_device *pdev)
 	rcar_i2c_init(priv);
 	rcar_i2c_reset_slave(priv);
 
-	if (priv->devtype < I2C_RCAR_GEN3) {
-		irqflags |= IRQF_NO_THREAD;
-		irqhandler = rcar_i2c_gen2_irq;
-	}
-
 	/* Stay always active when multi-master to keep arbitration working */
 	if (of_property_read_bool(dev->of_node, "multi-master"))
 		priv->flags |= ID_P_PM_BLOCKED;
@@ -1178,8 +1173,11 @@  static int rcar_i2c_probe(struct platform_device *pdev)
 	if (of_property_read_bool(dev->of_node, "smbus"))
 		priv->flags |= ID_P_HOST_NOTIFY;
 
-	/* R-Car Gen3+ needs a reset before every transfer */
-	if (priv->devtype >= I2C_RCAR_GEN3) {
+	if (priv->devtype < I2C_RCAR_GEN3) {
+		irqflags |= IRQF_NO_THREAD;
+		irqhandler = rcar_i2c_gen2_irq;
+	} else {
+		/* R-Car Gen3+ needs a reset before every transfer */
 		priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
 		if (IS_ERR(priv->rstc)) {
 			ret = PTR_ERR(priv->rstc);