diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-09-13 09:01:24 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-09-13 09:01:24 -0400 |
commit | d526875deb42e0f4c0d31cb50b4e5bfaf19c3138 (patch) | |
tree | dc1663e05af27746e7056f0624accbcb96aaa661 /drivers/usb/storage | |
parent | 7d2c592609a7da950b458403f1936d382f38ff9c (diff) |
Revert "usb-storage: implement autosuspend"
This reverts commit 8dfe4b14869fd185ca25ee88b02ada58a3005eaf.
There are a number of issues still remaining in usb-storage autosuspend,
so, to be safe, we need to revert this for now.
Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r-- | drivers/usb/storage/scsiglue.c | 13 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 27 |
2 files changed, 11 insertions, 29 deletions
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 47e56079925d..1ba19eaa1970 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -285,15 +285,10 @@ static int device_reset(struct scsi_cmnd *srb) | |||
285 | 285 | ||
286 | US_DEBUGP("%s called\n", __FUNCTION__); | 286 | US_DEBUGP("%s called\n", __FUNCTION__); |
287 | 287 | ||
288 | result = usb_autopm_get_interface(us->pusb_intf); | 288 | /* lock the device pointers and do the reset */ |
289 | if (result == 0) { | 289 | mutex_lock(&(us->dev_mutex)); |
290 | 290 | result = us->transport_reset(us); | |
291 | /* lock the device pointers and do the reset */ | 291 | mutex_unlock(&us->dev_mutex); |
292 | mutex_lock(&(us->dev_mutex)); | ||
293 | result = us->transport_reset(us); | ||
294 | mutex_unlock(&us->dev_mutex); | ||
295 | usb_autopm_put_interface(us->pusb_intf); | ||
296 | } | ||
297 | 292 | ||
298 | return result < 0 ? FAILED : SUCCESS; | 293 | return result < 0 ? FAILED : SUCCESS; |
299 | } | 294 | } |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 25e557d4fe6b..59181667066c 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -184,14 +184,16 @@ static int storage_suspend(struct usb_interface *iface, pm_message_t message) | |||
184 | { | 184 | { |
185 | struct us_data *us = usb_get_intfdata(iface); | 185 | struct us_data *us = usb_get_intfdata(iface); |
186 | 186 | ||
187 | US_DEBUGP("%s\n", __FUNCTION__); | ||
188 | |||
189 | /* Wait until no command is running */ | 187 | /* Wait until no command is running */ |
190 | mutex_lock(&us->dev_mutex); | 188 | mutex_lock(&us->dev_mutex); |
191 | 189 | ||
190 | US_DEBUGP("%s\n", __FUNCTION__); | ||
192 | if (us->suspend_resume_hook) | 191 | if (us->suspend_resume_hook) |
193 | (us->suspend_resume_hook)(us, US_SUSPEND); | 192 | (us->suspend_resume_hook)(us, US_SUSPEND); |
194 | 193 | ||
194 | /* When runtime PM is working, we'll set a flag to indicate | ||
195 | * whether we should autoresume when a SCSI request arrives. */ | ||
196 | |||
195 | mutex_unlock(&us->dev_mutex); | 197 | mutex_unlock(&us->dev_mutex); |
196 | return 0; | 198 | return 0; |
197 | } | 199 | } |
@@ -200,11 +202,13 @@ static int storage_resume(struct usb_interface *iface) | |||
200 | { | 202 | { |
201 | struct us_data *us = usb_get_intfdata(iface); | 203 | struct us_data *us = usb_get_intfdata(iface); |
202 | 204 | ||
203 | US_DEBUGP("%s\n", __FUNCTION__); | 205 | mutex_lock(&us->dev_mutex); |
204 | 206 | ||
207 | US_DEBUGP("%s\n", __FUNCTION__); | ||
205 | if (us->suspend_resume_hook) | 208 | if (us->suspend_resume_hook) |
206 | (us->suspend_resume_hook)(us, US_RESUME); | 209 | (us->suspend_resume_hook)(us, US_RESUME); |
207 | 210 | ||
211 | mutex_unlock(&us->dev_mutex); | ||
208 | return 0; | 212 | return 0; |
209 | } | 213 | } |
210 | 214 | ||
@@ -302,7 +306,6 @@ static int usb_stor_control_thread(void * __us) | |||
302 | { | 306 | { |
303 | struct us_data *us = (struct us_data *)__us; | 307 | struct us_data *us = (struct us_data *)__us; |
304 | struct Scsi_Host *host = us_to_host(us); | 308 | struct Scsi_Host *host = us_to_host(us); |
305 | int autopm_rc; | ||
306 | 309 | ||
307 | for(;;) { | 310 | for(;;) { |
308 | US_DEBUGP("*** thread sleeping.\n"); | 311 | US_DEBUGP("*** thread sleeping.\n"); |
@@ -311,9 +314,6 @@ static int usb_stor_control_thread(void * __us) | |||
311 | 314 | ||
312 | US_DEBUGP("*** thread awakened.\n"); | 315 | US_DEBUGP("*** thread awakened.\n"); |
313 | 316 | ||
314 | /* Autoresume the device */ | ||
315 | autopm_rc = usb_autopm_get_interface(us->pusb_intf); | ||
316 | |||
317 | /* lock the device pointers */ | 317 | /* lock the device pointers */ |
318 | mutex_lock(&(us->dev_mutex)); | 318 | mutex_lock(&(us->dev_mutex)); |
319 | 319 | ||
@@ -372,12 +372,6 @@ static int usb_stor_control_thread(void * __us) | |||
372 | us->srb->result = SAM_STAT_GOOD; | 372 | us->srb->result = SAM_STAT_GOOD; |
373 | } | 373 | } |
374 | 374 | ||
375 | /* Did the autoresume fail? */ | ||
376 | else if (autopm_rc < 0) { | ||
377 | US_DEBUGP("Could not wake device\n"); | ||
378 | us->srb->result = DID_ERROR << 16; | ||
379 | } | ||
380 | |||
381 | /* we've got a command, let's do it! */ | 375 | /* we've got a command, let's do it! */ |
382 | else { | 376 | else { |
383 | US_DEBUG(usb_stor_show_command(us->srb)); | 377 | US_DEBUG(usb_stor_show_command(us->srb)); |
@@ -420,10 +414,6 @@ SkipForAbort: | |||
420 | 414 | ||
421 | /* unlock the device pointers */ | 415 | /* unlock the device pointers */ |
422 | mutex_unlock(&us->dev_mutex); | 416 | mutex_unlock(&us->dev_mutex); |
423 | |||
424 | /* Start an autosuspend */ | ||
425 | if (autopm_rc == 0) | ||
426 | usb_autopm_put_interface(us->pusb_intf); | ||
427 | } /* for (;;) */ | 417 | } /* for (;;) */ |
428 | 418 | ||
429 | /* Wait until we are told to stop */ | 419 | /* Wait until we are told to stop */ |
@@ -941,7 +931,6 @@ retry: | |||
941 | /* Should we unbind if no devices were detected? */ | 931 | /* Should we unbind if no devices were detected? */ |
942 | } | 932 | } |
943 | 933 | ||
944 | usb_autopm_put_interface(us->pusb_intf); | ||
945 | complete_and_exit(&us->scanning_done, 0); | 934 | complete_and_exit(&us->scanning_done, 0); |
946 | } | 935 | } |
947 | 936 | ||
@@ -1027,7 +1016,6 @@ static int storage_probe(struct usb_interface *intf, | |||
1027 | goto BadDevice; | 1016 | goto BadDevice; |
1028 | } | 1017 | } |
1029 | 1018 | ||
1030 | usb_autopm_get_interface(intf); /* dropped in the scanning thread */ | ||
1031 | wake_up_process(th); | 1019 | wake_up_process(th); |
1032 | 1020 | ||
1033 | return 0; | 1021 | return 0; |
@@ -1065,7 +1053,6 @@ static struct usb_driver usb_storage_driver = { | |||
1065 | .pre_reset = storage_pre_reset, | 1053 | .pre_reset = storage_pre_reset, |
1066 | .post_reset = storage_post_reset, | 1054 | .post_reset = storage_post_reset, |
1067 | .id_table = storage_usb_ids, | 1055 | .id_table = storage_usb_ids, |
1068 | .supports_autosuspend = 1, | ||
1069 | }; | 1056 | }; |
1070 | 1057 | ||
1071 | static int __init usb_stor_init(void) | 1058 | static int __init usb_stor_init(void) |