diff options
author | Pavel Machek <pavel@ucw.cz> | 2005-09-03 18:56:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-05 03:06:16 -0400 |
commit | ca078bae813dd46c0f9b102fdfb4a3384641ff48 (patch) | |
tree | e3348f5dcb24159a522941aa2e3ee40bc9e0589b /drivers/usb | |
parent | 829ca9a30a2ddb727981d80fabdbff2ea86bc9ea (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>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/hub.c | 18 | ||||
-rw-r--r-- | drivers/usb/core/usb.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ehci-dbg.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/ohci-dbg.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/sl811-hcd.c | 6 | ||||
-rw-r--r-- | drivers/usb/misc/usbtest.c | 2 |
6 files changed, 16 insertions, 16 deletions
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 | } |