On Thu, May 14, 2015 at 11:51:10AM -0400, Alan Stern wrote: > On Wed, 13 May 2015, Felipe Balbi wrote: > > > This brings up a question, actually. What to do with devices which were > > already runtime suspended when user initiated suspend-to-ram ? Do we > > leave wakeups enabled, or do we revisit device_may_wakeup() and > > conditionally runtime_resume the device, disable wakeup, and let its > > ->suspend() callback be called ? > > In theory, the subsystem/device drivers already have code do this. > They're supposed to, anyway. The USB host stack does it in > drivers/usb/core/driver.c:choose_wakeup(). that answers the question, specifically, this comment and piece of code do: 1395 static void choose_wakeup(struct usb_device *udev, pm_message_t msg) 1396 { [...] 1409 /* Enable remote wakeup if it is allowed, even if no interface drivers 1410 * actually want it. 1411 */ 1412 w = device_may_wakeup(&udev->dev); 1413 1414 /* If the device is autosuspended with the wrong wakeup setting, 1415 * autoresume now so the setting can be changed. 1416 */ 1417 if (udev->state == USB_STATE_SUSPENDED && w != udev->do_remote_wakeup) 1418 pm_runtime_resume(&udev->dev); 1419 udev->do_remote_wakeup = w; 1420 } so that's something that also needs to be taken into consideration. Thanks -- balbi
Attachment:
signature.asc
Description: Digital signature