aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2005-09-03 18:56:57 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 03:06:16 -0400
commitca078bae813dd46c0f9b102fdfb4a3384641ff48 (patch)
treee3348f5dcb24159a522941aa2e3ee40bc9e0589b
parent829ca9a30a2ddb727981d80fabdbff2ea86bc9ea (diff)
[PATCH] swsusp: switch pm_message_t to struct
This adds type-checking to pm_message_t, so that people can't confuse it with int or u32. It also allows us to fix "disk yoyo" during suspend (disk spinning down/up/down). [We've tried that before; since that cpufreq problems were fixed and I've tried make allyes config and fixed resulting damage.] Signed-off-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Alexander Nyberg <alexn@telia.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/ppc/syslib/of_device.c2
-rw-r--r--drivers/base/power/resume.c8
-rw-r--r--drivers/base/power/runtime.c8
-rw-r--r--drivers/base/power/suspend.c12
-rw-r--r--drivers/base/power/sysfs.c8
-rw-r--r--drivers/ide/ide.c4
-rw-r--r--drivers/ide/pci/sc1200.c12
-rw-r--r--drivers/ide/ppc/pmac.c8
-rw-r--r--drivers/macintosh/mediabay.c4
-rw-r--r--drivers/macintosh/via-pmu.c2
-rw-r--r--drivers/media/dvb/cinergyT2/cinergyT2.c2
-rw-r--r--drivers/net/irda/vlsi_ir.c10
-rw-r--r--drivers/net/wireless/airo.c10
-rw-r--r--drivers/pci/pci.c14
-rw-r--r--drivers/scsi/mesh.c6
-rw-r--r--drivers/serial/pmac_zilog.c6
-rw-r--r--drivers/usb/core/hub.c18
-rw-r--r--drivers/usb/core/usb.c2
-rw-r--r--drivers/usb/host/ehci-dbg.c2
-rw-r--r--drivers/usb/host/ohci-dbg.c2
-rw-r--r--drivers/usb/host/sl811-hcd.c6
-rw-r--r--drivers/usb/misc/usbtest.c2
-rw-r--r--drivers/video/aty/aty128fb.c14
-rw-r--r--drivers/video/aty/atyfb_base.c11
-rw-r--r--drivers/video/aty/radeon_pm.c12
-rw-r--r--drivers/video/chipsfb.c4
-rw-r--r--drivers/video/i810/i810_main.c6
-rw-r--r--include/linux/pm.h14
28 files changed, 108 insertions, 101 deletions
diff --git a/arch/ppc/syslib/of_device.c b/arch/ppc/syslib/of_device.c
index 1eb4f726ca9f..da8a0f2128dc 100644
--- a/arch/ppc/syslib/of_device.c
+++ b/arch/ppc/syslib/of_device.c
@@ -105,7 +105,7 @@ static int of_device_remove(struct device *dev)
105 return 0; 105 return 0;
106} 106}
107 107
108static int of_device_suspend(struct device *dev, u32 state) 108static int of_device_suspend(struct device *dev, pm_message_t state)
109{ 109{
110 struct of_device * of_dev = to_of_device(dev); 110 struct of_device * of_dev = to_of_device(dev);
111 struct of_platform_driver * drv = to_of_platform_driver(dev->driver); 111 struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
diff --git a/drivers/base/power/resume.c b/drivers/base/power/resume.c
index bdd96b03b885..0a7aa07b9a2a 100644
--- a/drivers/base/power/resume.c
+++ b/drivers/base/power/resume.c
@@ -26,11 +26,11 @@ int resume_device(struct device * dev)
26 26
27 down(&dev->sem); 27 down(&dev->sem);
28 if (dev->power.pm_parent 28 if (dev->power.pm_parent
29 && dev->power.pm_parent->power.power_state) { 29 && dev->power.pm_parent->power.power_state.event) {
30 dev_err(dev, "PM: resume from %d, parent %s still %d\n", 30 dev_err(dev, "PM: resume from %d, parent %s still %d\n",
31 dev->power.power_state, 31 dev->power.power_state.event,
32 dev->power.pm_parent->bus_id, 32 dev->power.pm_parent->bus_id,
33 dev->power.pm_parent->power.power_state); 33 dev->power.pm_parent->power.power_state.event);
34 } 34 }
35 if (dev->bus && dev->bus->resume) { 35 if (dev->bus && dev->bus->resume) {
36 dev_dbg(dev,"resuming\n"); 36 dev_dbg(dev,"resuming\n");
@@ -54,7 +54,7 @@ void dpm_resume(void)
54 list_add_tail(entry, &dpm_active); 54 list_add_tail(entry, &dpm_active);
55 55
56 up(&dpm_list_sem); 56 up(&dpm_list_sem);
57 if (!dev->power.prev_state) 57 if (!dev->power.prev_state.event)
58 resume_device(dev); 58 resume_device(dev);
59 down(&dpm_list_sem); 59 down(&dpm_list_sem);
60 put_device(dev); 60 put_device(dev);
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 325962d80191..e8f0519f5dfa 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -13,10 +13,10 @@
13static void runtime_resume(struct device * dev) 13static void runtime_resume(struct device * dev)
14{ 14{
15 dev_dbg(dev, "resuming\n"); 15 dev_dbg(dev, "resuming\n");
16 if (!dev->power.power_state) 16 if (!dev->power.power_state.event)
17 return; 17 return;
18 if (!resume_device(dev)) 18 if (!resume_device(dev))
19 dev->power.power_state = 0; 19 dev->power.power_state = PMSG_ON;
20} 20}
21 21
22 22
@@ -49,10 +49,10 @@ int dpm_runtime_suspend(struct device * dev, pm_message_t state)
49 int error = 0; 49 int error = 0;
50 50
51 down(&dpm_sem); 51 down(&dpm_sem);
52 if (dev->power.power_state == state) 52 if (dev->power.power_state.event == state.event)
53 goto Done; 53 goto Done;
54 54
55 if (dev->power.power_state) 55 if (dev->power.power_state.event)
56 runtime_resume(dev); 56 runtime_resume(dev);
57 57
58 if (!(error = suspend_device(dev, state))) 58 if (!(error = suspend_device(dev, state)))
diff --git a/drivers/base/power/suspend.c b/drivers/base/power/suspend.c
index 2ccee3763acf..50501764d050 100644
--- a/drivers/base/power/suspend.c
+++ b/drivers/base/power/suspend.c
@@ -40,22 +40,22 @@ int suspend_device(struct device * dev, pm_message_t state)
40 int error = 0; 40 int error = 0;
41 41
42 down(&dev->sem); 42 down(&dev->sem);
43 if (dev->power.power_state) { 43 if (dev->power.power_state.event) {
44 dev_dbg(dev, "PM: suspend %d-->%d\n", 44 dev_dbg(dev, "PM: suspend %d-->%d\n",
45 dev->power.power_state, state); 45 dev->power.power_state.event, state.event);
46 } 46 }
47 if (dev->power.pm_parent 47 if (dev->power.pm_parent
48 && dev->power.pm_parent->power.power_state) { 48 && dev->power.pm_parent->power.power_state.event) {
49 dev_err(dev, 49 dev_err(dev,
50 "PM: suspend %d->%d, parent %s already %d\n", 50 "PM: suspend %d->%d, parent %s already %d\n",
51 dev->power.power_state, state, 51 dev->power.power_state.event, state.event,
52 dev->power.pm_parent->bus_id, 52 dev->power.pm_parent->bus_id,
53 dev->power.pm_parent->power.power_state); 53 dev->power.pm_parent->power.power_state.event);
54 } 54 }
55 55
56 dev->power.prev_state = dev->power.power_state; 56 dev->power.prev_state = dev->power.power_state;
57 57
58 if (dev->bus && dev->bus->suspend && !dev->power.power_state) { 58 if (dev->bus && dev->bus->suspend && !dev->power.power_state.event) {
59 dev_dbg(dev, "suspending\n"); 59 dev_dbg(dev, "suspending\n");
60 error = dev->bus->suspend(dev, state); 60 error = dev->bus->suspend(dev, state);
61 } 61 }
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index f82b3df9545f..8d04fb435c17 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -26,19 +26,19 @@
26 26
27static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf) 27static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf)
28{ 28{
29 return sprintf(buf, "%u\n", dev->power.power_state); 29 return sprintf(buf, "%u\n", dev->power.power_state.event);
30} 30}
31 31
32static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n) 32static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n)
33{ 33{
34 u32 state; 34 pm_message_t state;
35 char * rest; 35 char * rest;
36 int error = 0; 36 int error = 0;
37 37
38 state = simple_strtoul(buf, &rest, 10); 38 state.event = simple_strtoul(buf, &rest, 10);
39 if (*rest) 39 if (*rest)
40 return -EINVAL; 40 return -EINVAL;
41 if (state) 41 if (state.event)
42 error = dpm_runtime_suspend(dev, state); 42 error = dpm_runtime_suspend(dev, state);
43 else 43 else
44 dpm_runtime_resume(dev); 44 dpm_runtime_resume(dev);
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index dae1bd5b8c3e..73ca8f73917d 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1229,7 +1229,7 @@ static int generic_ide_suspend(struct device *dev, pm_message_t state)
1229 rq.special = &args; 1229 rq.special = &args;
1230 rq.pm = &rqpm; 1230 rq.pm = &rqpm;
1231 rqpm.pm_step = ide_pm_state_start_suspend; 1231 rqpm.pm_step = ide_pm_state_start_suspend;
1232 rqpm.pm_state = state; 1232 rqpm.pm_state = state.event;
1233 1233
1234 return ide_do_drive_cmd(drive, &rq, ide_wait); 1234 return ide_do_drive_cmd(drive, &rq, ide_wait);
1235} 1235}
@@ -1248,7 +1248,7 @@ static int generic_ide_resume(struct device *dev)
1248 rq.special = &args; 1248 rq.special = &args;
1249 rq.pm = &rqpm; 1249 rq.pm = &rqpm;
1250 rqpm.pm_step = ide_pm_state_start_resume; 1250 rqpm.pm_step = ide_pm_state_start_resume;
1251 rqpm.pm_state = 0; 1251 rqpm.pm_state = PM_EVENT_ON;
1252 1252
1253 return ide_do_drive_cmd(drive, &rq, ide_head_wait); 1253 return ide_do_drive_cmd(drive, &rq, ide_head_wait);
1254} 1254}
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index 10592cec6c43..24e21b2838c1 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -350,9 +350,9 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state)
350{ 350{
351 ide_hwif_t *hwif = NULL; 351 ide_hwif_t *hwif = NULL;
352 352
353 printk("SC1200: suspend(%u)\n", state); 353 printk("SC1200: suspend(%u)\n", state.event);
354 354
355 if (state == 0) { 355 if (state.event == PM_EVENT_ON) {
356 // we only save state when going from full power to less 356 // we only save state when going from full power to less
357 357
358 // 358 //
@@ -386,8 +386,8 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state)
386 /* You don't need to iterate over disks -- sysfs should have done that for you already */ 386 /* You don't need to iterate over disks -- sysfs should have done that for you already */
387 387
388 pci_disable_device(dev); 388 pci_disable_device(dev);
389 pci_set_power_state(dev,state); 389 pci_set_power_state(dev, pci_choose_state(dev, state));
390 dev->current_state = state; 390 dev->current_state = state.event;
391 return 0; 391 return 0;
392} 392}
393 393
@@ -396,8 +396,8 @@ static int sc1200_resume (struct pci_dev *dev)
396 ide_hwif_t *hwif = NULL; 396 ide_hwif_t *hwif = NULL;
397 397
398printk("SC1200: resume\n"); 398printk("SC1200: resume\n");
399 pci_set_power_state(dev,0); // bring chip back from sleep state 399 pci_set_power_state(dev, PCI_D0); // bring chip back from sleep state
400 dev->current_state = 0; 400 dev->current_state = PM_EVENT_ON;
401 pci_enable_device(dev); 401 pci_enable_device(dev);
402 // 402 //
403 // loop over all interfaces that are part of this pci device: 403 // loop over all interfaces that are part of this pci device:
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index d2760b8ca159..87d1f8a1f41e 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1509,7 +1509,7 @@ pmac_ide_macio_suspend(struct macio_dev *mdev, pm_message_t state)
1509 ide_hwif_t *hwif = (ide_hwif_t *)dev_get_drvdata(&mdev->ofdev.dev); 1509 ide_hwif_t *hwif = (ide_hwif_t *)dev_get_drvdata(&mdev->ofdev.dev);
1510 int rc = 0; 1510 int rc = 0;
1511 1511
1512 if (state != mdev->ofdev.dev.power.power_state && state >= 2) { 1512 if (state.event != mdev->ofdev.dev.power.power_state.event && state.event >= PM_EVENT_SUSPEND) {
1513 rc = pmac_ide_do_suspend(hwif); 1513 rc = pmac_ide_do_suspend(hwif);
1514 if (rc == 0) 1514 if (rc == 0)
1515 mdev->ofdev.dev.power.power_state = state; 1515 mdev->ofdev.dev.power.power_state = state;
@@ -1524,7 +1524,7 @@ pmac_ide_macio_resume(struct macio_dev *mdev)
1524 ide_hwif_t *hwif = (ide_hwif_t *)dev_get_drvdata(&mdev->ofdev.dev); 1524 ide_hwif_t *hwif = (ide_hwif_t *)dev_get_drvdata(&mdev->ofdev.dev);
1525 int rc = 0; 1525 int rc = 0;
1526 1526
1527 if (mdev->ofdev.dev.power.power_state != 0) { 1527 if (mdev->ofdev.dev.power.power_state.event != PM_EVENT_ON) {
1528 rc = pmac_ide_do_resume(hwif); 1528 rc = pmac_ide_do_resume(hwif);
1529 if (rc == 0) 1529 if (rc == 0)
1530 mdev->ofdev.dev.power.power_state = PMSG_ON; 1530 mdev->ofdev.dev.power.power_state = PMSG_ON;
@@ -1613,7 +1613,7 @@ pmac_ide_pci_suspend(struct pci_dev *pdev, pm_message_t state)
1613 ide_hwif_t *hwif = (ide_hwif_t *)pci_get_drvdata(pdev); 1613 ide_hwif_t *hwif = (ide_hwif_t *)pci_get_drvdata(pdev);
1614 int rc = 0; 1614 int rc = 0;
1615 1615
1616 if (state != pdev->dev.power.power_state && state >= 2) { 1616 if (state.event != pdev->dev.power.power_state.event && state.event >= 2) {
1617 rc = pmac_ide_do_suspend(hwif); 1617 rc = pmac_ide_do_suspend(hwif);
1618 if (rc == 0) 1618 if (rc == 0)
1619 pdev->dev.power.power_state = state; 1619 pdev->dev.power.power_state = state;
@@ -1628,7 +1628,7 @@ pmac_ide_pci_resume(struct pci_dev *pdev)
1628 ide_hwif_t *hwif = (ide_hwif_t *)pci_get_drvdata(pdev); 1628 ide_hwif_t *hwif = (ide_hwif_t *)pci_get_drvdata(pdev);
1629 int rc = 0; 1629 int rc = 0;
1630 1630
1631 if (pdev->dev.power.power_state != 0) { 1631 if (pdev->dev.power.power_state.event != PM_EVENT_ON) {
1632 rc = pmac_ide_do_resume(hwif); 1632 rc = pmac_ide_do_resume(hwif);
1633 if (rc == 0) 1633 if (rc == 0)
1634 pdev->dev.power.power_state = PMSG_ON; 1634 pdev->dev.power.power_state = PMSG_ON;
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index 7e1afca75e41..c0712a1ea5af 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -708,7 +708,7 @@ static int __pmac media_bay_suspend(struct macio_dev *mdev, pm_message_t state)
708{ 708{
709 struct media_bay_info *bay = macio_get_drvdata(mdev); 709 struct media_bay_info *bay = macio_get_drvdata(mdev);
710 710
711 if (state != mdev->ofdev.dev.power.power_state && state == PM_SUSPEND_MEM) { 711 if (state.event != mdev->ofdev.dev.power.power_state.event && state.event == PM_EVENT_SUSPEND) {
712 down(&bay->lock); 712 down(&bay->lock);
713 bay->sleeping = 1; 713 bay->sleeping = 1;
714 set_mb_power(bay, 0); 714 set_mb_power(bay, 0);
@@ -723,7 +723,7 @@ static int __pmac media_bay_resume(struct macio_dev *mdev)
723{ 723{
724 struct media_bay_info *bay = macio_get_drvdata(mdev); 724 struct media_bay_info *bay = macio_get_drvdata(mdev);
725 725
726 if (mdev->ofdev.dev.power.power_state != 0) { 726 if (mdev->ofdev.dev.power.power_state.event != PM_EVENT_ON) {
727 mdev->ofdev.dev.power.power_state = PMSG_ON; 727 mdev->ofdev.dev.power.power_state = PMSG_ON;
728 728
729 /* We re-enable the bay using it's previous content 729 /* We re-enable the bay using it's previous content
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 4a0a0ad2d03c..645a2e5c70ab 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -3065,7 +3065,7 @@ static int pmu_sys_suspended = 0;
3065 3065
3066static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state) 3066static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state)
3067{ 3067{
3068 if (state != PM_SUSPEND_DISK || pmu_sys_suspended) 3068 if (state.event != PM_EVENT_SUSPEND || pmu_sys_suspended)
3069 return 0; 3069 return 0;
3070 3070
3071 /* Suspend PMU event interrupts */ 3071 /* Suspend PMU event interrupts */
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c
index 7d8b3cad350b..9ea5747b1211 100644
--- a/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -888,7 +888,7 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state)
888 if (down_interruptible(&cinergyt2->sem)) 888 if (down_interruptible(&cinergyt2->sem))
889 return -ERESTARTSYS; 889 return -ERESTARTSYS;
890 890
891 if (state > 0) { /* state 0 seems to mean DEVICE_PM_ON */ 891 if (state.event > PM_EVENT_ON) {
892 struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); 892 struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf);
893#ifdef ENABLE_RC 893#ifdef ENABLE_RC
894 cancel_delayed_work(&cinergyt2->rc_query_work); 894 cancel_delayed_work(&cinergyt2->rc_query_work);
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index 4be95398bac4..6d9de626c967 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -1757,12 +1757,12 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
1757 idev = ndev->priv; 1757 idev = ndev->priv;
1758 down(&idev->sem); 1758 down(&idev->sem);
1759 if (pdev->current_state != 0) { /* already suspended */ 1759 if (pdev->current_state != 0) { /* already suspended */
1760 if (state > pdev->current_state) { /* simply go deeper */ 1760 if (state.event > pdev->current_state) { /* simply go deeper */
1761 pci_set_power_state(pdev,state); 1761 pci_set_power_state(pdev, pci_choose_state(pdev, state));
1762 pdev->current_state = state; 1762 pdev->current_state = state.event;
1763 } 1763 }
1764 else 1764 else
1765 IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, PCIDEV_NAME(pdev), pdev->current_state, state); 1765 IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, PCIDEV_NAME(pdev), pdev->current_state, state.event);
1766 up(&idev->sem); 1766 up(&idev->sem);
1767 return 0; 1767 return 0;
1768 } 1768 }
@@ -1777,7 +1777,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
1777 } 1777 }
1778 1778
1779 pci_set_power_state(pdev, pci_choose_state(pdev, state)); 1779 pci_set_power_state(pdev, pci_choose_state(pdev, state));
1780 pdev->current_state = state; 1780 pdev->current_state = state.event;
1781 idev->resume_ok = 1; 1781 idev->resume_ok = 1;
1782 up(&idev->sem); 1782 up(&idev->sem);
1783 return 0; 1783 return 0;
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 6db1fb6461de..abac1e40154b 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -2239,7 +2239,7 @@ static void airo_read_stats(struct airo_info *ai) {
2239 u32 *vals = stats_rid.vals; 2239 u32 *vals = stats_rid.vals;
2240 2240
2241 clear_bit(JOB_STATS, &ai->flags); 2241 clear_bit(JOB_STATS, &ai->flags);
2242 if (ai->power) { 2242 if (ai->power.event) {
2243 up(&ai->sem); 2243 up(&ai->sem);
2244 return; 2244 return;
2245 } 2245 }
@@ -2969,7 +2969,7 @@ static int airo_thread(void *data) {
2969 break; 2969 break;
2970 } 2970 }
2971 2971
2972 if (ai->power || test_bit(FLAG_FLASHING, &ai->flags)) { 2972 if (ai->power.event || test_bit(FLAG_FLASHING, &ai->flags)) {
2973 up(&ai->sem); 2973 up(&ai->sem);
2974 continue; 2974 continue;
2975 } 2975 }
@@ -5521,7 +5521,7 @@ static int airo_pci_resume(struct pci_dev *pdev)
5521 pci_restore_state(pdev); 5521 pci_restore_state(pdev);
5522 pci_enable_wake(pdev, pci_choose_state(pdev, ai->power), 0); 5522 pci_enable_wake(pdev, pci_choose_state(pdev, ai->power), 0);
5523 5523
5524 if (ai->power > 1) { 5524 if (ai->power.event > 1) {
5525 reset_card(dev, 0); 5525 reset_card(dev, 0);
5526 mpi_init_descriptors(ai); 5526 mpi_init_descriptors(ai);
5527 setup_card(ai, dev->dev_addr, 0); 5527 setup_card(ai, dev->dev_addr, 0);
@@ -7123,7 +7123,7 @@ static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
7123 int rc = 0; 7123 int rc = 0;
7124 struct airo_info *ai = (struct airo_info *)dev->priv; 7124 struct airo_info *ai = (struct airo_info *)dev->priv;
7125 7125
7126 if (ai->power) 7126 if (ai->power.event)
7127 return 0; 7127 return 0;
7128 7128
7129 switch (cmd) { 7129 switch (cmd) {
@@ -7202,7 +7202,7 @@ static void airo_read_wireless_stats(struct airo_info *local)
7202 7202
7203 /* Get stats out of the card */ 7203 /* Get stats out of the card */
7204 clear_bit(JOB_WSTATS, &local->flags); 7204 clear_bit(JOB_WSTATS, &local->flags);
7205 if (local->power) { 7205 if (local->power.event) {
7206 up(&local->sem); 7206 up(&local->sem);
7207 return; 7207 return;
7208 } 7208 }
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 1b34fc56067e..c62d2f043397 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -333,13 +333,17 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
333 if (platform_pci_choose_state) { 333 if (platform_pci_choose_state) {
334 ret = platform_pci_choose_state(dev, state); 334 ret = platform_pci_choose_state(dev, state);
335 if (ret >= 0) 335 if (ret >= 0)
336 state = ret; 336 state.event = ret;
337 } 337 }
338 switch (state) { 338
339 case 0: return PCI_D0; 339 switch (state.event) {
340 case 3: return PCI_D3hot; 340 case PM_EVENT_ON:
341 return PCI_D0;
342 case PM_EVENT_FREEZE:
343 case PM_EVENT_SUSPEND:
344 return PCI_D3hot;
341 default: 345 default:
342 printk("They asked me for state %d\n", state); 346 printk("They asked me for state %d\n", state.event);
343 BUG(); 347 BUG();
344 } 348 }
345 return PCI_D0; 349 return PCI_D0;
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index ff1933298da6..a4857db4f9b8 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -1766,7 +1766,7 @@ static int mesh_suspend(struct macio_dev *mdev, pm_message_t state)
1766 struct mesh_state *ms = (struct mesh_state *)macio_get_drvdata(mdev); 1766 struct mesh_state *ms = (struct mesh_state *)macio_get_drvdata(mdev);
1767 unsigned long flags; 1767 unsigned long flags;
1768 1768
1769 if (state == mdev->ofdev.dev.power.power_state || state < 2) 1769 if (state.event == mdev->ofdev.dev.power.power_state.event || state.event < 2)
1770 return 0; 1770 return 0;
1771 1771
1772 scsi_block_requests(ms->host); 1772 scsi_block_requests(ms->host);
@@ -1791,7 +1791,7 @@ static int mesh_resume(struct macio_dev *mdev)
1791 struct mesh_state *ms = (struct mesh_state *)macio_get_drvdata(mdev); 1791 struct mesh_state *ms = (struct mesh_state *)macio_get_drvdata(mdev);
1792 unsigned long flags; 1792 unsigned long flags;
1793 1793
1794 if (mdev->ofdev.dev.power.power_state == 0) 1794 if (mdev->ofdev.dev.power.power_state.event == PM_EVENT_ON)
1795 return 0; 1795 return 0;
1796 1796
1797 set_mesh_power(ms, 1); 1797 set_mesh_power(ms, 1);
@@ -1802,7 +1802,7 @@ static int mesh_resume(struct macio_dev *mdev)
1802 enable_irq(ms->meshintr); 1802 enable_irq(ms->meshintr);
1803 scsi_unblock_requests(ms->host); 1803 scsi_unblock_requests(ms->host);
1804 1804
1805 mdev->ofdev.dev.power.power_state = 0; 1805 mdev->ofdev.dev.power.power_state.event = PM_EVENT_ON;
1806 1806
1807 return 0; 1807 return 0;
1808} 1808}
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 5bfde99e245e..5ddd8ab1f108 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -1600,7 +1600,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state)
1600 return 0; 1600 return 0;
1601 } 1601 }
1602 1602
1603 if (pm_state == mdev->ofdev.dev.power.power_state || pm_state < 2) 1603 if (pm_state.event == mdev->ofdev.dev.power.power_state.event)
1604 return 0; 1604 return 0;
1605 1605
1606 pmz_debug("suspend, switching to state %d\n", pm_state); 1606 pmz_debug("suspend, switching to state %d\n", pm_state);
@@ -1660,7 +1660,7 @@ static int pmz_resume(struct macio_dev *mdev)
1660 if (uap == NULL) 1660 if (uap == NULL)
1661 return 0; 1661 return 0;
1662 1662
1663 if (mdev->ofdev.dev.power.power_state == 0) 1663 if (mdev->ofdev.dev.power.power_state.event == PM_EVENT_ON)
1664 return 0; 1664 return 0;
1665 1665
1666 pmz_debug("resume, switching to state 0\n"); 1666 pmz_debug("resume, switching to state 0\n");
@@ -1713,7 +1713,7 @@ static int pmz_resume(struct macio_dev *mdev)
1713 1713
1714 pmz_debug("resume, switching complete\n"); 1714 pmz_debug("resume, switching complete\n");
1715 1715
1716 mdev->ofdev.dev.power.power_state = 0; 1716 mdev->ofdev.dev.power.power_state.event = PM_EVENT_ON;
1717 1717
1718 return 0; 1718 return 0;
1719} 1719}
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index c3e46d24a37e..c9412daff682 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1570,7 +1570,7 @@ static int __usb_suspend_device (struct usb_device *udev, int port1,
1570 struct usb_driver *driver; 1570 struct usb_driver *driver;
1571 1571
1572 intf = udev->actconfig->interface[i]; 1572 intf = udev->actconfig->interface[i];
1573 if (state <= intf->dev.power.power_state) 1573 if (state.event <= intf->dev.power.power_state.event)
1574 continue; 1574 continue;
1575 if (!intf->dev.driver) 1575 if (!intf->dev.driver)
1576 continue; 1576 continue;
@@ -1578,11 +1578,11 @@ static int __usb_suspend_device (struct usb_device *udev, int port1,
1578 1578
1579 if (driver->suspend) { 1579 if (driver->suspend) {
1580 status = driver->suspend(intf, state); 1580 status = driver->suspend(intf, state);
1581 if (intf->dev.power.power_state != state 1581 if (intf->dev.power.power_state.event != state.event
1582 || status) 1582 || status)
1583 dev_err(&intf->dev, 1583 dev_err(&intf->dev,
1584 "suspend %d fail, code %d\n", 1584 "suspend %d fail, code %d\n",
1585 state, status); 1585 state.event, status);
1586 } 1586 }
1587 1587
1588 /* only drivers with suspend() can ever resume(); 1588 /* only drivers with suspend() can ever resume();
@@ -1595,7 +1595,7 @@ static int __usb_suspend_device (struct usb_device *udev, int port1,
1595 * since we know every driver's probe/disconnect works 1595 * since we know every driver's probe/disconnect works
1596 * even for drivers that can't suspend. 1596 * even for drivers that can't suspend.
1597 */ 1597 */
1598 if (!driver->suspend || state > PM_SUSPEND_MEM) { 1598 if (!driver->suspend || state.event > PM_EVENT_FREEZE) {
1599#if 1 1599#if 1
1600 dev_warn(&intf->dev, "resume is unsafe!\n"); 1600 dev_warn(&intf->dev, "resume is unsafe!\n");
1601#else 1601#else
@@ -1616,7 +1616,7 @@ static int __usb_suspend_device (struct usb_device *udev, int port1,
1616 * policies (when HNP doesn't apply) once we have mechanisms to 1616 * policies (when HNP doesn't apply) once we have mechanisms to
1617 * turn power back on! (Likely not before 2.7...) 1617 * turn power back on! (Likely not before 2.7...)
1618 */ 1618 */
1619 if (state > PM_SUSPEND_MEM) { 1619 if (state.event > PM_EVENT_FREEZE) {
1620 dev_warn(&udev->dev, "no poweroff yet, suspending instead\n"); 1620 dev_warn(&udev->dev, "no poweroff yet, suspending instead\n");
1621 } 1621 }
1622 1622
@@ -1733,7 +1733,7 @@ static int finish_port_resume(struct usb_device *udev)
1733 struct usb_driver *driver; 1733 struct usb_driver *driver;
1734 1734
1735 intf = udev->actconfig->interface[i]; 1735 intf = udev->actconfig->interface[i];
1736 if (intf->dev.power.power_state == PMSG_ON) 1736 if (intf->dev.power.power_state.event == PM_EVENT_ON)
1737 continue; 1737 continue;
1738 if (!intf->dev.driver) { 1738 if (!intf->dev.driver) {
1739 /* FIXME maybe force to alt 0 */ 1739 /* FIXME maybe force to alt 0 */
@@ -1747,11 +1747,11 @@ static int finish_port_resume(struct usb_device *udev)
1747 1747
1748 /* can we do better than just logging errors? */ 1748 /* can we do better than just logging errors? */
1749 status = driver->resume(intf); 1749 status = driver->resume(intf);
1750 if (intf->dev.power.power_state != PMSG_ON 1750 if (intf->dev.power.power_state.event != PM_EVENT_ON
1751 || status) 1751 || status)
1752 dev_dbg(&intf->dev, 1752 dev_dbg(&intf->dev,
1753 "resume fail, state %d code %d\n", 1753 "resume fail, state %d code %d\n",
1754 intf->dev.power.power_state, status); 1754 intf->dev.power.power_state.event, status);
1755 } 1755 }
1756 status = 0; 1756 status = 0;
1757 1757
@@ -1934,7 +1934,7 @@ static int hub_resume(struct usb_interface *intf)
1934 unsigned port1; 1934 unsigned port1;
1935 int status; 1935 int status;
1936 1936
1937 if (intf->dev.power.power_state == PM_SUSPEND_ON) 1937 if (intf->dev.power.power_state.event == PM_EVENT_ON)
1938 return 0; 1938 return 0;
1939 1939
1940 for (port1 = 1; port1 <= hdev->maxchild; port1++) { 1940 for (port1 = 1; port1 <= hdev->maxchild; port1++) {
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 99c85d2f92da..2cddd8a00437 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -1400,7 +1400,7 @@ static int usb_generic_suspend(struct device *dev, pm_message_t message)
1400 driver = to_usb_driver(dev->driver); 1400 driver = to_usb_driver(dev->driver);
1401 1401
1402 /* there's only one USB suspend state */ 1402 /* there's only one USB suspend state */
1403 if (intf->dev.power.power_state) 1403 if (intf->dev.power.power_state.event)
1404 return 0; 1404 return 0;
1405 1405
1406 if (driver->suspend) 1406 if (driver->suspend)
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index b01efb6b36f6..65ac9fef3a7c 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -641,7 +641,7 @@ show_registers (struct class_device *class_dev, char *buf)
641 641
642 spin_lock_irqsave (&ehci->lock, flags); 642 spin_lock_irqsave (&ehci->lock, flags);
643 643
644 if (bus->controller->power.power_state) { 644 if (bus->controller->power.power_state.event) {
645 size = scnprintf (next, size, 645 size = scnprintf (next, size,
646 "bus %s, device %s (driver " DRIVER_VERSION ")\n" 646 "bus %s, device %s (driver " DRIVER_VERSION ")\n"
647 "%s\n" 647 "%s\n"
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index c58408c95c3d..447f488f5d93 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -631,7 +631,7 @@ show_registers (struct class_device *class_dev, char *buf)
631 hcd->product_desc, 631 hcd->product_desc,
632 hcd_name); 632 hcd_name);
633 633
634 if (bus->controller->power.power_state) { 634 if (bus->controller->power.power_state.event) {
635 size -= scnprintf (next, size, 635 size -= scnprintf (next, size,
636 "SUSPENDED (no register access)\n"); 636 "SUSPENDED (no register access)\n");
637 goto done; 637 goto done;
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 7a890a65f55d..80eaf659c198 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1781,9 +1781,9 @@ sl811h_suspend(struct device *dev, pm_message_t state, u32 phase)
1781 if (phase != SUSPEND_POWER_DOWN) 1781 if (phase != SUSPEND_POWER_DOWN)
1782 return retval; 1782 return retval;
1783 1783
1784 if (state <= PM_SUSPEND_MEM) 1784 if (state.event == PM_EVENT_FREEZE)
1785 retval = sl811h_hub_suspend(hcd); 1785 retval = sl811h_hub_suspend(hcd);
1786 else 1786 else if (state.event == PM_EVENT_SUSPEND)
1787 port_power(sl811, 0); 1787 port_power(sl811, 0);
1788 if (retval == 0) 1788 if (retval == 0)
1789 dev->power.power_state = state; 1789 dev->power.power_state = state;
@@ -1802,7 +1802,7 @@ sl811h_resume(struct device *dev, u32 phase)
1802 /* with no "check to see if VBUS is still powered" board hook, 1802 /* with no "check to see if VBUS is still powered" board hook,
1803 * let's assume it'd only be powered to enable remote wakeup. 1803 * let's assume it'd only be powered to enable remote wakeup.
1804 */ 1804 */
1805 if (dev->power.power_state > PM_SUSPEND_MEM 1805 if (dev->power.power_state.event == PM_EVENT_SUSPEND
1806 || !hcd->can_wakeup) { 1806 || !hcd->can_wakeup) {
1807 sl811->port1 = 0; 1807 sl811->port1 = 0;
1808 port_power(sl811, 1); 1808 port_power(sl811, 1);
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index cda7249a90b2..fd7fb98e4b20 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -1533,7 +1533,7 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
1533 if (down_interruptible (&dev->sem)) 1533 if (down_interruptible (&dev->sem))
1534 return -ERESTARTSYS; 1534 return -ERESTARTSYS;
1535 1535
1536 if (intf->dev.power.power_state != PMSG_ON) { 1536 if (intf->dev.power.power_state.event != PM_EVENT_ON) {
1537 up (&dev->sem); 1537 up (&dev->sem);
1538 return -EHOSTUNREACH; 1538 return -EHOSTUNREACH;
1539 } 1539 }
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index 7bc1d44d8814..b0eba3ac6420 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -2323,17 +2323,16 @@ static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state)
2323 * can properly take care of D3 ? Also, with swsusp, we 2323 * can properly take care of D3 ? Also, with swsusp, we
2324 * know we'll be rebooted, ... 2324 * know we'll be rebooted, ...
2325 */ 2325 */
2326#ifdef CONFIG_PPC_PMAC 2326#ifndef CONFIG_PPC_PMAC
2327 /* HACK ALERT ! Once I find a proper way to say to each driver 2327 /* HACK ALERT ! Once I find a proper way to say to each driver
2328 * individually what will happen with it's PCI slot, I'll change 2328 * individually what will happen with it's PCI slot, I'll change
2329 * that. On laptops, the AGP slot is just unclocked, so D2 is 2329 * that. On laptops, the AGP slot is just unclocked, so D2 is
2330 * expected, while on desktops, the card is powered off 2330 * expected, while on desktops, the card is powered off
2331 */ 2331 */
2332 if (state >= 3) 2332 return 0;
2333 state = 2;
2334#endif /* CONFIG_PPC_PMAC */ 2333#endif /* CONFIG_PPC_PMAC */
2335 2334
2336 if (state != 2 || state == pdev->dev.power.power_state) 2335 if (state.event == pdev->dev.power.power_state.event)
2337 return 0; 2336 return 0;
2338 2337
2339 printk(KERN_DEBUG "aty128fb: suspending...\n"); 2338 printk(KERN_DEBUG "aty128fb: suspending...\n");
@@ -2367,7 +2366,7 @@ static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state)
2367 * used dummy fb ops, 2.5 need proper support for this at the 2366 * used dummy fb ops, 2.5 need proper support for this at the
2368 * fbdev level 2367 * fbdev level
2369 */ 2368 */
2370 if (state == 2) 2369 if (state.event != PM_EVENT_ON)
2371 aty128_set_suspend(par, 1); 2370 aty128_set_suspend(par, 1);
2372 2371
2373 release_console_sem(); 2372 release_console_sem();
@@ -2382,12 +2381,11 @@ static int aty128_do_resume(struct pci_dev *pdev)
2382 struct fb_info *info = pci_get_drvdata(pdev); 2381 struct fb_info *info = pci_get_drvdata(pdev);
2383 struct aty128fb_par *par = info->par; 2382 struct aty128fb_par *par = info->par;
2384 2383
2385 if (pdev->dev.power.power_state == 0) 2384 if (pdev->dev.power.power_state.event == PM_EVENT_ON)
2386 return 0; 2385 return 0;
2387 2386
2388 /* Wakeup chip */ 2387 /* Wakeup chip */
2389 if (pdev->dev.power.power_state == 2) 2388 aty128_set_suspend(par, 0);
2390 aty128_set_suspend(par, 0);
2391 par->asleep = 0; 2389 par->asleep = 0;
2392 2390
2393 /* Restore display & engine */ 2391 /* Restore display & engine */
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 8c42538dc8c1..3e10bd837d9e 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -2022,17 +2022,16 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
2022 struct fb_info *info = pci_get_drvdata(pdev); 2022 struct fb_info *info = pci_get_drvdata(pdev);
2023 struct atyfb_par *par = (struct atyfb_par *) info->par; 2023 struct atyfb_par *par = (struct atyfb_par *) info->par;
2024 2024
2025#ifdef CONFIG_PPC_PMAC 2025#ifndef CONFIG_PPC_PMAC
2026 /* HACK ALERT ! Once I find a proper way to say to each driver 2026 /* HACK ALERT ! Once I find a proper way to say to each driver
2027 * individually what will happen with it's PCI slot, I'll change 2027 * individually what will happen with it's PCI slot, I'll change
2028 * that. On laptops, the AGP slot is just unclocked, so D2 is 2028 * that. On laptops, the AGP slot is just unclocked, so D2 is
2029 * expected, while on desktops, the card is powered off 2029 * expected, while on desktops, the card is powered off
2030 */ 2030 */
2031 if (state >= 3) 2031 return 0;
2032 state = 2;
2033#endif /* CONFIG_PPC_PMAC */ 2032#endif /* CONFIG_PPC_PMAC */
2034 2033
2035 if (state != 2 || state == pdev->dev.power.power_state) 2034 if (state.event == pdev->dev.power.power_state.event)
2036 return 0; 2035 return 0;
2037 2036
2038 acquire_console_sem(); 2037 acquire_console_sem();
@@ -2071,12 +2070,12 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
2071 struct fb_info *info = pci_get_drvdata(pdev); 2070 struct fb_info *info = pci_get_drvdata(pdev);
2072 struct atyfb_par *par = (struct atyfb_par *) info->par; 2071 struct atyfb_par *par = (struct atyfb_par *) info->par;
2073 2072
2074 if (pdev->dev.power.power_state == 0) 2073 if (pdev->dev.power.power_state.event == PM_EVENT_ON)
2075 return 0; 2074 return 0;
2076 2075
2077 acquire_console_sem(); 2076 acquire_console_sem();
2078 2077
2079 if (pdev->dev.power.power_state == 2) 2078 if (pdev->dev.power.power_state.event == 2)
2080 aty_power_mgmt(0, par); 2079 aty_power_mgmt(0, par);
2081 par->asleep = 0; 2080 par->asleep = 0;
2082 2081
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
index 98352af39325..59a1b6f85067 100644
--- a/drivers/video/aty/radeon_pm.c
+++ b/drivers/video/aty/radeon_pm.c
@@ -2526,18 +2526,18 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
2526 struct radeonfb_info *rinfo = info->par; 2526 struct radeonfb_info *rinfo = info->par;
2527 int i; 2527 int i;
2528 2528
2529 if (state == pdev->dev.power.power_state) 2529 if (state.event == pdev->dev.power.power_state.event)
2530 return 0; 2530 return 0;
2531 2531
2532 printk(KERN_DEBUG "radeonfb (%s): suspending to state: %d...\n", 2532 printk(KERN_DEBUG "radeonfb (%s): suspending to state: %d...\n",
2533 pci_name(pdev), state); 2533 pci_name(pdev), state.event);
2534 2534
2535 /* For suspend-to-disk, we cheat here. We don't suspend anything and 2535 /* For suspend-to-disk, we cheat here. We don't suspend anything and
2536 * let fbcon continue drawing until we are all set. That shouldn't 2536 * let fbcon continue drawing until we are all set. That shouldn't
2537 * really cause any problem at this point, provided that the wakeup 2537 * really cause any problem at this point, provided that the wakeup
2538 * code knows that any state in memory may not match the HW 2538 * code knows that any state in memory may not match the HW
2539 */ 2539 */
2540 if (state != PM_SUSPEND_MEM) 2540 if (state.event == PM_EVENT_FREEZE)
2541 goto done; 2541 goto done;
2542 2542
2543 acquire_console_sem(); 2543 acquire_console_sem();
@@ -2616,7 +2616,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
2616 struct radeonfb_info *rinfo = info->par; 2616 struct radeonfb_info *rinfo = info->par;
2617 int rc = 0; 2617 int rc = 0;
2618 2618
2619 if (pdev->dev.power.power_state == 0) 2619 if (pdev->dev.power.power_state.event == PM_EVENT_ON)
2620 return 0; 2620 return 0;
2621 2621
2622 if (rinfo->no_schedule) { 2622 if (rinfo->no_schedule) {
@@ -2626,7 +2626,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
2626 acquire_console_sem(); 2626 acquire_console_sem();
2627 2627
2628 printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n", 2628 printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n",
2629 pci_name(pdev), pdev->dev.power.power_state); 2629 pci_name(pdev), pdev->dev.power.power_state.event);
2630 2630
2631 2631
2632 if (pci_enable_device(pdev)) { 2632 if (pci_enable_device(pdev)) {
@@ -2637,7 +2637,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
2637 } 2637 }
2638 pci_set_master(pdev); 2638 pci_set_master(pdev);
2639 2639
2640 if (pdev->dev.power.power_state == PM_SUSPEND_MEM) { 2640 if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
2641 /* Wakeup chip. Check from config space if we were powered off 2641 /* Wakeup chip. Check from config space if we were powered off
2642 * (todo: additionally, check CLK_PIN_CNTL too) 2642 * (todo: additionally, check CLK_PIN_CNTL too)
2643 */ 2643 */
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c
index e75a965ec760..4131243cfdf8 100644
--- a/drivers/video/chipsfb.c
+++ b/drivers/video/chipsfb.c
@@ -462,9 +462,9 @@ static int chipsfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
462{ 462{
463 struct fb_info *p = pci_get_drvdata(pdev); 463 struct fb_info *p = pci_get_drvdata(pdev);
464 464
465 if (state == pdev->dev.power.power_state) 465 if (state.event == pdev->dev.power.power_state.event)
466 return 0; 466 return 0;
467 if (state != PM_SUSPEND_MEM) 467 if (state.event != PM_SUSPEND_MEM)
468 goto done; 468 goto done;
469 469
470 acquire_console_sem(); 470 acquire_console_sem();
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
index 7513fb9b19cf..6db183462b92 100644
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -1506,12 +1506,12 @@ static int i810fb_suspend(struct pci_dev *dev, pm_message_t state)
1506 struct i810fb_par *par = (struct i810fb_par *) info->par; 1506 struct i810fb_par *par = (struct i810fb_par *) info->par;
1507 int blank = 0, prev_state = par->cur_state; 1507 int blank = 0, prev_state = par->cur_state;
1508 1508
1509 if (state == prev_state) 1509 if (state.event == prev_state)
1510 return 0; 1510 return 0;
1511 1511
1512 par->cur_state = state; 1512 par->cur_state = state.event;
1513 1513
1514 switch (state) { 1514 switch (state.event) {
1515 case 1: 1515 case 1:
1516 blank = VESA_VSYNC_SUSPEND; 1516 blank = VESA_VSYNC_SUSPEND;
1517 break; 1517 break;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 7aeb208ed713..5cfb07648eca 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -186,7 +186,9 @@ extern int pm_suspend(suspend_state_t state);
186 186
187struct device; 187struct device;
188 188
189typedef u32 __bitwise pm_message_t; 189typedef struct pm_message {
190 int event;
191} pm_message_t;
190 192
191/* 193/*
192 * There are 4 important states driver can be in: 194 * There are 4 important states driver can be in:
@@ -207,9 +209,13 @@ typedef u32 __bitwise pm_message_t;
207 * or something similar soon. 209 * or something similar soon.
208 */ 210 */
209 211
210#define PMSG_FREEZE ((__force pm_message_t) 3) 212#define PM_EVENT_ON 0
211#define PMSG_SUSPEND ((__force pm_message_t) 3) 213#define PM_EVENT_FREEZE 1
212#define PMSG_ON ((__force pm_message_t) 0) 214#define PM_EVENT_SUSPEND 2
215
216#define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, })
217#define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, })
218#define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, })
213 219
214struct dev_pm_info { 220struct dev_pm_info {
215 pm_message_t power_state; 221 pm_message_t power_state;