handling failure in suspend() during autosuspend

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Hi,

this code tries to handle suspend() returning errors (usb_suspend_both):

	/* If the suspend failed, resume interfaces that did get suspended */
	if (status != 0) {
		while (--i >= 0) {
			intf = udev->actconfig->interface[i];
			usb_resume_interface(intf, 0);
		}

		/* Try another autosuspend when the interfaces aren't busy */
		if (udev->auto_pm)
			autosuspend_check(udev);

It uses autosuspend_check() to resubmit the work if the problem isn't
permanent. It in turn schedules the retry only if last_busy
is recent enough. A failure to set it if you refuse to autosuspend will
kill autosuspend on the devices that use exclusively last_busy.

However, even if a driver uses it, it still is a race condition.
The clean solution would be to split autosuspend_check(), with
check really only checking, and a new function to schedule another
attempt.

	Regards
		Oliver

-------------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.