Re: handling failure in suspend() during autosuspend
Oliver Neukum <[email protected]>
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
Am Freitag 05 Oktober 2007 schrieb Alan Stern:
> As far as the race is concerned... In practice it shouldn't matter
> unless autosuspend_delay is set to 0. I suppose autosuspend_check()
> could take an extra "reschedule" flag. If the flag was set, the
> routine would schedule another autosuspend attempt (with a 1-second
> delay) if the idle-time period had already expired.
OK. Like this?
Regards
Oliver
---
--- a/drivers/usb/core/driver.c 2007-10-05 17:19:27.000000000 +0200
+++ b/drivers/usb/core/driver.c 2007-10-05 17:19:38.000000000 +0200
@@ -945,7 +945,7 @@ done:
#ifdef CONFIG_USB_SUSPEND
/* Internal routine to check whether we may autosuspend a device. */
-static int autosuspend_check(struct usb_device *udev)
+static int autosuspend_check(struct usb_device *udev, int force)
{
int i;
struct usb_interface *intf;
@@ -993,7 +993,7 @@ static int autosuspend_check(struct usb_
/* If everything is okay but the device hasn't been idle for long
* enough, queue a delayed autosuspend request.
*/
- if (time_after(suspend_time, jiffies)) {
+ if (force || time_after(suspend_time, jiffies)) {
if (!timer_pending(&udev->autosuspend.timer)) {
/* The value of jiffies may change between the
@@ -1012,7 +1012,7 @@ static int autosuspend_check(struct usb_
#else
-static inline int autosuspend_check(struct usb_device *udev)
+static inline int autosuspend_check(struct usb_device *udev, int force)
{
return 0;
}
@@ -1069,7 +1069,7 @@ static int usb_suspend_both(struct usb_d
udev->do_remote_wakeup = device_may_wakeup(&udev->dev);
if (udev->auto_pm) {
- status = autosuspend_check(udev);
+ status = autosuspend_check(udev, 0);
if (status < 0)
goto done;
}
@@ -1102,7 +1102,7 @@ static int usb_suspend_both(struct usb_d
/* Try another autosuspend when the interfaces aren't busy */
if (udev->auto_pm)
- autosuspend_check(udev);
+ autosuspend_check(udev, status == -EBUSY);
/* If the suspend succeeded, propagate it up the tree */
} else {
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel