i2c: rcar: tidyup priv->devtype handling on rcar_i2c_probe()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 9 Sep 2024 04:42:45 +0000 (04:42 +0000)
committerAndi Shyti <andi.shyti@kernel.org>
Mon, 9 Sep 2024 22:36:49 +0000 (00:36 +0200)
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>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-rcar.c

index da4b07c0ed4c078213d6e062d5144667d0690f6d..9267df38c2d0a124e7100d0126f7927547a51d3c 100644 (file)
@@ -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);