]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
i2c: qcom-cci: Move cci_init() under cci_reset() function
authorVladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Fri, 15 May 2026 23:41:20 +0000 (02:41 +0300)
committerAndi Shyti <andi.shyti@kernel.org>
Tue, 16 Jun 2026 12:39:59 +0000 (14:39 +0200)
On probe or runtime errors cci_reset() is called and it should be coupled
with cci_init(), instead of doing this on caller's side, embed cci_init()
directly into the cci_reset() function.

This is a non-functional change, cci_reset() and cci_init() function
bodies are reordered.

Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260515234121.1607425-4-vladimir.zapolskiy@linaro.org
drivers/i2c/busses/i2c-qcom-cci.c

index be41a53e30c6379f9a8aee004c21804b4aeb85a9..2d73903f14d35fd64ee7b65a3b16b2812ba96e39 100644 (file)
@@ -225,24 +225,6 @@ static int cci_halt(struct cci *cci, u8 master_num)
        return 0;
 }
 
-static int cci_reset(struct cci *cci)
-{
-       /*
-        * we reset the whole controller, here and for implicity use
-        * master[0].xxx for waiting on it.
-        */
-       reinit_completion(&cci->master[0].irq_complete);
-       writel(CCI_RESET_CMD_MASK, cci->base + CCI_RESET_CMD);
-
-       if (!wait_for_completion_timeout(&cci->master[0].irq_complete,
-                                        CCI_TIMEOUT)) {
-               dev_err(cci->dev, "CCI reset timeout\n");
-               return -ETIMEDOUT;
-       }
-
-       return 0;
-}
-
 static void cci_init(struct cci *cci)
 {
        u32 val = CCI_IRQ_MASK_0_I2C_M0_RD_DONE |
@@ -286,6 +268,26 @@ static void cci_init(struct cci *cci)
        }
 }
 
+static int cci_reset(struct cci *cci)
+{
+       /*
+        * we reset the whole controller, here and for implicity use
+        * master[0].xxx for waiting on it.
+        */
+       reinit_completion(&cci->master[0].irq_complete);
+       writel(CCI_RESET_CMD_MASK, cci->base + CCI_RESET_CMD);
+
+       if (!wait_for_completion_timeout(&cci->master[0].irq_complete,
+                                        CCI_TIMEOUT)) {
+               dev_err(cci->dev, "CCI reset timeout\n");
+               return -ETIMEDOUT;
+       }
+
+       cci_init(cci);
+
+       return 0;
+}
+
 static int cci_run_queue(struct cci *cci, u8 master, u8 queue)
 {
        u32 val;
@@ -302,7 +304,6 @@ static int cci_run_queue(struct cci *cci, u8 master, u8 queue)
                dev_err(cci->dev, "master %d queue %d timeout\n",
                        master, queue);
                cci_reset(cci);
-               cci_init(cci);
                return -ETIMEDOUT;
        }
 
@@ -609,8 +610,6 @@ static int cci_probe(struct platform_device *pdev)
        if (ret < 0)
                goto error;
 
-       cci_init(cci);
-
        pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
        pm_runtime_use_autosuspend(dev);
        pm_runtime_set_active(dev);