This patch adds tests for an aborted command to higher-level functions. This allows faster exit from a couple of paths and will allow code consolidation in the lower-level transport functions.
Greg, please apply.
Matt
# This is a BitKeeper generated patch for the following project:
# Project Name: greg k-h's linux 2.5 USB kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.641 -> 1.642
# drivers/usb/storage/isd200.c 1.21 -> 1.22
# drivers/usb/storage/transport.c 1.60 -> 1.61
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/11/03 [EMAIL PROTECTED] 1.642
# Check for an abort condition at a high-level of command processing, so
# lower-levels don't necessarily have to do so.
# --------------------------------------------
#
diff -Nru a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
--- a/drivers/usb/storage/isd200.c Sun Nov 3 14:52:32 2002
+++ b/drivers/usb/storage/isd200.c Sun Nov 3 14:52:32 2002
@@ -818,11 +818,22 @@
{
int need_auto_sense = 0;
int transferStatus;
+ int result;
/* send the command to the transport layer */
srb->resid = 0;
transferStatus = isd200_Bulk_transport(us, srb, ataCdb,
sizeof(ataCdb->generic));
+
+ /* if the command gets aborted by the higher layers, we need to
+ * short-circuit all other processing
+ */
+ if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
+ US_DEBUGP("-- transport indicates command was aborted\n");
+ srb->result = DID_ABORT << 16;
+ return;
+ }
+
switch (transferStatus) {
case ISD200_TRANSPORT_GOOD:
@@ -866,9 +877,14 @@
}
- if (need_auto_sense)
- if (isd200_read_regs(us) == ISD200_GOOD)
+ if (need_auto_sense) {
+ result = isd200_read_regs(us);
+ if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
+ US_DEBUGP("-- auto-sense aborted\n");
+ srb->result = DID_ABORT << 16;
+ } else if (result == ISD200_GOOD)
isd200_build_sense(us, srb);
+ }
/* Regardless of auto-sense, if we _know_ we have an error
* condition, show that in the result code
diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c Sun Nov 3 14:52:32 2002
+++ b/drivers/usb/storage/transport.c Sun Nov 3 14:52:32 2002
@@ -790,13 +790,14 @@
/* if the command gets aborted by the higher layers, we need to
* short-circuit all other processing
*/
- if (result == USB_STOR_TRANSPORT_ABORTED) {
+ if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
US_DEBUGP("-- transport indicates command was aborted\n");
srb->result = DID_ABORT << 16;
return;
}
/* if there is a transport error, reset and don't auto-sense */
+ /* What if we want to abort during the reset? */
if (result == USB_STOR_TRANSPORT_ERROR) {
US_DEBUGP("-- transport indicates error, resetting\n");
us->transport_reset(us);
@@ -904,7 +905,7 @@
srb->sc_data_direction = old_sc_data_direction;
memcpy(srb->cmnd, old_cmnd, MAX_COMMAND_SIZE);
- if (temp_result == USB_STOR_TRANSPORT_ABORTED) {
+ if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
US_DEBUGP("-- auto-sense aborted\n");
srb->result = DID_ABORT << 16;
return;
@@ -917,6 +918,7 @@
* auto-sense is perfectly valid
*/
if (!(us->flags & US_FL_SCM_MULT_TARG)) {
+ /* What if we try to abort during the reset? */
us->transport_reset(us);
}
srb->result = DID_ERROR << 16;
--
Matthew Dharm Home: [EMAIL PROTECTED]
Maintainer, Linux USB Mass Storage Driver
I see you've been reading alt.sex.chubby.sheep voraciously.
-- Tanya
User Friendly, 11/24/97
msg09198/pgp00000.pgp
Description: PGP signature
