summaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/usb.h
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-08-16 16:16:00 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-08-22 14:27:52 -0700
commit2f67cd5b1d5066d11761aebb0bf4b76bc253cc99 (patch)
tree937b0f53c025ea429d0814c6200322b3460487a7 /drivers/usb/storage/usb.h
parentfa0de2b614ca89d14d046e6756ba020fd386ff71 (diff)
usb-storage: fix bugs in the disconnect pathway
This patch (as961) fixes a couple of bugs in the disconnect pathway of usb-storage. The first problem, which apparently has been around for a while although nobody noticed it, shows up when an aborted command is still pending when a disconnect occurs. The SCSI error-handler will continue to wait in command_abort() until the us->notify completion is signalled. Thus quiesce_and_remove_host() needs to signal it. The second problem was introduced recently along with autosuspend support. Since usb_stor_scan_thread() now calls usb_autopm_put_interface() before exiting, we can't simply leave the scanning thread running after a disconnect; we must wait until the thread exits. This is solved by adding a new struct completion to the private data structure. Fortuitously, it allows the removal of the rather clunky mechanism used in the past to insure that all threads have finished before the module is unloaded. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/storage/usb.h')
-rw-r--r--drivers/usb/storage/usb.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
index 6445665b157..8d87503e256 100644
--- a/drivers/usb/storage/usb.h
+++ b/drivers/usb/storage/usb.h
@@ -150,6 +150,7 @@ struct us_data {
struct semaphore sema; /* to sleep thread on */
struct completion notify; /* thread begin/end */
wait_queue_head_t delay_wait; /* wait during scan, reset */
+ struct completion scanning_done; /* wait for scan thread */
/* subdriver information */
void *extra; /* Any extra data */