[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>
This commit is contained in:
committed by
Linus Torvalds
parent
829ca9a30a
commit
ca078bae81
@@ -1570,7 +1570,7 @@ static int __usb_suspend_device (struct usb_device *udev, int port1,
|
||||
struct usb_driver *driver;
|
||||
|
||||
intf = udev->actconfig->interface[i];
|
||||
if (state <= intf->dev.power.power_state)
|
||||
if (state.event <= intf->dev.power.power_state.event)
|
||||
continue;
|
||||
if (!intf->dev.driver)
|
||||
continue;
|
||||
@@ -1578,11 +1578,11 @@ static int __usb_suspend_device (struct usb_device *udev, int port1,
|
||||
|
||||
if (driver->suspend) {
|
||||
status = driver->suspend(intf, state);
|
||||
if (intf->dev.power.power_state != state
|
||||
if (intf->dev.power.power_state.event != state.event
|
||||
|| status)
|
||||
dev_err(&intf->dev,
|
||||
"suspend %d fail, code %d\n",
|
||||
state, status);
|
||||
state.event, status);
|
||||
}
|
||||
|
||||
/* only drivers with suspend() can ever resume();
|
||||
@@ -1595,7 +1595,7 @@ static int __usb_suspend_device (struct usb_device *udev, int port1,
|
||||
* since we know every driver's probe/disconnect works
|
||||
* even for drivers that can't suspend.
|
||||
*/
|
||||
if (!driver->suspend || state > PM_SUSPEND_MEM) {
|
||||
if (!driver->suspend || state.event > PM_EVENT_FREEZE) {
|
||||
#if 1
|
||||
dev_warn(&intf->dev, "resume is unsafe!\n");
|
||||
#else
|
||||
@@ -1616,7 +1616,7 @@ static int __usb_suspend_device (struct usb_device *udev, int port1,
|
||||
* policies (when HNP doesn't apply) once we have mechanisms to
|
||||
* turn power back on! (Likely not before 2.7...)
|
||||
*/
|
||||
if (state > PM_SUSPEND_MEM) {
|
||||
if (state.event > PM_EVENT_FREEZE) {
|
||||
dev_warn(&udev->dev, "no poweroff yet, suspending instead\n");
|
||||
}
|
||||
|
||||
@@ -1733,7 +1733,7 @@ static int finish_port_resume(struct usb_device *udev)
|
||||
struct usb_driver *driver;
|
||||
|
||||
intf = udev->actconfig->interface[i];
|
||||
if (intf->dev.power.power_state == PMSG_ON)
|
||||
if (intf->dev.power.power_state.event == PM_EVENT_ON)
|
||||
continue;
|
||||
if (!intf->dev.driver) {
|
||||
/* FIXME maybe force to alt 0 */
|
||||
@@ -1747,11 +1747,11 @@ static int finish_port_resume(struct usb_device *udev)
|
||||
|
||||
/* can we do better than just logging errors? */
|
||||
status = driver->resume(intf);
|
||||
if (intf->dev.power.power_state != PMSG_ON
|
||||
if (intf->dev.power.power_state.event != PM_EVENT_ON
|
||||
|| status)
|
||||
dev_dbg(&intf->dev,
|
||||
"resume fail, state %d code %d\n",
|
||||
intf->dev.power.power_state, status);
|
||||
intf->dev.power.power_state.event, status);
|
||||
}
|
||||
status = 0;
|
||||
|
||||
@@ -1934,7 +1934,7 @@ static int hub_resume(struct usb_interface *intf)
|
||||
unsigned port1;
|
||||
int status;
|
||||
|
||||
if (intf->dev.power.power_state == PM_SUSPEND_ON)
|
||||
if (intf->dev.power.power_state.event == PM_EVENT_ON)
|
||||
return 0;
|
||||
|
||||
for (port1 = 1; port1 <= hdev->maxchild; port1++) {
|
||||
|
@@ -1400,7 +1400,7 @@ static int usb_generic_suspend(struct device *dev, pm_message_t message)
|
||||
driver = to_usb_driver(dev->driver);
|
||||
|
||||
/* there's only one USB suspend state */
|
||||
if (intf->dev.power.power_state)
|
||||
if (intf->dev.power.power_state.event)
|
||||
return 0;
|
||||
|
||||
if (driver->suspend)
|
||||
|
Reference in New Issue
Block a user