]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
USB: adds comment on suspend callback
authorMing Lei <ming.lei@canonical.com>
Fri, 15 Mar 2013 04:08:53 +0000 (12:08 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Mar 2013 17:55:46 +0000 (10:55 -0700)
This patch adds comments on interface driver suspend callback
to emphasize that the failure return value is ignored by
USB core in system sleep context, so do not try to recover
device for this case and let resume/reset_resume callback
handle the suspend failure if needed.

Also kerneldoc for usb_suspend_both() is updated with the
fact.

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/driver.c
include/linux/usb.h

index d938b2b99e31fcee332a2f83ae46e4998907190a..eb1d00a3543a4334d03cd59b1868f97d6c94ea69 100644 (file)
@@ -1196,9 +1196,14 @@ done:
  *
  * This is the central routine for suspending USB devices.  It calls the
  * suspend methods for all the interface drivers in @udev and then calls
- * the suspend method for @udev itself.  If an error occurs at any stage,
- * all the interfaces which were suspended are resumed so that they remain
- * in the same state as the device.
+ * the suspend method for @udev itself.  When the routine is called in
+ * autosuspend, if an error occurs at any stage, all the interfaces
+ * which were suspended are resumed so that they remain in the same
+ * state as the device, but when called from system sleep, all error
+ * from suspend methods of interfaces and the non-root-hub device itself
+ * are simply ignored, so all suspended interfaces are only resumed
+ * to the device's state when @udev is root-hub and its suspend method
+ * returns failure.
  *
  * Autosuspend requests originating from a child device or an interface
  * driver may be made without the protection of @udev's device lock, but
index 52464fb2389b90d401dc7fc3632eb326914cba66..8d4bc173d66a56827e3d3b3a99752d5126b1d76c 100644 (file)
@@ -976,7 +976,12 @@ struct usbdrv_wrap {
  *     the "usbfs" filesystem.  This lets devices provide ways to
  *     expose information to user space regardless of where they
  *     do (or don't) show up otherwise in the filesystem.
- * @suspend: Called when the device is going to be suspended by the system.
+ * @suspend: Called when the device is going to be suspended by the
+ *     system either from system sleep or runtime suspend context. The
+ *     return value will be ignored in system sleep context, so do NOT
+ *     try to continue using the device if suspend fails in this case.
+ *     Instead, let the resume or reset-resume routine recover from
+ *     the failure.
  * @resume: Called when the device is being resumed by the system.
  * @reset_resume: Called when the suspended device has been reset instead
  *     of being resumed.