Commit ca078bae authored by Pavel Machek's avatar Pavel Machek Committed by Linus Torvalds

[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: default avatarPavel Machek <pavel@suse.cz>
Signed-off-by: default avatarAlexander Nyberg <alexn@telia.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 829ca9a3
...@@ -105,7 +105,7 @@ static int of_device_remove(struct device *dev) ...@@ -105,7 +105,7 @@ static int of_device_remove(struct device *dev)
return 0; return 0;
} }
static int of_device_suspend(struct device *dev, u32 state) static int of_device_suspend(struct device *dev, pm_message_t state)
{ {
struct of_device * of_dev = to_of_device(dev); struct of_device * of_dev = to_of_device(dev);
struct of_platform_driver * drv = to_of_platform_driver(dev->driver); struct of_platform_driver * drv = to_of_platform_driver(dev->driver);
......
...@@ -26,11 +26,11 @@ int resume_device(struct device * dev) ...@@ -26,11 +26,11 @@ int resume_device(struct device * dev)
down(&dev->sem); down(&dev->sem);
if (dev->power.pm_parent if (dev->power.pm_parent
&& dev->power.pm_parent->power.power_state) { && dev->power.pm_parent->power.power_state.event) {
dev_err(dev, "PM: resume from %d, parent %s still %d\n", dev_err(dev, "PM: resume from %d, parent %s still %d\n",
dev->power.power_state, dev->power.power_state.event,
dev->power.pm_parent->bus_id, dev->power.pm_parent->bus_id,
dev->power.pm_parent->power.power_state); dev->power.pm_parent->power.power_state.event);
} }
if (dev->bus && dev->bus->resume) { if (dev->bus && dev->bus->resume) {
dev_dbg(dev,"resuming\n"); dev_dbg(dev,"resuming\n");
...@@ -54,7 +54,7 @@ void dpm_resume(void) ...@@ -54,7 +54,7 @@ void dpm_resume(void)
list_add_tail(entry, &dpm_active); list_add_tail(entry, &dpm_active);
up(&dpm_list_sem); up(&dpm_list_sem);
if (!dev->power.prev_state) if (!dev->power.prev_state.event)
resume_device(dev); resume_device(dev);
down(&dpm_list_sem); down(&dpm_list_sem);
put_device(dev); put_device(dev);
......
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
static void runtime_resume(struct device * dev) static void runtime_resume(struct device * dev)
{ {
dev_dbg(dev, "resuming\n"); dev_dbg(dev, "resuming\n");
if (!dev->power.power_state) if (!dev->power.power_state.event)
return; return;
if (!resume_device(dev)) if (!resume_device(dev))
dev->power.power_state = 0; dev->power.power_state = PMSG_ON;
} }
...@@ -49,10 +49,10 @@ int dpm_runtime_suspend(struct device * dev, pm_message_t state) ...@@ -49,10 +49,10 @@ int dpm_runtime_suspend(struct device * dev, pm_message_t state)
int error = 0; int error = 0;
down(&dpm_sem); down(&dpm_sem);
if (dev->power.power_state == state) if (dev->power.power_state.event == state.event)
goto Done; goto Done;
if (dev->power.power_state) if (dev->power.power_state.event)
runtime_resume(dev); runtime_resume(dev);
if (!(error = suspend_device(dev, state))) if (!(error = suspend_device(dev, state)))
......
...@@ -40,22 +40,22 @@ int suspend_device(struct device * dev, pm_message_t state) ...@@ -40,22 +40,22 @@ int suspend_device(struct device * dev, pm_message_t state)
int error = 0; int error = 0;
down(&dev->sem); down(&dev->sem);
if (dev->power.power_state) { if (dev->power.power_state.event) {
dev_dbg(dev, "PM: suspend %d-->%d\n", dev_dbg(dev, "PM: suspend %d-->%d\n",
dev->power.power_state, state); dev->power.power_state.event, state.event);
} }
if (dev->power.pm_parent if (dev->power.pm_parent
&& dev->power.pm_parent->power.power_state) { && dev->power.pm_parent->power.power_state.event) {
dev_err(dev, dev_err(dev,
"PM: suspend %d->%d, parent %s already %d\n", "PM: suspend %d->%d, parent %s already %d\n",
dev->power.power_state, state, dev->power.power_state.event, state.event,
dev->power.pm_parent->bus_id, dev->power.pm_parent->bus_id,
dev->power.pm_parent->power.power_state); dev->power.pm_parent->power.power_state.event);
} }
dev->power.prev_state = dev->power.power_state; dev->power.prev_state = dev->power.power_state;
if (dev->bus && dev->bus->suspend && !dev->power.power_state) { if (dev->bus && dev->bus->suspend && !dev->power.power_state.event) {
dev_dbg(dev, "suspending\n"); dev_dbg(dev, "suspending\n");
error = dev->bus->suspend(dev, state); error = dev->bus->suspend(dev, state);
} }
......
...@@ -26,19 +26,19 @@ ...@@ -26,19 +26,19 @@
static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf) static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf)
{ {
return sprintf(buf, "%u\n", dev->power.power_state); return sprintf(buf, "%u\n", dev->power.power_state.event);
} }
static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n) static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n)
{ {
u32 state; pm_message_t state;
char * rest; char * rest;
int error = 0; int error = 0;
state = simple_strtoul(buf, &rest, 10); state.event = simple_strtoul(buf, &rest, 10);
if (*rest) if (*rest)
return -EINVAL; return -EINVAL;
if (state) if (state.event)
error = dpm_runtime_suspend(dev, state); error = dpm_runtime_suspend(dev, state);
else else
dpm_runtime_resume(dev); dpm_runtime_resume(dev);
......
...@@ -1229,7 +1229,7 @@ static int generic_ide_suspend(struct device *dev, pm_message_t state) ...@@ -1229,7 +1229,7 @@ static int generic_ide_suspend(struct device *dev, pm_message_t state)
rq.special = &args; rq.special = &args;
rq.pm = &rqpm; rq.pm = &rqpm;
rqpm.pm_step = ide_pm_state_start_suspend; rqpm.pm_step = ide_pm_state_start_suspend;
rqpm.pm_state = state; rqpm.pm_state = state.event;
return ide_do_drive_cmd(drive, &rq, ide_wait); return ide_do_drive_cmd(drive, &rq, ide_wait);
} }
...@@ -1248,7 +1248,7 @@ static int generic_ide_resume(struct device *dev) ...@@ -1248,7 +1248,7 @@ static int generic_ide_resume(struct device *dev)
rq.special = &args; rq.special = &args;
rq.pm = &rqpm; rq.pm = &rqpm;
rqpm.pm_step = ide_pm_state_start_resume; rqpm.pm_step = ide_pm_state_start_resume;
rqpm.pm_state = 0; rqpm.pm_state = PM_EVENT_ON;
return ide_do_drive_cmd(drive, &rq, ide_head_wait); return ide_do_drive_cmd(drive, &rq, ide_head_wait);
} }
......
...@@ -350,9 +350,9 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state) ...@@ -350,9 +350,9 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state)
{ {
ide_hwif_t *hwif = NULL; ide_hwif_t *hwif = NULL;
printk("SC1200: suspend(%u)\n", state); printk("SC1200: suspend(%u)\n", state.event);
if (state == 0) { if (state.event == PM_EVENT_ON) {
// we only save state when going from full power to less // we only save state when going from full power to less
// //
...@@ -386,8 +386,8 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state) ...@@ -386,8 +386,8 @@ static int sc1200_suspend (struct pci_dev *dev, pm_message_t state)
/* You don't need to iterate over disks -- sysfs should have done that for you already */ /* You don't need to iterate over disks -- sysfs should have done that for you already */
pci_disable_device(dev); pci_disable_device(dev);
pci_set_power_state(dev,state); pci_set_power_state(dev, pci_choose_state(dev, state));
dev->current_state = state; dev->current_state = state.event;
return 0; return 0;
} }
...@@ -396,8 +396,8 @@ static int sc1200_resume (struct pci_dev *dev) ...@@ -396,8 +396,8 @@ static int sc1200_resume (struct pci_dev *dev)
ide_hwif_t *hwif = NULL; ide_hwif_t *hwif = NULL;
printk("SC1200: resume\n"); printk("SC1200: resume\n");
pci_set_power_state(dev,0); // bring chip back from sleep state pci_set_power_state(dev, PCI_D0); // bring chip back from sleep state
dev->current_state = 0; dev->current_state = PM_EVENT_ON;
pci_enable_device(dev); pci_enable_device(dev);
// //
// loop over all interfaces that are part of this pci device: // loop over all interfaces that are part of this pci device:
......
...@@ -1509,7 +1509,7 @@ pmac_ide_macio_suspend(struct macio_dev *mdev, pm_message_t state) ...@@ -1509,7 +1509,7 @@ pmac_ide_macio_suspend(struct macio_dev *mdev, pm_message_t state)
ide_hwif_t *hwif = (ide_hwif_t *)dev_get_drvdata(&mdev->ofdev.dev); ide_hwif_t *hwif = (ide_hwif_t *)dev_get_drvdata(&mdev->ofdev.dev);
int rc = 0; int rc = 0;
if (state != mdev->ofdev.dev.power.power_state && state >= 2) { if (state.event != mdev->ofdev.dev.power.power_state.event && state.event >= PM_EVENT_SUSPEND) {
rc = pmac_ide_do_suspend(hwif); rc = pmac_ide_do_suspend(hwif);
if (rc == 0) if (rc == 0)
mdev->ofdev.dev.power.power_state = state; mdev->ofdev.dev.power.power_state = state;
...@@ -1524,7 +1524,7 @@ pmac_ide_macio_resume(struct macio_dev *mdev) ...@@ -1524,7 +1524,7 @@ pmac_ide_macio_resume(struct macio_dev *mdev)
ide_hwif_t *hwif = (ide_hwif_t *)dev_get_drvdata(&mdev->ofdev.dev); ide_hwif_t *hwif = (ide_hwif_t *)dev_get_drvdata(&mdev->ofdev.dev);
int rc = 0; int rc = 0;
if (mdev->ofdev.dev.power.power_state != 0) { if (mdev->ofdev.dev.power.power_state.event != PM_EVENT_ON) {
rc = pmac_ide_do_resume(hwif); rc = pmac_ide_do_resume(hwif);
if (rc == 0) if (rc == 0)
mdev->ofdev.dev.power.power_state = PMSG_ON; 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,7 +1613,7 @@ pmac_ide_pci_suspend(struct pci_dev *pdev, pm_message_t state)
ide_hwif_t *hwif = (ide_hwif_t *)pci_get_drvdata(pdev); ide_hwif_t *hwif = (ide_hwif_t *)pci_get_drvdata(pdev);
int rc = 0; int rc = 0;
if (state != pdev->dev.power.power_state && state >= 2) { if (state.event != pdev->dev.power.power_state.event && state.event >= 2) {
rc = pmac_ide_do_suspend(hwif); rc = pmac_ide_do_suspend(hwif);
if (rc == 0) if (rc == 0)
pdev->dev.power.power_state = state; pdev->dev.power.power_state = state;
...@@ -1628,7 +1628,7 @@ pmac_ide_pci_resume(struct pci_dev *pdev) ...@@ -1628,7 +1628,7 @@ pmac_ide_pci_resume(struct pci_dev *pdev)
ide_hwif_t *hwif = (ide_hwif_t *)pci_get_drvdata(pdev); ide_hwif_t *hwif = (ide_hwif_t *)pci_get_drvdata(pdev);
int rc = 0; int rc = 0;
if (pdev->dev.power.power_state != 0) { if (pdev->dev.power.power_state.event != PM_EVENT_ON) {
rc = pmac_ide_do_resume(hwif); rc = pmac_ide_do_resume(hwif);
if (rc == 0) if (rc == 0)
pdev->dev.power.power_state = PMSG_ON; pdev->dev.power.power_state = PMSG_ON;
......
...@@ -708,7 +708,7 @@ static int __pmac media_bay_suspend(struct macio_dev *mdev, pm_message_t state) ...@@ -708,7 +708,7 @@ static int __pmac media_bay_suspend(struct macio_dev *mdev, pm_message_t state)
{ {
struct media_bay_info *bay = macio_get_drvdata(mdev); struct media_bay_info *bay = macio_get_drvdata(mdev);
if (state != mdev->ofdev.dev.power.power_state && state == PM_SUSPEND_MEM) { if (state.event != mdev->ofdev.dev.power.power_state.event && state.event == PM_EVENT_SUSPEND) {
down(&bay->lock); down(&bay->lock);
bay->sleeping = 1; bay->sleeping = 1;
set_mb_power(bay, 0); set_mb_power(bay, 0);
...@@ -723,7 +723,7 @@ static int __pmac media_bay_resume(struct macio_dev *mdev) ...@@ -723,7 +723,7 @@ static int __pmac media_bay_resume(struct macio_dev *mdev)
{ {
struct media_bay_info *bay = macio_get_drvdata(mdev); struct media_bay_info *bay = macio_get_drvdata(mdev);
if (mdev->ofdev.dev.power.power_state != 0) { if (mdev->ofdev.dev.power.power_state.event != PM_EVENT_ON) {
mdev->ofdev.dev.power.power_state = PMSG_ON; mdev->ofdev.dev.power.power_state = PMSG_ON;
/* We re-enable the bay using it's previous content /* We re-enable the bay using it's previous content
......
...@@ -3065,7 +3065,7 @@ static int pmu_sys_suspended = 0; ...@@ -3065,7 +3065,7 @@ static int pmu_sys_suspended = 0;
static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state) static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state)
{ {
if (state != PM_SUSPEND_DISK || pmu_sys_suspended) if (state.event != PM_EVENT_SUSPEND || pmu_sys_suspended)
return 0; return 0;
/* Suspend PMU event interrupts */ /* Suspend PMU event interrupts */
......
...@@ -888,7 +888,7 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state) ...@@ -888,7 +888,7 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state)
if (down_interruptible(&cinergyt2->sem)) if (down_interruptible(&cinergyt2->sem))
return -ERESTARTSYS; return -ERESTARTSYS;
if (state > 0) { /* state 0 seems to mean DEVICE_PM_ON */ if (state.event > PM_EVENT_ON) {
struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf);
#ifdef ENABLE_RC #ifdef ENABLE_RC
cancel_delayed_work(&cinergyt2->rc_query_work); cancel_delayed_work(&cinergyt2->rc_query_work);
......
...@@ -1757,12 +1757,12 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -1757,12 +1757,12 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
idev = ndev->priv; idev = ndev->priv;
down(&idev->sem); down(&idev->sem);
if (pdev->current_state != 0) { /* already suspended */ if (pdev->current_state != 0) { /* already suspended */
if (state > pdev->current_state) { /* simply go deeper */ if (state.event > pdev->current_state) { /* simply go deeper */
pci_set_power_state(pdev,state); pci_set_power_state(pdev, pci_choose_state(pdev, state));
pdev->current_state = state; pdev->current_state = state.event;
} }
else else
IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, PCIDEV_NAME(pdev), pdev->current_state, state); IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, PCIDEV_NAME(pdev), pdev->current_state, state.event);
up(&idev->sem); up(&idev->sem);
return 0; return 0;
} }
...@@ -1777,7 +1777,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -1777,7 +1777,7 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
} }
pci_set_power_state(pdev, pci_choose_state(pdev, state)); pci_set_power_state(pdev, pci_choose_state(pdev, state));
pdev->current_state = state; pdev->current_state = state.event;
idev->resume_ok = 1; idev->resume_ok = 1;
up(&idev->sem); up(&idev->sem);
return 0; return 0;
......
...@@ -2239,7 +2239,7 @@ static void airo_read_stats(struct airo_info *ai) { ...@@ -2239,7 +2239,7 @@ static void airo_read_stats(struct airo_info *ai) {
u32 *vals = stats_rid.vals; u32 *vals = stats_rid.vals;
clear_bit(JOB_STATS, &ai->flags); clear_bit(JOB_STATS, &ai->flags);
if (ai->power) { if (ai->power.event) {
up(&ai->sem); up(&ai->sem);
return; return;
} }
...@@ -2969,7 +2969,7 @@ static int airo_thread(void *data) { ...@@ -2969,7 +2969,7 @@ static int airo_thread(void *data) {
break; break;
} }
if (ai->power || test_bit(FLAG_FLASHING, &ai->flags)) { if (ai->power.event || test_bit(FLAG_FLASHING, &ai->flags)) {
up(&ai->sem); up(&ai->sem);
continue; continue;
} }
...@@ -5521,7 +5521,7 @@ static int airo_pci_resume(struct pci_dev *pdev) ...@@ -5521,7 +5521,7 @@ static int airo_pci_resume(struct pci_dev *pdev)
pci_restore_state(pdev); pci_restore_state(pdev);
pci_enable_wake(pdev, pci_choose_state(pdev, ai->power), 0); pci_enable_wake(pdev, pci_choose_state(pdev, ai->power), 0);
if (ai->power > 1) { if (ai->power.event > 1) {
reset_card(dev, 0); reset_card(dev, 0);
mpi_init_descriptors(ai); mpi_init_descriptors(ai);
setup_card(ai, dev->dev_addr, 0); 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,7 +7123,7 @@ static int airo_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
int rc = 0; int rc = 0;
struct airo_info *ai = (struct airo_info *)dev->priv; struct airo_info *ai = (struct airo_info *)dev->priv;
if (ai->power) if (ai->power.event)
return 0; return 0;
switch (cmd) { switch (cmd) {
...@@ -7202,7 +7202,7 @@ static void airo_read_wireless_stats(struct airo_info *local) ...@@ -7202,7 +7202,7 @@ static void airo_read_wireless_stats(struct airo_info *local)
/* Get stats out of the card */ /* Get stats out of the card */
clear_bit(JOB_WSTATS, &local->flags); clear_bit(JOB_WSTATS, &local->flags);
if (local->power) { if (local->power.event) {
up(&local->sem); up(&local->sem);
return; return;
} }
......
...@@ -333,13 +333,17 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) ...@@ -333,13 +333,17 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state)
if (platform_pci_choose_state) { if (platform_pci_choose_state) {
ret = platform_pci_choose_state(dev, state); ret = platform_pci_choose_state(dev, state);
if (ret >= 0) if (ret >= 0)
state = ret; state.event = ret;
} }
switch (state) {
case 0: return PCI_D0; switch (state.event) {
case 3: return PCI_D3hot; case PM_EVENT_ON:
return PCI_D0;
case PM_EVENT_FREEZE:
case PM_EVENT_SUSPEND:
return PCI_D3hot;
default: default:
printk("They asked me for state %d\n", state); printk("They asked me for state %d\n", state.event);
BUG(); BUG();
} }
return PCI_D0; return PCI_D0;
......
...@@ -1766,7 +1766,7 @@ static int mesh_suspend(struct macio_dev *mdev, pm_message_t state) ...@@ -1766,7 +1766,7 @@ static int mesh_suspend(struct macio_dev *mdev, pm_message_t state)
struct mesh_state *ms = (struct mesh_state *)macio_get_drvdata(mdev); struct mesh_state *ms = (struct mesh_state *)macio_get_drvdata(mdev);
unsigned long flags; unsigned long flags;
if (state == mdev->ofdev.dev.power.power_state || state < 2) if (state.event == mdev->ofdev.dev.power.power_state.event || state.event < 2)
return 0; return 0;
scsi_block_requests(ms->host); scsi_block_requests(ms->host);
...@@ -1791,7 +1791,7 @@ static int mesh_resume(struct macio_dev *mdev) ...@@ -1791,7 +1791,7 @@ static int mesh_resume(struct macio_dev *mdev)
struct mesh_state *ms = (struct mesh_state *)macio_get_drvdata(mdev); struct mesh_state *ms = (struct mesh_state *)macio_get_drvdata(mdev);
unsigned long flags; unsigned long flags;
if (mdev->ofdev.dev.power.power_state == 0) if (mdev->ofdev.dev.power.power_state.event == PM_EVENT_ON)
return 0; return 0;
set_mesh_power(ms, 1); set_mesh_power(ms, 1);
...@@ -1802,7 +1802,7 @@ static int mesh_resume(struct macio_dev *mdev) ...@@ -1802,7 +1802,7 @@ static int mesh_resume(struct macio_dev *mdev)
enable_irq(ms->meshintr); enable_irq(ms->meshintr);
scsi_unblock_requests(ms->host); scsi_unblock_requests(ms->host);
mdev->ofdev.dev.power.power_state = 0; mdev->ofdev.dev.power.power_state.event = PM_EVENT_ON;
return 0; return 0;
} }
......
...@@ -1600,7 +1600,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state) ...@@ -1600,7 +1600,7 @@ static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state)
return 0; return 0;
} }
if (pm_state == mdev->ofdev.dev.power.power_state || pm_state < 2) if (pm_state.event == mdev->ofdev.dev.power.power_state.event)
return 0; return 0;
pmz_debug("suspend, switching to state %d\n", pm_state); pmz_debug("suspend, switching to state %d\n", pm_state);
...@@ -1660,7 +1660,7 @@ static int pmz_resume(struct macio_dev *mdev) ...@@ -1660,7 +1660,7 @@ static int pmz_resume(struct macio_dev *mdev)
if (uap == NULL) if (uap == NULL)
return 0; return 0;
if (mdev->ofdev.dev.power.power_state == 0) if (mdev->ofdev.dev.power.power_state.event == PM_EVENT_ON)
return 0; return 0;
pmz_debug("resume, switching to state 0\n"); pmz_debug("resume, switching to state 0\n");
...@@ -1713,7 +1713,7 @@ static int pmz_resume(struct macio_dev *mdev) ...@@ -1713,7 +1713,7 @@ static int pmz_resume(struct macio_dev *mdev)
pmz_debug("resume, switching complete\n"); pmz_debug("resume, switching complete\n");
mdev->ofdev.dev.power.power_state = 0; mdev->ofdev.dev.power.power_state.event = PM_EVENT_ON;
return 0; return 0;
} }
......
...@@ -1570,7 +1570,7 @@ static int __usb_suspend_device (struct usb_device *udev, int port1, ...@@ -1570,7 +1570,7 @@ static int __usb_suspend_device (struct usb_device *udev, int port1,
struct usb_driver *driver; struct usb_driver *driver;
intf = udev->actconfig->interface[i]; intf = udev->actconfig->interface[i];
if (state <= intf->dev.power.power_state) if (state.event <= intf->dev.power.power_state.event)
continue; continue;
if (!intf->dev.driver) if (!intf->dev.driver)
continue; continue;
...@@ -1578,11 +1578,11 @@ static int __usb_suspend_device (struct usb_device *udev, int port1, ...@@ -1578,11 +1578,11 @@ static int __usb_suspend_device (struct usb_device *udev, int port1,
if (driver->suspend) { if (driver->suspend) {
status = driver->suspend(intf, state); status = driver->suspend(intf, state);
if (intf->dev.power.power_state != state