Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

I2C: Rework i2c-pxa suspend_late()/resume_early()

This patch reworks platform driver power management code
for i2c-pxa from legacy late/early callbacks to dev_pm_ops.

The callbacks are converted for CONFIG_SUSPEND like this:
suspend_late() -> suspend_noirq()
resume_early() -> resume_noirq()

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

authored by

Magnus Damm and committed by
Rafael J. Wysocki
57f4d4f1 4aebac2f

+17 -8
+17 -8
drivers/i2c/busses/i2c-pxa.c
··· 1134 1134 } 1135 1135 1136 1136 #ifdef CONFIG_PM 1137 - static int i2c_pxa_suspend_late(struct platform_device *dev, pm_message_t state) 1137 + static int i2c_pxa_suspend_noirq(struct device *dev) 1138 1138 { 1139 - struct pxa_i2c *i2c = platform_get_drvdata(dev); 1139 + struct platform_device *pdev = to_platform_device(dev); 1140 + struct pxa_i2c *i2c = platform_get_drvdata(pdev); 1141 + 1140 1142 clk_disable(i2c->clk); 1143 + 1141 1144 return 0; 1142 1145 } 1143 1146 1144 - static int i2c_pxa_resume_early(struct platform_device *dev) 1147 + static int i2c_pxa_resume_noirq(struct device *dev) 1145 1148 { 1146 - struct pxa_i2c *i2c = platform_get_drvdata(dev); 1149 + struct platform_device *pdev = to_platform_device(dev); 1150 + struct pxa_i2c *i2c = platform_get_drvdata(pdev); 1147 1151 1148 1152 clk_enable(i2c->clk); 1149 1153 i2c_pxa_reset(i2c); 1150 1154 1151 1155 return 0; 1152 1156 } 1157 + 1158 + static struct dev_pm_ops i2c_pxa_dev_pm_ops = { 1159 + .suspend_noirq = i2c_pxa_suspend_noirq, 1160 + .resume_noirq = i2c_pxa_resume_noirq, 1161 + }; 1162 + 1163 + #define I2C_PXA_DEV_PM_OPS (&i2c_pxa_dev_pm_ops) 1153 1164 #else 1154 - #define i2c_pxa_suspend_late NULL 1155 - #define i2c_pxa_resume_early NULL 1165 + #define I2C_PXA_DEV_PM_OPS NULL 1156 1166 #endif 1157 1167 1158 1168 static struct platform_driver i2c_pxa_driver = { 1159 1169 .probe = i2c_pxa_probe, 1160 1170 .remove = __exit_p(i2c_pxa_remove), 1161 - .suspend_late = i2c_pxa_suspend_late, 1162 - .resume_early = i2c_pxa_resume_early, 1163 1171 .driver = { 1164 1172 .name = "pxa2xx-i2c", 1165 1173 .owner = THIS_MODULE, 1174 + .pm = I2C_PXA_DEV_PM_OPS, 1166 1175 }, 1167 1176 .id_table = i2c_pxa_id_table, 1168 1177 };