aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/include/asm/device.h3
-rw-r--r--arch/arm/plat-omap/debug-leds.c11
-rw-r--r--arch/arm/plat-omap/gpio.c14
-rw-r--r--arch/ia64/include/asm/device.h3
-rw-r--r--arch/microblaze/include/asm/device.h3
-rw-r--r--arch/powerpc/include/asm/device.h3
-rw-r--r--arch/sparc/include/asm/device.h3
-rw-r--r--arch/x86/include/asm/device.h3
-rw-r--r--drivers/base/platform.c38
-rw-r--r--drivers/base/power/main.c8
-rw-r--r--drivers/dma/dw_dmac.c15
-rw-r--r--drivers/dma/txx9dmac.c15
-rw-r--r--drivers/i2c/busses/i2c-pxa.c25
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c25
-rw-r--r--drivers/pci/pci-driver.c16
-rw-r--r--drivers/usb/musb/musb_core.c18
-rw-r--r--include/asm-generic/device.h3
-rw-r--r--include/linux/device.h9
-rw-r--r--include/linux/platform_device.h5
19 files changed, 125 insertions, 95 deletions
diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h
index c61642b40603..9f390ce335cb 100644
--- a/arch/arm/include/asm/device.h
+++ b/arch/arm/include/asm/device.h
@@ -12,4 +12,7 @@ struct dev_archdata {
12#endif 12#endif
13}; 13};
14 14
15struct pdev_archdata {
16};
17
15#endif 18#endif
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index be4eefda4767..9395898dd49a 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -281,24 +281,27 @@ static int /* __init */ fpga_probe(struct platform_device *pdev)
281 return 0; 281 return 0;
282} 282}
283 283
284static int fpga_suspend_late(struct platform_device *pdev, pm_message_t mesg) 284static int fpga_suspend_noirq(struct device *dev)
285{ 285{
286 __raw_writew(~0, &fpga->leds); 286 __raw_writew(~0, &fpga->leds);
287 return 0; 287 return 0;
288} 288}
289 289
290static int fpga_resume_early(struct platform_device *pdev) 290static int fpga_resume_noirq(struct device *dev)
291{ 291{
292 __raw_writew(~hw_led_state, &fpga->leds); 292 __raw_writew(~hw_led_state, &fpga->leds);
293 return 0; 293 return 0;
294} 294}
295 295
296static struct dev_pm_ops fpga_dev_pm_ops = {
297 .suspend_noirq = fpga_suspend_noirq,
298 .resume_noirq = fpga_resume_noirq,
299};
296 300
297static struct platform_driver led_driver = { 301static struct platform_driver led_driver = {
298 .driver.name = "omap_dbg_led", 302 .driver.name = "omap_dbg_led",
303 .driver.pm = &fpga_dev_pm_ops,
299 .probe = fpga_probe, 304 .probe = fpga_probe,
300 .suspend_late = fpga_suspend_late,
301 .resume_early = fpga_resume_early,
302}; 305};
303 306
304static int __init fpga_init(void) 307static int __init fpga_init(void)
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 26b387c12423..3d03337ad422 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -1264,8 +1264,9 @@ static struct irq_chip mpuio_irq_chip = {
1264 1264
1265#include <linux/platform_device.h> 1265#include <linux/platform_device.h>
1266 1266
1267static int omap_mpuio_suspend_late(struct platform_device *pdev, pm_message_t mesg) 1267static int omap_mpuio_suspend_noirq(struct device *dev)
1268{ 1268{
1269 struct platform_device *pdev = to_platform_device(dev);
1269 struct gpio_bank *bank = platform_get_drvdata(pdev); 1270 struct gpio_bank *bank = platform_get_drvdata(pdev);
1270 void __iomem *mask_reg = bank->base + OMAP_MPUIO_GPIO_MASKIT; 1271 void __iomem *mask_reg = bank->base + OMAP_MPUIO_GPIO_MASKIT;
1271 unsigned long flags; 1272 unsigned long flags;
@@ -1278,8 +1279,9 @@ static int omap_mpuio_suspend_late(struct platform_device *pdev, pm_message_t me
1278 return 0; 1279 return 0;
1279} 1280}
1280 1281
1281static int omap_mpuio_resume_early(struct platform_device *pdev) 1282static int omap_mpuio_resume_noirq(struct device *dev)
1282{ 1283{
1284 struct platform_device *pdev = to_platform_device(dev);
1283 struct gpio_bank *bank = platform_get_drvdata(pdev); 1285 struct gpio_bank *bank = platform_get_drvdata(pdev);
1284 void __iomem *mask_reg = bank->base + OMAP_MPUIO_GPIO_MASKIT; 1286 void __iomem *mask_reg = bank->base + OMAP_MPUIO_GPIO_MASKIT;
1285 unsigned long flags; 1287 unsigned long flags;
@@ -1291,14 +1293,18 @@ static int omap_mpuio_resume_early(struct platform_device *pdev)
1291 return 0; 1293 return 0;
1292} 1294}
1293 1295
1296static struct dev_pm_ops omap_mpuio_dev_pm_ops = {
1297 .suspend_noirq = omap_mpuio_suspend_noirq,
1298 .resume_noirq = omap_mpuio_resume_noirq,
1299};
1300
1294/* use platform_driver for this, now that there's no longer any 1301/* use platform_driver for this, now that there's no longer any
1295 * point to sys_device (other than not disturbing old code). 1302 * point to sys_device (other than not disturbing old code).
1296 */ 1303 */
1297static struct platform_driver omap_mpuio_driver = { 1304static struct platform_driver omap_mpuio_driver = {
1298 .suspend_late = omap_mpuio_suspend_late,
1299 .resume_early = omap_mpuio_resume_early,
1300 .driver = { 1305 .driver = {
1301 .name = "mpuio", 1306 .name = "mpuio",
1307 .pm = &omap_mpuio_dev_pm_ops,
1302 }, 1308 },
1303}; 1309};
1304 1310
diff --git a/arch/ia64/include/asm/device.h b/arch/ia64/include/asm/device.h
index 41ab85d66f33..d66d446b127c 100644
--- a/arch/ia64/include/asm/device.h
+++ b/arch/ia64/include/asm/device.h
@@ -15,4 +15,7 @@ struct dev_archdata {
15#endif 15#endif
16}; 16};
17 17
18struct pdev_archdata {
19};
20
18#endif /* _ASM_IA64_DEVICE_H */ 21#endif /* _ASM_IA64_DEVICE_H */
diff --git a/arch/microblaze/include/asm/device.h b/arch/microblaze/include/asm/device.h
index c042830793ed..30286db27c1c 100644
--- a/arch/microblaze/include/asm/device.h
+++ b/arch/microblaze/include/asm/device.h
@@ -16,6 +16,9 @@ struct dev_archdata {
16 struct device_node *of_node; 16 struct device_node *of_node;
17}; 17};
18 18
19struct pdev_archdata {
20};
21
19#endif /* _ASM_MICROBLAZE_DEVICE_H */ 22#endif /* _ASM_MICROBLAZE_DEVICE_H */
20 23
21 24
diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
index 7d2277cef09a..e3e06e0f7fc0 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -30,4 +30,7 @@ dev_archdata_get_node(const struct dev_archdata *ad)
30 return ad->of_node; 30 return ad->of_node;
31} 31}
32 32
33struct pdev_archdata {
34};
35
33#endif /* _ASM_POWERPC_DEVICE_H */ 36#endif /* _ASM_POWERPC_DEVICE_H */
diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h
index 3702e087df2c..f3b85b6b0b76 100644
--- a/arch/sparc/include/asm/device.h
+++ b/arch/sparc/include/asm/device.h
@@ -32,4 +32,7 @@ dev_archdata_get_node(const struct dev_archdata *ad)
32 return ad->prom_node; 32 return ad->prom_node;
33} 33}
34 34
35struct pdev_archdata {
36};
37
35#endif /* _ASM_SPARC_DEVICE_H */ 38#endif /* _ASM_SPARC_DEVICE_H */
diff --git a/arch/x86/include/asm/device.h b/arch/x86/include/asm/device.h
index 4994a20acbcb..cee34e9ca45b 100644
--- a/arch/x86/include/asm/device.h
+++ b/arch/x86/include/asm/device.h
@@ -13,4 +13,7 @@ struct dma_map_ops *dma_ops;
13#endif 13#endif
14}; 14};
15 15
16struct pdev_archdata {
17};
18
16#endif /* _ASM_X86_DEVICE_H */ 19#endif /* _ASM_X86_DEVICE_H */
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 81cb01bfc356..ae5c4aa6d269 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -628,30 +628,6 @@ static int platform_legacy_suspend(struct device *dev, pm_message_t mesg)
628 return ret; 628 return ret;
629} 629}
630 630
631static int platform_legacy_suspend_late(struct device *dev, pm_message_t mesg)
632{
633 struct platform_driver *pdrv = to_platform_driver(dev->driver);
634 struct platform_device *pdev = to_platform_device(dev);
635 int ret = 0;
636
637 if (dev->driver && pdrv->suspend_late)
638 ret = pdrv->suspend_late(pdev, mesg);
639
640 return ret;
641}
642
643static int platform_legacy_resume_early(struct device *dev)
644{
645 struct platform_driver *pdrv = to_platform_driver(dev->driver);
646 struct platform_device *pdev = to_platform_device(dev);
647 int ret = 0;
648
649 if (dev->driver && pdrv->resume_early)
650 ret = pdrv->resume_early(pdev);
651
652 return ret;
653}
654
655static int platform_legacy_resume(struct device *dev) 631static int platform_legacy_resume(struct device *dev)
656{ 632{
657 struct platform_driver *pdrv = to_platform_driver(dev->driver); 633 struct platform_driver *pdrv = to_platform_driver(dev->driver);
@@ -714,8 +690,6 @@ static int platform_pm_suspend_noirq(struct device *dev)
714 if (drv->pm) { 690 if (drv->pm) {
715 if (drv->pm->suspend_noirq) 691 if (drv->pm->suspend_noirq)
716 ret = drv->pm->suspend_noirq(dev); 692 ret = drv->pm->suspend_noirq(dev);
717 } else {
718 ret = platform_legacy_suspend_late(dev, PMSG_SUSPEND);
719 } 693 }
720 694
721 return ret; 695 return ret;
@@ -750,8 +724,6 @@ static int platform_pm_resume_noirq(struct device *dev)
750 if (drv->pm) { 724 if (drv->pm) {
751 if (drv->pm->resume_noirq) 725 if (drv->pm->resume_noirq)
752 ret = drv->pm->resume_noirq(dev); 726 ret = drv->pm->resume_noirq(dev);
753 } else {
754 ret = platform_legacy_resume_early(dev);
755 } 727 }
756 728
757 return ret; 729 return ret;
@@ -797,8 +769,6 @@ static int platform_pm_freeze_noirq(struct device *dev)
797 if (drv->pm) { 769 if (drv->pm) {
798 if (drv->pm->freeze_noirq) 770 if (drv->pm->freeze_noirq)
799 ret = drv->pm->freeze_noirq(dev); 771 ret = drv->pm->freeze_noirq(dev);
800 } else {
801 ret = platform_legacy_suspend_late(dev, PMSG_FREEZE);
802 } 772 }
803 773
804 return ret; 774 return ret;
@@ -833,8 +803,6 @@ static int platform_pm_thaw_noirq(struct device *dev)
833 if (drv->pm) { 803 if (drv->pm) {
834 if (drv->pm->thaw_noirq) 804 if (drv->pm->thaw_noirq)
835 ret = drv->pm->thaw_noirq(dev); 805 ret = drv->pm->thaw_noirq(dev);
836 } else {
837 ret = platform_legacy_resume_early(dev);
838 } 806 }
839 807
840 return ret; 808 return ret;
@@ -869,8 +837,6 @@ static int platform_pm_poweroff_noirq(struct device *dev)
869 if (drv->pm) { 837 if (drv->pm) {
870 if (drv->pm->poweroff_noirq) 838 if (drv->pm->poweroff_noirq)
871 ret = drv->pm->poweroff_noirq(dev); 839 ret = drv->pm->poweroff_noirq(dev);
872 } else {
873 ret = platform_legacy_suspend_late(dev, PMSG_HIBERNATE);
874 } 840 }
875 841
876 return ret; 842 return ret;
@@ -905,8 +871,6 @@ static int platform_pm_restore_noirq(struct device *dev)
905 if (drv->pm) { 871 if (drv->pm) {
906 if (drv->pm->restore_noirq) 872 if (drv->pm->restore_noirq)
907 ret = drv->pm->restore_noirq(dev); 873 ret = drv->pm->restore_noirq(dev);
908 } else {
909 ret = platform_legacy_resume_early(dev);
910 } 874 }
911 875
912 return ret; 876 return ret;
@@ -925,7 +889,7 @@ static int platform_pm_restore_noirq(struct device *dev)
925 889
926#endif /* !CONFIG_HIBERNATION */ 890#endif /* !CONFIG_HIBERNATION */
927 891
928static struct dev_pm_ops platform_dev_pm_ops = { 892static const struct dev_pm_ops platform_dev_pm_ops = {
929 .prepare = platform_pm_prepare, 893 .prepare = platform_pm_prepare,
930 .complete = platform_pm_complete, 894 .complete = platform_pm_complete,
931 .suspend = platform_pm_suspend, 895 .suspend = platform_pm_suspend,
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 58a3e572f2c9..1b1a786b7dec 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -157,8 +157,9 @@ void device_pm_move_last(struct device *dev)
157 * @ops: PM operations to choose from. 157 * @ops: PM operations to choose from.
158 * @state: PM transition of the system being carried out. 158 * @state: PM transition of the system being carried out.
159 */ 159 */
160static int pm_op(struct device *dev, struct dev_pm_ops *ops, 160static int pm_op(struct device *dev,
161 pm_message_t state) 161 const struct dev_pm_ops *ops,
162 pm_message_t state)
162{ 163{
163 int error = 0; 164 int error = 0;
164 165
@@ -220,7 +221,8 @@ static int pm_op(struct device *dev, struct dev_pm_ops *ops,
220 * The operation is executed with interrupts disabled by the only remaining 221 * The operation is executed with interrupts disabled by the only remaining
221 * functional CPU in the system. 222 * functional CPU in the system.
222 */ 223 */
223static int pm_noirq_op(struct device *dev, struct dev_pm_ops *ops, 224static int pm_noirq_op(struct device *dev,
225 const struct dev_pm_ops *ops,
224 pm_message_t state) 226 pm_message_t state)
225{ 227{
226 int error = 0; 228 int error = 0;
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 98c9a847bf51..933c143b6a74 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1399,8 +1399,9 @@ static void dw_shutdown(struct platform_device *pdev)
1399 clk_disable(dw->clk); 1399 clk_disable(dw->clk);
1400} 1400}
1401 1401
1402static int dw_suspend_late(struct platform_device *pdev, pm_message_t mesg) 1402static int dw_suspend_noirq(struct device *dev)
1403{ 1403{
1404 struct platform_device *pdev = to_platform_device(dev);
1404 struct dw_dma *dw = platform_get_drvdata(pdev); 1405 struct dw_dma *dw = platform_get_drvdata(pdev);
1405 1406
1406 dw_dma_off(platform_get_drvdata(pdev)); 1407 dw_dma_off(platform_get_drvdata(pdev));
@@ -1408,23 +1409,27 @@ static int dw_suspend_late(struct platform_device *pdev, pm_message_t mesg)
1408 return 0; 1409 return 0;
1409} 1410}
1410 1411
1411static int dw_resume_early(struct platform_device *pdev) 1412static int dw_resume_noirq(struct device *dev)
1412{ 1413{
1414 struct platform_device *pdev = to_platform_device(dev);
1413 struct dw_dma *dw = platform_get_drvdata(pdev); 1415 struct dw_dma *dw = platform_get_drvdata(pdev);
1414 1416
1415 clk_enable(dw->clk); 1417 clk_enable(dw->clk);
1416 dma_writel(dw, CFG, DW_CFG_DMA_EN); 1418 dma_writel(dw, CFG, DW_CFG_DMA_EN);
1417 return 0; 1419 return 0;
1418
1419} 1420}
1420 1421
1422static struct dev_pm_ops dw_dev_pm_ops = {
1423 .suspend_noirq = dw_suspend_noirq,
1424 .resume_noirq = dw_resume_noirq,
1425};
1426
1421static struct platform_driver dw_driver = { 1427static struct platform_driver dw_driver = {
1422 .remove = __exit_p(dw_remove), 1428 .remove = __exit_p(dw_remove),
1423 .shutdown = dw_shutdown, 1429 .shutdown = dw_shutdown,
1424 .suspend_late = dw_suspend_late,
1425 .resume_early = dw_resume_early,
1426 .driver = { 1430 .driver = {
1427 .name = "dw_dmac", 1431 .name = "dw_dmac",
1432 .pm = &dw_dev_pm_ops,
1428 }, 1433 },
1429}; 1434};
1430 1435
diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c
index 88dab52926f4..7837930146a4 100644
--- a/drivers/dma/txx9dmac.c
+++ b/drivers/dma/txx9dmac.c
@@ -1291,17 +1291,18 @@ static void txx9dmac_shutdown(struct platform_device *pdev)
1291 txx9dmac_off(ddev); 1291 txx9dmac_off(ddev);
1292} 1292}
1293 1293
1294static int txx9dmac_suspend_late(struct platform_device *pdev, 1294static int txx9dmac_suspend_noirq(struct device *dev)
1295 pm_message_t mesg)
1296{ 1295{
1296 struct platform_device *pdev = to_platform_device(dev);
1297 struct txx9dmac_dev *ddev = platform_get_drvdata(pdev); 1297 struct txx9dmac_dev *ddev = platform_get_drvdata(pdev);
1298 1298
1299 txx9dmac_off(ddev); 1299 txx9dmac_off(ddev);
1300 return 0; 1300 return 0;
1301} 1301}
1302 1302
1303static int txx9dmac_resume_early(struct platform_device *pdev) 1303static int txx9dmac_resume_noirq(struct device *dev)
1304{ 1304{
1305 struct platform_device *pdev = to_platform_device(dev);
1305 struct txx9dmac_dev *ddev = platform_get_drvdata(pdev); 1306 struct txx9dmac_dev *ddev = platform_get_drvdata(pdev);
1306 struct txx9dmac_platform_data *pdata = pdev->dev.platform_data; 1307 struct txx9dmac_platform_data *pdata = pdev->dev.platform_data;
1307 u32 mcr; 1308 u32 mcr;
@@ -1314,6 +1315,11 @@ static int txx9dmac_resume_early(struct platform_device *pdev)
1314 1315
1315} 1316}
1316 1317
1318static struct dev_pm_ops txx9dmac_dev_pm_ops = {
1319 .suspend_noirq = txx9dmac_suspend_noirq,
1320 .resume_noirq = txx9dmac_resume_noirq,
1321};
1322
1317static struct platform_driver txx9dmac_chan_driver = { 1323static struct platform_driver txx9dmac_chan_driver = {
1318 .remove = __exit_p(txx9dmac_chan_remove), 1324 .remove = __exit_p(txx9dmac_chan_remove),
1319 .driver = { 1325 .driver = {
@@ -1324,10 +1330,9 @@ static struct platform_driver txx9dmac_chan_driver = {
1324static struct platform_driver txx9dmac_driver = { 1330static struct platform_driver txx9dmac_driver = {
1325 .remove = __exit_p(txx9dmac_remove), 1331 .remove = __exit_p(txx9dmac_remove),
1326 .shutdown = txx9dmac_shutdown, 1332 .shutdown = txx9dmac_shutdown,
1327 .suspend_late = txx9dmac_suspend_late,
1328 .resume_early = txx9dmac_resume_early,
1329 .driver = { 1333 .driver = {
1330 .name = "txx9dmac", 1334 .name = "txx9dmac",
1335 .pm = &txx9dmac_dev_pm_ops,
1331 }, 1336 },
1332}; 1337};
1333 1338
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 762e1e530882..049555777f67 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1134,35 +1134,44 @@ static int __exit i2c_pxa_remove(struct platform_device *dev)
1134} 1134}
1135 1135
1136#ifdef CONFIG_PM 1136#ifdef CONFIG_PM
1137static int i2c_pxa_suspend_late(struct platform_device *dev, pm_message_t state) 1137static 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 clk_disable(i2c->clk); 1142 clk_disable(i2c->clk);
1143
1141 return 0; 1144 return 0;
1142} 1145}
1143 1146
1144static int i2c_pxa_resume_early(struct platform_device *dev) 1147static 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 clk_enable(i2c->clk); 1152 clk_enable(i2c->clk);
1149 i2c_pxa_reset(i2c); 1153 i2c_pxa_reset(i2c);
1150 1154
1151 return 0; 1155 return 0;
1152} 1156}
1157
1158static 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#else 1164#else
1154#define i2c_pxa_suspend_late NULL 1165#define I2C_PXA_DEV_PM_OPS NULL
1155#define i2c_pxa_resume_early NULL
1156#endif 1166#endif
1157 1167
1158static struct platform_driver i2c_pxa_driver = { 1168static struct platform_driver i2c_pxa_driver = {
1159 .probe = i2c_pxa_probe, 1169 .probe = i2c_pxa_probe,
1160 .remove = __exit_p(i2c_pxa_remove), 1170 .remove = __exit_p(i2c_pxa_remove),
1161 .suspend_late = i2c_pxa_suspend_late,
1162 .resume_early = i2c_pxa_resume_early,
1163 .driver = { 1171 .driver = {
1164 .name = "pxa2xx-i2c", 1172 .name = "pxa2xx-i2c",
1165 .owner = THIS_MODULE, 1173 .owner = THIS_MODULE,
1174 .pm = I2C_PXA_DEV_PM_OPS,
1166 }, 1175 },
1167 .id_table = i2c_pxa_id_table, 1176 .id_table = i2c_pxa_id_table,
1168}; 1177};
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 8f42a4536cdf..3be0d6a4d630 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -951,17 +951,20 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev)
951} 951}
952 952
953#ifdef CONFIG_PM 953#ifdef CONFIG_PM
954static int s3c24xx_i2c_suspend_late(struct platform_device *dev, 954static int s3c24xx_i2c_suspend_noirq(struct device *dev)
955 pm_message_t msg)
956{ 955{
957 struct s3c24xx_i2c *i2c = platform_get_drvdata(dev); 956 struct platform_device *pdev = to_platform_device(dev);
957 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
958
958 i2c->suspended = 1; 959 i2c->suspended = 1;
960
959 return 0; 961 return 0;
960} 962}
961 963
962static int s3c24xx_i2c_resume(struct platform_device *dev) 964static int s3c24xx_i2c_resume(struct device *dev)
963{ 965{
964 struct s3c24xx_i2c *i2c = platform_get_drvdata(dev); 966 struct platform_device *pdev = to_platform_device(dev);
967 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
965 968
966 i2c->suspended = 0; 969 i2c->suspended = 0;
967 s3c24xx_i2c_init(i2c); 970 s3c24xx_i2c_init(i2c);
@@ -969,9 +972,14 @@ static int s3c24xx_i2c_resume(struct platform_device *dev)
969 return 0; 972 return 0;
970} 973}
971 974
975static struct dev_pm_ops s3c24xx_i2c_dev_pm_ops = {
976 .suspend_noirq = s3c24xx_i2c_suspend_noirq,
977 .resume = s3c24xx_i2c_resume,
978};
979
980#define S3C24XX_DEV_PM_OPS (&s3c24xx_i2c_dev_pm_ops)
972#else 981#else
973#define s3c24xx_i2c_suspend_late NULL 982#define S3C24XX_DEV_PM_OPS NULL
974#define s3c24xx_i2c_resume NULL
975#endif 983#endif
976 984
977/* device driver for platform bus bits */ 985/* device driver for platform bus bits */
@@ -990,12 +998,11 @@ MODULE_DEVICE_TABLE(platform, s3c24xx_driver_ids);
990static struct platform_driver s3c24xx_i2c_driver = { 998static struct platform_driver s3c24xx_i2c_driver = {
991 .probe = s3c24xx_i2c_probe, 999 .probe = s3c24xx_i2c_probe,
992 .remove = s3c24xx_i2c_remove, 1000 .remove = s3c24xx_i2c_remove,
993 .suspend_late = s3c24xx_i2c_suspend_late,
994 .resume = s3c24xx_i2c_resume,
995 .id_table = s3c24xx_driver_ids, 1001 .id_table = s3c24xx_driver_ids,
996 .driver = { 1002 .driver = {
997 .owner = THIS_MODULE, 1003 .owner = THIS_MODULE,
998 .name = "s3c-i2c", 1004 .name = "s3c-i2c",
1005 .pm = S3C24XX_DEV_PM_OPS,
999 }, 1006 },
1000}; 1007};
1001 1008
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index d76c4c85367e..0c2ea44ae5e1 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -575,7 +575,7 @@ static void pci_pm_complete(struct device *dev)
575static int pci_pm_suspend(struct device *dev) 575static int pci_pm_suspend(struct device *dev)
576{ 576{
577 struct pci_dev *pci_dev = to_pci_dev(dev); 577 struct pci_dev *pci_dev = to_pci_dev(dev);
578 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 578 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
579 579
580 if (pci_has_legacy_pm_support(pci_dev)) 580 if (pci_has_legacy_pm_support(pci_dev))
581 return pci_legacy_suspend(dev, PMSG_SUSPEND); 581 return pci_legacy_suspend(dev, PMSG_SUSPEND);
@@ -613,7 +613,7 @@ static int pci_pm_suspend(struct device *dev)
613static int pci_pm_suspend_noirq(struct device *dev) 613static int pci_pm_suspend_noirq(struct device *dev)
614{ 614{
615 struct pci_dev *pci_dev = to_pci_dev(dev); 615 struct pci_dev *pci_dev = to_pci_dev(dev);
616 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 616 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
617 617
618 if (pci_has_legacy_pm_support(pci_dev)) 618 if (pci_has_legacy_pm_support(pci_dev))
619 return pci_legacy_suspend_late(dev, PMSG_SUSPEND); 619 return pci_legacy_suspend_late(dev, PMSG_SUSPEND);
@@ -672,7 +672,7 @@ static int pci_pm_resume_noirq(struct device *dev)
672static int pci_pm_resume(struct device *dev) 672static int pci_pm_resume(struct device *dev)
673{ 673{
674 struct pci_dev *pci_dev = to_pci_dev(dev); 674 struct pci_dev *pci_dev = to_pci_dev(dev);
675 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 675 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
676 int error = 0; 676 int error = 0;
677 677
678 /* 678 /*
@@ -711,7 +711,7 @@ static int pci_pm_resume(struct device *dev)
711static int pci_pm_freeze(struct device *dev) 711static int pci_pm_freeze(struct device *dev)
712{ 712{
713 struct pci_dev *pci_dev = to_pci_dev(dev); 713 struct pci_dev *pci_dev = to_pci_dev(dev);
714 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 714 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
715 715
716 if (pci_has_legacy_pm_support(pci_dev)) 716 if (pci_has_legacy_pm_support(pci_dev))
717 return pci_legacy_suspend(dev, PMSG_FREEZE); 717 return pci_legacy_suspend(dev, PMSG_FREEZE);
@@ -780,7 +780,7 @@ static int pci_pm_thaw_noirq(struct device *dev)
780static int pci_pm_thaw(struct device *dev) 780static int pci_pm_thaw(struct device *dev)
781{ 781{
782 struct pci_dev *pci_dev = to_pci_dev(dev); 782 struct pci_dev *pci_dev = to_pci_dev(dev);
783 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 783 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
784 int error = 0; 784 int error = 0;
785 785
786 if (pci_has_legacy_pm_support(pci_dev)) 786 if (pci_has_legacy_pm_support(pci_dev))
@@ -799,7 +799,7 @@ static int pci_pm_thaw(struct device *dev)
799static int pci_pm_poweroff(struct device *dev) 799static int pci_pm_poweroff(struct device *dev)
800{ 800{
801 struct pci_dev *pci_dev = to_pci_dev(dev); 801 struct pci_dev *pci_dev = to_pci_dev(dev);
802 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 802 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
803 803
804 if (pci_has_legacy_pm_support(pci_dev)) 804 if (pci_has_legacy_pm_support(pci_dev))
805 return pci_legacy_suspend(dev, PMSG_HIBERNATE); 805 return pci_legacy_suspend(dev, PMSG_HIBERNATE);
@@ -872,7 +872,7 @@ static int pci_pm_restore_noirq(struct device *dev)
872static int pci_pm_restore(struct device *dev) 872static int pci_pm_restore(struct device *dev)
873{ 873{
874 struct pci_dev *pci_dev = to_pci_dev(dev); 874 struct pci_dev *pci_dev = to_pci_dev(dev);
875 struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 875 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
876 int error = 0; 876 int error = 0;
877 877
878 /* 878 /*
@@ -910,7 +910,7 @@ static int pci_pm_restore(struct device *dev)
910 910
911#endif /* !CONFIG_HIBERNATION */ 911#endif /* !CONFIG_HIBERNATION */
912 912
913struct dev_pm_ops pci_dev_pm_ops = { 913const struct dev_pm_ops pci_dev_pm_ops = {
914 .prepare = pci_pm_prepare, 914 .prepare = pci_pm_prepare,
915 .complete = pci_pm_complete, 915 .complete = pci_pm_complete,
916 .suspend = pci_pm_suspend, 916 .suspend = pci_pm_suspend,
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 554a414f65d1..1191928902f4 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2168,8 +2168,9 @@ static int __devexit musb_remove(struct platform_device *pdev)
2168 2168
2169#ifdef CONFIG_PM 2169#ifdef CONFIG_PM
2170 2170
2171static int musb_suspend(struct platform_device *pdev, pm_message_t message) 2171static int musb_suspend(struct device *dev)
2172{ 2172{
2173 struct platform_device *pdev = to_platform_device(dev);
2173 unsigned long flags; 2174 unsigned long flags;
2174 struct musb *musb = dev_to_musb(&pdev->dev); 2175 struct musb *musb = dev_to_musb(&pdev->dev);
2175 2176
@@ -2196,8 +2197,9 @@ static int musb_suspend(struct platform_device *pdev, pm_message_t message)
2196 return 0; 2197 return 0;
2197} 2198}
2198 2199
2199static int musb_resume_early(struct platform_device *pdev) 2200static int musb_resume_noirq(struct device *dev)
2200{ 2201{
2202 struct platform_device *pdev = to_platform_device(dev);
2201 struct musb *musb = dev_to_musb(&pdev->dev); 2203 struct musb *musb = dev_to_musb(&pdev->dev);
2202 2204
2203 if (!musb->clock) 2205 if (!musb->clock)
@@ -2215,9 +2217,14 @@ static int musb_resume_early(struct platform_device *pdev)
2215 return 0; 2217 return 0;
2216} 2218}
2217 2219
2220static struct dev_pm_ops musb_dev_pm_ops = {
2221 .suspend = musb_suspend,
2222 .resume_noirq = musb_resume_noirq,
2223};
2224
2225#define MUSB_DEV_PM_OPS (&musb_dev_pm_ops)
2218#else 2226#else
2219#define musb_suspend NULL 2227#define MUSB_DEV_PM_OPS NULL
2220#define musb_resume_early NULL
2221#endif 2228#endif
2222 2229
2223static struct platform_driver musb_driver = { 2230static struct platform_driver musb_driver = {
@@ -2225,11 +2232,10 @@ static struct platform_driver musb_driver = {
2225 .name = (char *)musb_driver_name, 2232 .name = (char *)musb_driver_name,
2226 .bus = &platform_bus_type, 2233 .bus = &platform_bus_type,
2227 .owner = THIS_MODULE, 2234 .owner = THIS_MODULE,
2235 .pm = MUSB_DEV_PM_OPS,
2228 }, 2236 },
2229 .remove = __devexit_p(musb_remove), 2237 .remove = __devexit_p(musb_remove),
2230 .shutdown = musb_shutdown, 2238 .shutdown = musb_shutdown,
2231 .suspend = musb_suspend,
2232 .resume_early = musb_resume_early,
2233}; 2239};
2234 2240
2235/*-------------------------------------------------------------------------*/ 2241/*-------------------------------------------------------------------------*/
diff --git a/include/asm-generic/device.h b/include/asm-generic/device.h
index c17c9600f220..d7c76bba640d 100644
--- a/include/asm-generic/device.h
+++ b/include/asm-generic/device.h
@@ -9,4 +9,7 @@
9struct dev_archdata { 9struct dev_archdata {
10}; 10};
11 11
12struct pdev_archdata {
13};
14
12#endif /* _ASM_GENERIC_DEVICE_H */ 15#endif /* _ASM_GENERIC_DEVICE_H */
diff --git a/include/linux/device.h b/include/linux/device.h
index aebb81036db2..a28642975053 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -62,7 +62,7 @@ struct bus_type {
62 int (*suspend)(struct device *dev, pm_message_t state); 62 int (*suspend)(struct device *dev, pm_message_t state);
63 int (*resume)(struct device *dev); 63 int (*resume)(struct device *dev);
64 64
65 struct dev_pm_ops *pm; 65 const struct dev_pm_ops *pm;
66 66
67 struct bus_type_private *p; 67 struct bus_type_private *p;
68}; 68};
@@ -132,7 +132,7 @@ struct device_driver {
132 int (*resume) (struct device *dev); 132 int (*resume) (struct device *dev);
133 struct attribute_group **groups; 133 struct attribute_group **groups;
134 134
135 struct dev_pm_ops *pm; 135 const struct dev_pm_ops *pm;
136 136
137 struct driver_private *p; 137 struct driver_private *p;
138}; 138};
@@ -200,7 +200,8 @@ struct class {
200 int (*suspend)(struct device *dev, pm_message_t state); 200 int (*suspend)(struct device *dev, pm_message_t state);
201 int (*resume)(struct device *dev); 201 int (*resume)(struct device *dev);
202 202
203 struct dev_pm_ops *pm; 203 const struct dev_pm_ops *pm;
204
204 struct class_private *p; 205 struct class_private *p;
205}; 206};
206 207
@@ -291,7 +292,7 @@ struct device_type {
291 char *(*nodename)(struct device *dev); 292 char *(*nodename)(struct device *dev);
292 void (*release)(struct device *dev); 293 void (*release)(struct device *dev);
293 294
294 struct dev_pm_ops *pm; 295 const struct dev_pm_ops *pm;
295}; 296};
296 297
297/* interface for exporting device attributes */ 298/* interface for exporting device attributes */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 8dc5123b6305..3c6675c2444b 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -22,6 +22,9 @@ struct platform_device {
22 struct resource * resource; 22 struct resource * resource;
23 23
24 struct platform_device_id *id_entry; 24 struct platform_device_id *id_entry;
25
26 /* arch specific additions */
27 struct pdev_archdata archdata;
25}; 28};
26 29
27#define platform_get_device_id(pdev) ((pdev)->id_entry) 30#define platform_get_device_id(pdev) ((pdev)->id_entry)
@@ -57,8 +60,6 @@ struct platform_driver {
57 int (*remove)(struct platform_device *); 60 int (*remove)(struct platform_device *);
58 void (*shutdown)(struct platform_device *); 61 void (*shutdown)(struct platform_device *);
59 int (*suspend)(struct platform_device *, pm_message_t state); 62 int (*suspend)(struct platform_device *, pm_message_t state);
60 int (*suspend_late)(struct platform_device *, pm_message_t state);
61 int (*resume_early)(struct platform_device *);
62 int (*resume)(struct platform_device *); 63 int (*resume)(struct platform_device *);
63 struct device_driver driver; 64 struct device_driver driver;
64 struct platform_device_id *id_table; 65 struct platform_device_id *id_table;