Skip to content

Commit 2ee409c

Browse files
Manikanta GuntupalliAndi Shyti
authored andcommitted
i2c: xiic: Relocate xiic_i2c_runtime_suspend and xiic_i2c_runtime_resume to facilitate atomic mode
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>
1 parent f524707 commit 2ee409c

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

drivers/i2c/busses/i2c-xiic.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,29 @@ static const struct timing_regs timing_reg_values[] = {
238238
static int xiic_start_xfer(struct xiic_i2c *i2c, struct i2c_msg *msgs, int num);
239239
static void __xiic_start_xfer(struct xiic_i2c *i2c);
240240

241+
static int __maybe_unused xiic_i2c_runtime_suspend(struct device *dev)
242+
{
243+
struct xiic_i2c *i2c = dev_get_drvdata(dev);
244+
245+
clk_disable(i2c->clk);
246+
247+
return 0;
248+
}
249+
250+
static int __maybe_unused xiic_i2c_runtime_resume(struct device *dev)
251+
{
252+
struct xiic_i2c *i2c = dev_get_drvdata(dev);
253+
int ret;
254+
255+
ret = clk_enable(i2c->clk);
256+
if (ret) {
257+
dev_err(dev, "Cannot enable clock.\n");
258+
return ret;
259+
}
260+
261+
return 0;
262+
}
263+
241264
/*
242265
* For the register read and write functions, a little-endian and big-endian
243266
* version are necessary. Endianness is detected during the probe function.
@@ -1365,29 +1388,6 @@ static void xiic_i2c_remove(struct platform_device *pdev)
13651388
pm_runtime_dont_use_autosuspend(&pdev->dev);
13661389
}
13671390

1368-
static int __maybe_unused xiic_i2c_runtime_suspend(struct device *dev)
1369-
{
1370-
struct xiic_i2c *i2c = dev_get_drvdata(dev);
1371-
1372-
clk_disable(i2c->clk);
1373-
1374-
return 0;
1375-
}
1376-
1377-
static int __maybe_unused xiic_i2c_runtime_resume(struct device *dev)
1378-
{
1379-
struct xiic_i2c *i2c = dev_get_drvdata(dev);
1380-
int ret;
1381-
1382-
ret = clk_enable(i2c->clk);
1383-
if (ret) {
1384-
dev_err(dev, "Cannot enable clock.\n");
1385-
return ret;
1386-
}
1387-
1388-
return 0;
1389-
}
1390-
13911391
static const struct dev_pm_ops xiic_dev_pm_ops = {
13921392
SET_RUNTIME_PM_OPS(xiic_i2c_runtime_suspend,
13931393
xiic_i2c_runtime_resume, NULL)

0 commit comments

Comments
 (0)