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 456594bd97bc..d28c289e4a3f 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -625,30 +625,6 @@ static int platform_legacy_suspend(struct device *dev, pm_message_t mesg)
625 return ret; 625 return ret;
626} 626}
627 627
628static int platform_legacy_suspend_late(struct device *dev, pm_message_t mesg)
629{
630 struct platform_driver *pdrv = to_platform_driver(dev->driver);
631 struct platform_device *pdev = to_platform_device(dev);
632 int ret = 0;
633
634 if (dev->driver && pdrv->suspend_late)
635 ret = pdrv->suspend_late(pdev, mesg);
636
637 return ret;
638}
639
640static int platform_legacy_resume_early(struct device *dev)
641{
642 struct platform_driver *pdrv = to_platform_driver(dev->driver);
643 struct platform_device *pdev = to_platform_device(dev);
644 int ret = 0;
645
646 if (dev->driver && pdrv->resume_early)
647 ret = pdrv->resume_early(pdev);
648
649 return ret;
650}
651
652static int platform_legacy_resume(struct device *dev) 628static int platform_legacy_resume(struct device *dev)
653{ 629{
654 struct platform_driver *pdrv = to_platform_driver(dev->driver); 630 struct platform_driver *pdrv = to_platform_driver(dev->driver);
@@ -711,8 +687,6 @@ static int platform_pm_suspend_noirq(struct device *dev)
711 if (drv->pm) { 687 if (drv->pm) {
712 if (drv->pm->suspend_noirq) 688 if (drv->pm->suspend_noirq)
713 ret = drv->pm->suspend_noirq(dev); 689 ret = drv->pm->suspend_noirq(dev);
714 } else {
715 ret = platform_legacy_suspend_late(dev, PMSG_SUSPEND);
716 } 690 }
717 691
718 return ret; 692 return ret;
@@ -747,8 +721,6 @@ static int platform_pm_resume_noirq(struct device *dev)
747 if (drv->pm) { 721 if (drv->pm) {
748 if (drv->pm->resume_noirq) 722 if (drv->pm->resume_noirq)
749 ret = drv->pm->resume_noirq(dev); 723 ret = drv->pm->resume_noirq(dev);
750 } else {
751 ret = platform_legacy_resume_early(dev);
752 } 724 }
753 725
754 return ret; 726 return ret;
@@ -794,8 +766,6 @@ static int platform_pm_freeze_noirq(struct device *dev)
794 if (drv->pm) { 766 if (drv->pm) {
795 if (drv->pm->freeze_noirq) 767 if (drv->pm->freeze_noirq)
796 ret = drv->pm->freeze_noirq(dev); 768 ret = drv->pm->freeze_noirq(dev);
797 } else {
798 ret = platform_legacy_suspend_late(dev, PMSG_FREEZE);
799 } 769 }
800 770
801 return ret; 771 return ret;
@@ -830,8 +800,6 @@ static int platform_pm_thaw_noirq(struct device *dev)
830 if (drv->pm) { 800 if (drv->pm) {
831 if (drv->pm->thaw_noirq) 801 if (drv->pm->thaw_noirq)
832 ret = drv->pm->thaw_noirq(dev); 802 ret = drv->pm->thaw_noirq(dev);
833 } else {
834 ret = platform_legacy_resume_early(dev);
835 } 803 }
836 804
837 return ret; 805 return ret;
@@ -866,8 +834,6 @@ static int platform_pm_poweroff_noirq(struct device *dev)
866 if (drv->pm) { 834 if (drv->pm) {
867 if (drv->pm->poweroff_noirq) 835 if (drv->pm->poweroff_noirq)
868 ret = drv->pm->poweroff_noirq(dev); 836 ret = drv->pm->poweroff_noirq(dev);
869 } else {
870 ret = platform_legacy_suspend_late(dev, PMSG_HIBERNATE);
871 } 837 }
872 838
873 return ret; 839 return ret;
@@ -902,8 +868,6 @@ static int platform_pm_restore_noirq(struct device *dev)
902 if (drv->pm) { 868 if (drv->pm) {
903 if (drv->pm->restore_noirq) 869 if (drv->pm->restore_noirq)
904 ret = drv->pm->restore_noirq(dev); 870 ret = drv->pm->restore_noirq(dev);
905 } else {
906 ret = platform_legacy_resume_early(dev);
907 } 871 }
908 872
909 return ret; 873 return ret;
@@ -922,7 +886,7 @@ static int platform_pm_restore_noirq(struct device *dev)
922 886
923#endif /* !CONFIG_HIBERNATION */ 887#endif /* !CONFIG_HIBERNATION */
924 888
925static struct dev_pm_ops platform_dev_pm_ops = { 889static const struct dev_pm_ops platform_dev_pm_ops = {
926 .prepare = platform_pm_prepare, 890 .prepare = platform_pm_prepare,
927 .complete = platform_pm_complete, 891 .complete = platform_pm_complete,
928 .suspend = platform_pm_suspend, 892 .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 20bb0ceb027b..96aafb91b69a 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -946,17 +946,20 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev)
946} 946}
947 947
948#ifdef CONFIG_PM 948#ifdef CONFIG_PM
949static int s3c24xx_i2c_suspend_late(struct platform_device *dev, 949static int s3c24xx_i2c_suspend_noirq(struct device *dev)
950 pm_message_t msg)
951{ 950{
952 struct s3c24xx_i2c *i2c = platform_get_drvdata(dev); 951 struct platform_device *pdev = to_platform_device(dev);
952 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
953
953 i2c->suspended = 1; 954 i2c->suspended = 1;
955
954 return 0; 956 return 0;
955} 957}
956 958
957static int s3c24xx_i2c_resume(struct platform_device *dev) 959static int s3c24xx_i2c_resume(struct device *dev)
958{ 960{
959 struct s3c24xx_i2c *i2c = platform_get_drvdata(dev); 961 struct platform_device *pdev = to_platform_device(dev);
962 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
960 963
961 i2c->suspended = 0; 964 i2c->suspended = 0;
962 s3c24xx_i2c_init(i2c); 965 s3c24xx_i2c_init(i2c);
@@ -964,9 +967,14 @@ static int s3c24xx_i2c_resume(struct platform_device *dev)
964 return 0; 967 return 0;
965} 968}
966 969
970static struct dev_pm_ops s3c24xx_i2c_dev_pm_ops = {
971 .suspend_noirq = s3c24xx_i2c_suspend_noirq,
972 .resume = s3c24xx_i2c_resume,
973};
974
975#define S3C24XX_DEV_PM_OPS (&s3c24xx_i2c_dev_pm_ops)
967#else 976#else
968#define s3c24xx_i2c_suspend_late NULL 977#define S3C24XX_DEV_PM_OPS NULL
969#define s3c24xx_i2c_resume NULL
970#endif 978#endif
971 979
972/* device driver for platform bus bits */ 980/* device driver for platform bus bits */
@@ -985,12 +993,11 @@ MODULE_DEVICE_TABLE(platform, s3c24xx_driver_ids);
985static struct platform_driver s3c24xx_i2c_driver = { 993static struct platform_driver s3c24xx_i2c_driver = {
986 .probe = s3c24xx_i2c_probe, 994 .probe = s3c24xx_i2c_probe,
987 .remove = s3c24xx_i2c_remove, 995 .remove = s3c24xx_i2c_remove,
988 .suspend_late = s3c24xx_i2c_suspend_late,
989 .resume = s3c24xx_i2c_resume,
990 .id_table = s3c24xx_driver_ids, 996 .id_table = s3c24xx_driver_ids,
991 .driver = { 997 .driver = {
992 .owner = THIS_MODULE, 998 .owner = THIS_MODULE,
993 .name = "s3c-i2c", 999 .name = "s3c-i2c",
1000 .pm = S3C24XX_DEV_PM_OPS,
994 }, 1001 },
995}; 1002};
996 1003
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 c7c1ca0494cd..1d26beddf2ca 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2167,8 +2167,9 @@ static int __devexit musb_remove(struct platform_device *pdev)
2167 2167
2168#ifdef CONFIG_PM 2168#ifdef CONFIG_PM
2169 2169
2170static int musb_suspend(struct platform_device *pdev, pm_message_t message) 2170static int musb_suspend(struct device *dev)
2171{ 2171{
2172 struct platform_device *pdev = to_platform_device(dev);
2172 unsigned long flags; 2173 unsigned long flags;
2173 struct musb *musb = dev_to_musb(&pdev->dev); 2174 struct musb *musb = dev_to_musb(&pdev->dev);
2174 2175
@@ -2195,8 +2196,9 @@ static int musb_suspend(struct platform_device *pdev, pm_message_t message)
2195 return 0; 2196 return 0;
2196} 2197}
2197 2198
2198static int musb_resume_early(struct platform_device *pdev) 2199static int musb_resume_noirq(struct device *dev)
2199{ 2200{
2201 struct platform_device *pdev = to_platform_device(dev);
2200 struct musb *musb = dev_to_musb(&pdev->dev); 2202 struct musb *musb = dev_to_musb(&pdev->dev);
2201 2203
2202 if (!musb->clock) 2204 if (!musb->clock)
@@ -2214,9 +2216,14 @@ static int musb_resume_early(struct platform_device *pdev)
2214 return 0; 2216 return 0;
2215} 2217}
2216 2218
2219static struct dev_pm_ops musb_dev_pm_ops = {
2220 .suspend = musb_suspend,
2221 .resume_noirq = musb_resume_noirq,
2222};
2223
2224#define MUSB_DEV_PM_OPS (&musb_dev_pm_ops)
2217#else 2225#else
2218#define musb_suspend NULL 2226#define MUSB_DEV_PM_OPS NULL
2219#define musb_resume_early NULL
2220#endif 2227#endif
2221 2228
2222static struct platform_driver musb_driver = { 2229static struct platform_driver musb_driver = {
@@ -2224,11 +2231,10 @@ static struct platform_driver musb_driver = {
2224 .name = (char *)musb_driver_name, 2231 .name = (char *)musb_driver_name,
2225 .bus = &platform_bus_type, 2232 .bus = &platform_bus_type,
2226 .owner = THIS_MODULE, 2233 .owner = THIS_MODULE,
2234 .pm = MUSB_DEV_PM_OPS,
2227 }, 2235 },
2228 .remove = __devexit_p(musb_remove), 2236 .remove = __devexit_p(musb_remove),
2229 .shutdown = musb_shutdown, 2237 .shutdown = musb_shutdown,
2230 .suspend = musb_suspend,
2231 .resume_early = musb_resume_early,
2232}; 2238};
2233 2239
2234/*-------------------------------------------------------------------------*/ 2240/*-------------------------------------------------------------------------*/
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;