]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i2c: xiic: Relocate xiic_i2c_runtime_suspend and xiic_i2c_runtime_resume to facilitat...
authorManikanta Guntupalli <manikanta.guntupalli@amd.com>
Tue, 10 Dec 2024 09:52:41 +0000 (15:22 +0530)
committerAndi Shyti <andi.shyti@kernel.org>
Tue, 7 Jan 2025 22:46:10 +0000 (23:46 +0100)
Relocate xiic_i2c_runtime_suspend and xiic_i2c_runtime_resume functions
to avoid prototype statements in atomic mode changes.

Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@amd.com>
Acked-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20241210095242.1982770-2-manikanta.guntupalli@amd.com
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-xiic.c

index c4d3eb02da09f454377df5ef03e38381aa541207..f48e73f905e5d286d222fac99f6c3e5b5275643a 100644 (file)
@@ -238,6 +238,29 @@ static const struct timing_regs timing_reg_values[] = {
 static int xiic_start_xfer(struct xiic_i2c *i2c, struct i2c_msg *msgs, int num);
 static void __xiic_start_xfer(struct xiic_i2c *i2c);
 
+static int __maybe_unused xiic_i2c_runtime_suspend(struct device *dev)
+{
+       struct xiic_i2c *i2c = dev_get_drvdata(dev);
+
+       clk_disable(i2c->clk);
+
+       return 0;
+}
+
+static int __maybe_unused xiic_i2c_runtime_resume(struct device *dev)
+{
+       struct xiic_i2c *i2c = dev_get_drvdata(dev);
+       int ret;
+
+       ret = clk_enable(i2c->clk);
+       if (ret) {
+               dev_err(dev, "Cannot enable clock.\n");
+               return ret;
+       }
+
+       return 0;
+}
+
 /*
  * For the register read and write functions, a little-endian and big-endian
  * version are necessary. Endianness is detected during the probe function.
@@ -1365,29 +1388,6 @@ static void xiic_i2c_remove(struct platform_device *pdev)
        pm_runtime_dont_use_autosuspend(&pdev->dev);
 }
 
-static int __maybe_unused xiic_i2c_runtime_suspend(struct device *dev)
-{
-       struct xiic_i2c *i2c = dev_get_drvdata(dev);
-
-       clk_disable(i2c->clk);
-
-       return 0;
-}
-
-static int __maybe_unused xiic_i2c_runtime_resume(struct device *dev)
-{
-       struct xiic_i2c *i2c = dev_get_drvdata(dev);
-       int ret;
-
-       ret = clk_enable(i2c->clk);
-       if (ret) {
-               dev_err(dev, "Cannot enable clock.\n");
-               return ret;
-       }
-
-       return 0;
-}
-
 static const struct dev_pm_ops xiic_dev_pm_ops = {
        SET_RUNTIME_PM_OPS(xiic_i2c_runtime_suspend,
                           xiic_i2c_runtime_resume, NULL)