diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2007-05-30 15:38:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-12 19:34:30 -0400 |
commit | f07600cf9eb3ee92777b2001e564faa413144a99 (patch) | |
tree | e48f2e3051fde642e80269bf9c54b289d4abdb44 /include/linux | |
parent | 624d6c0732d2c4ac00945ad79dbb6ff39ba90ee3 (diff) |
USB: add reset_resume method
This patch (as918) introduces a new USB driver method: reset_resume.
It is called when a device needs to be reset as part of a resume
procedure (whether because of a device quirk or because of the
USB-Persist facility), thereby taking over a role formerly assigned to
the post_reset method. As a consequence, post_reset no longer needs
an argument indicating whether it is being called as part of a
reset-resume. This separation of functions makes the code clearer.
In addition, the pre_reset and post_reset method return types are
changed; they now must return an error code. The return value is
unused at present, but at some later time we may unbind drivers and
re-probe if they encounter an error during reset handling.
The existing pre_reset and post_reset methods in the usbhid,
usb-storage, and hub drivers are updated to match the new
requirements. For usbhid the post_reset routine is also used for
reset_resume (duplicate method pointers); for the other drivers a new
reset_resume routine is added. The change to hub.c looks bigger than
it really is, because mark_children_for_reset_resume() gets moved down
next to the new hub_reset_resume() routine.
A minor change to usb-storage makes the usb_stor_report_bus_reset()
routine acquire the host lock instead of requiring the caller to hold
it already.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/usb.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 0873c6219efc..bde8c65e2bfc 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -839,6 +839,8 @@ struct usbdrv_wrap { | |||
839 | * do (or don't) show up otherwise in the filesystem. | 839 | * do (or don't) show up otherwise in the filesystem. |
840 | * @suspend: Called when the device is going to be suspended by the system. | 840 | * @suspend: Called when the device is going to be suspended by the system. |
841 | * @resume: Called when the device is being resumed by the system. | 841 | * @resume: Called when the device is being resumed by the system. |
842 | * @reset_resume: Called when the suspended device has been reset instead | ||
843 | * of being resumed. | ||
842 | * @pre_reset: Called by usb_reset_composite_device() when the device | 844 | * @pre_reset: Called by usb_reset_composite_device() when the device |
843 | * is about to be reset. | 845 | * is about to be reset. |
844 | * @post_reset: Called by usb_reset_composite_device() after the device | 846 | * @post_reset: Called by usb_reset_composite_device() after the device |
@@ -885,9 +887,10 @@ struct usb_driver { | |||
885 | 887 | ||
886 | int (*suspend) (struct usb_interface *intf, pm_message_t message); | 888 | int (*suspend) (struct usb_interface *intf, pm_message_t message); |
887 | int (*resume) (struct usb_interface *intf); | 889 | int (*resume) (struct usb_interface *intf); |
890 | int (*reset_resume)(struct usb_interface *intf); | ||
888 | 891 | ||
889 | void (*pre_reset) (struct usb_interface *intf); | 892 | int (*pre_reset)(struct usb_interface *intf); |
890 | void (*post_reset) (struct usb_interface *intf, int reset_resume); | 893 | int (*post_reset)(struct usb_interface *intf); |
891 | 894 | ||
892 | const struct usb_device_id *id_table; | 895 | const struct usb_device_id *id_table; |
893 | 896 | ||