aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2010-07-28 17:12:39 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 17:35:44 -0400
commitf283925fe9ef4ee75dc43e4c2bfbbd6b8a70bd0a (patch)
tree4b57d4975bc625a73a13f5a6022a227ca5e249e7 /drivers/usb
parent185c9bcfde628f1d71aefd34517252cce4c4a57a (diff)
USB: usb-storage: implement autosuspend
This patch (as1400) adds runtime-PM support to usb-storage. It utilizes the SCSI layer's runtime-PM implementation, so its scope is limited. Currently the only effect is that disk-like devices (such as card readers or flash drives) will be autosuspended if they aren't mounted and their device files aren't open. This would apply, for example, to card readers that don't contain a memory card. Unfortunately this won't interact very well with the removable-media polling normally carried out by hal or DeviceKit. Maybe those programs can be changed to use a longer polling interval, or maybe the default autosuspend time for usb-storage should be set to something below 1 second. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: James Bottomley <James.Bottomley@suse.de> Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/storage/usb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index a7d0bf9d92a7..90bb0175a152 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -336,6 +336,7 @@ static int usb_stor_control_thread(void * __us)
336 else { 336 else {
337 US_DEBUG(usb_stor_show_command(us->srb)); 337 US_DEBUG(usb_stor_show_command(us->srb));
338 us->proto_handler(us->srb, us); 338 us->proto_handler(us->srb, us);
339 usb_mark_last_busy(us->pusb_dev);
339 } 340 }
340 341
341 /* lock access to the state */ 342 /* lock access to the state */
@@ -845,6 +846,7 @@ static int usb_stor_scan_thread(void * __us)
845 /* Should we unbind if no devices were detected? */ 846 /* Should we unbind if no devices were detected? */
846 } 847 }
847 848
849 usb_autopm_put_interface(us->pusb_intf);
848 complete_and_exit(&us->scanning_done, 0); 850 complete_and_exit(&us->scanning_done, 0);
849} 851}
850 852
@@ -968,6 +970,7 @@ int usb_stor_probe2(struct us_data *us)
968 goto BadDevice; 970 goto BadDevice;
969 } 971 }
970 972
973 usb_autopm_get_interface_no_resume(us->pusb_intf);
971 wake_up_process(th); 974 wake_up_process(th);
972 975
973 return 0; 976 return 0;
@@ -1040,6 +1043,7 @@ static struct usb_driver usb_storage_driver = {
1040 .pre_reset = usb_stor_pre_reset, 1043 .pre_reset = usb_stor_pre_reset,
1041 .post_reset = usb_stor_post_reset, 1044 .post_reset = usb_stor_post_reset,
1042 .id_table = usb_storage_usb_ids, 1045 .id_table = usb_storage_usb_ids,
1046 .supports_autosuspend = 1,
1043 .soft_unbind = 1, 1047 .soft_unbind = 1,
1044}; 1048};
1045 1049