aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-05-30 15:38:16 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-12 19:34:30 -0400
commitf07600cf9eb3ee92777b2001e564faa413144a99 (patch)
treee48f2e3051fde642e80269bf9c54b289d4abdb44 /drivers/hid
parent624d6c0732d2c4ac00945ad79dbb6ff39ba90ee3 (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 'drivers/hid')
-rw-r--r--drivers/hid/usbhid/hid-core.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index e221b0d1f667..b2baeaeba9be 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1009,20 +1009,22 @@ static int hid_resume(struct usb_interface *intf)
1009} 1009}
1010 1010
1011/* Treat USB reset pretty much the same as suspend/resume */ 1011/* Treat USB reset pretty much the same as suspend/resume */
1012static void hid_pre_reset(struct usb_interface *intf) 1012static int hid_pre_reset(struct usb_interface *intf)
1013{ 1013{
1014 /* FIXME: What if the interface is already suspended? */ 1014 /* FIXME: What if the interface is already suspended? */
1015 hid_suspend(intf, PMSG_ON); 1015 hid_suspend(intf, PMSG_ON);
1016 return 0;
1016} 1017}
1017 1018
1018static void hid_post_reset(struct usb_interface *intf, int reset_resume) 1019/* Same routine used for post_reset and reset_resume */
1020static int hid_post_reset(struct usb_interface *intf)
1019{ 1021{
1020 struct usb_device *dev = interface_to_usbdev (intf); 1022 struct usb_device *dev = interface_to_usbdev (intf);
1021 1023
1022 hid_set_idle(dev, intf->cur_altsetting->desc.bInterfaceNumber, 0, 0); 1024 hid_set_idle(dev, intf->cur_altsetting->desc.bInterfaceNumber, 0, 0);
1023 /* FIXME: Any more reinitialization needed? */ 1025 /* FIXME: Any more reinitialization needed? */
1024 1026
1025 hid_resume(intf); 1027 return hid_resume(intf);
1026} 1028}
1027 1029
1028static struct usb_device_id hid_usb_ids [] = { 1030static struct usb_device_id hid_usb_ids [] = {
@@ -1039,6 +1041,7 @@ static struct usb_driver hid_driver = {
1039 .disconnect = hid_disconnect, 1041 .disconnect = hid_disconnect,
1040 .suspend = hid_suspend, 1042 .suspend = hid_suspend,
1041 .resume = hid_resume, 1043 .resume = hid_resume,
1044 .reset_resume = hid_post_reset,
1042 .pre_reset = hid_pre_reset, 1045 .pre_reset = hid_pre_reset,
1043 .post_reset = hid_post_reset, 1046 .post_reset = hid_post_reset,
1044 .id_table = hid_usb_ids, 1047 .id_table = hid_usb_ids,