diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2008-05-08 11:55:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-21 15:15:54 -0700 |
commit | 543f7810fba2a62e412efa9473ad08167b691f09 (patch) | |
tree | 4e29d5b264b44ed544ea4fa6aec3389c504e9b68 /drivers/usb/storage/usb.h | |
parent | 9da82bd4649334817ef0e752a69eb99051645dad (diff) | |
download | blackbird-op-linux-543f7810fba2a62e412efa9473ad08167b691f09.tar.gz blackbird-op-linux-543f7810fba2a62e412efa9473ad08167b691f09.zip |
usb-storage: implement "soft" unbinding
This patch (as1092) implements "soft" unbinding for usb-storage. When
the disconnect routine is called, all commands and reset delays are
allowed to complete normally until after scsi_remove_host() returns.
This means that the commands needed for an orderly shutdown will be
sent through to the device.
Unlike before, the driver will now execute every command that it
accepts. Hence there's no need for special code to catch unexecuted
commands and fail them.
The new sequence of events when disconnect runs goes as follows:
If the device is truly unplugged, set the DISCONNECTING
flag so we won't try to access it any more.
If the SCSI-scanning thread hasn't started up yet, prevent
it from doing anything by setting the new DONT_SCAN flag.
Then wake it up and wait for it to terminate.
Remove the SCSI host. This unbinds the upper-level drivers,
doing an orderly shutdown. Commands sent to quiesce the
device will be transmitted normally, unless the device is
unplugged.
Set the DISCONNECTING flag so that we won't accept any new
commands that might get submitted (there aren't supposed to be
any) and we won't try to access the device for resets.
Tell the control thread to exit by waking it up with no
pending command, and wait for it to terminate.
Go on to do all the other normal stuff: releasing resources,
freeing memory, and so on.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/storage/usb.h')
-rw-r--r-- | drivers/usb/storage/usb.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h index 8da96da5875d..47906dc620db 100644 --- a/drivers/usb/storage/usb.h +++ b/drivers/usb/storage/usb.h @@ -72,11 +72,9 @@ struct us_unusual_dev { #define US_FLIDX_SG_ACTIVE 1 /* current_sg is in use */ #define US_FLIDX_ABORTING 2 /* abort is in progress */ #define US_FLIDX_DISCONNECTING 3 /* disconnect in progress */ -#define ABORTING_OR_DISCONNECTING ((1UL << US_FLIDX_ABORTING) | \ - (1UL << US_FLIDX_DISCONNECTING)) #define US_FLIDX_RESETTING 4 /* device reset in progress */ #define US_FLIDX_TIMED_OUT 5 /* SCSI midlayer timed out */ - +#define US_FLIDX_DONT_SCAN 6 /* don't scan (disconnect) */ #define USB_STOR_STRING_LEN 32 |