aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMing Lei <ming.lei@canonical.com>2013-03-15 00:08:53 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 13:55:46 -0400
commit303f0847925ece27129487a2bfc05199ab2a0b51 (patch)
treed368d2f9376bb452d9c79f466c710a5d7d38b64e
parent2849a3a945d0e440fa245c47c49c80ef1cc103c3 (diff)
USB: adds comment on suspend callback
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>
-rw-r--r--drivers/usb/core/driver.c11
-rw-r--r--include/linux/usb.h7
2 files changed, 14 insertions, 4 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index d938b2b99e31..eb1d00a3543a 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1196,9 +1196,14 @@ done:
1196 * 1196 *
1197 * This is the central routine for suspending USB devices. It calls the 1197 * This is the central routine for suspending USB devices. It calls the
1198 * suspend methods for all the interface drivers in @udev and then calls 1198 * suspend methods for all the interface drivers in @udev and then calls
1199 * the suspend method for @udev itself. If an error occurs at any stage, 1199 * the suspend method for @udev itself. When the routine is called in
1200 * all the interfaces which were suspended are resumed so that they remain 1200 * autosuspend, if an error occurs at any stage, all the interfaces
1201 * in the same state as the device. 1201 * which were suspended are resumed so that they remain in the same
1202 * state as the device, but when called from system sleep, all error
1203 * from suspend methods of interfaces and the non-root-hub device itself
1204 * are simply ignored, so all suspended interfaces are only resumed
1205 * to the device's state when @udev is root-hub and its suspend method
1206 * returns failure.
1202 * 1207 *
1203 * Autosuspend requests originating from a child device or an interface 1208 * Autosuspend requests originating from a child device or an interface
1204 * driver may be made without the protection of @udev's device lock, but 1209 * driver may be made without the protection of @udev's device lock, but
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 52464fb2389b..8d4bc173d66a 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -976,7 +976,12 @@ struct usbdrv_wrap {
976 * the "usbfs" filesystem. This lets devices provide ways to 976 * the "usbfs" filesystem. This lets devices provide ways to
977 * expose information to user space regardless of where they 977 * expose information to user space regardless of where they
978 * do (or don't) show up otherwise in the filesystem. 978 * do (or don't) show up otherwise in the filesystem.
979 * @suspend: Called when the device is going to be suspended by the system. 979 * @suspend: Called when the device is going to be suspended by the
980 * system either from system sleep or runtime suspend context. The
981 * return value will be ignored in system sleep context, so do NOT
982 * try to continue using the device if suspend fails in this case.
983 * Instead, let the resume or reset-resume routine recover from
984 * the failure.
980 * @resume: Called when the device is being resumed by the system. 985 * @resume: Called when the device is being resumed by the system.
981 * @reset_resume: Called when the suspended device has been reset instead 986 * @reset_resume: Called when the suspended device has been reset instead
982 * of being resumed. 987 * of being resumed.