This patch:
(a) updates some comments
(b) adds some debugging
(c) fixes CB and CBI data stages
(d) adds some missing {'s and }'s -- only dumb luck let the old
version compile.
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.628 -> 1.629
# drivers/usb/storage/transport.c 1.52 -> 1.53
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/13 [EMAIL PROTECTED] 1.629
# Resync with Alan Stern. Add some debugging, fix CB and CBI pipe selection,
# and fix an error involving missing {'s and }'s. It's amazing (sometimes)
# what errors will still compile.
# --------------------------------------------
#
diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c Sun Oct 13 18:35:15 2002
+++ b/drivers/usb/storage/transport.c Sun Oct 13 18:35:15 2002
@@ -647,6 +647,7 @@
/* no error code, so we must have transferred some data,
* just not all of it */
+ US_DEBUGP("-- transferred only %d bytes\n", partial);
return USB_STOR_XFER_SHORT;
}
@@ -654,15 +655,15 @@
* Transfer an entire SCSI command's worth of data payload over the bulk
* pipe.
*
- * Note that this uses usb_stor_transfer_buf to achieve its goals -- this
- * function simply determines if we're going to use scatter-gather or not,
- * and acts appropriately. For now, it also re-interprets the error codes.
+ * Note that this uses usb_stor_bulk_transfer_buf to achieve its goals --
+ * this function simply determines if we're going to use scatter-gather or not,
+ * and acts appropriately.
*/
int usb_stor_bulk_transfer_sg(struct us_data* us, unsigned int pipe,
char *buf, unsigned int length_left, int use_sg, int *residual)
{
int i;
- int result = -1;
+ int result = USB_STOR_XFER_ERROR;
struct scatterlist *sg;
unsigned int amount;
unsigned int partial;
@@ -1046,9 +1047,11 @@
/* DATA STAGE */
/* transfer the data payload for this command, if one exists*/
- if (transfer_length > 0) {
- result = usb_stor_bulk_transfer_srb(us, us->send_bulk_pipe,
- srb, transfer_length);
+ if (transfer_length) {
+ unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ?
+ us->recv_bulk_pipe : us->send_bulk_pipe;
+ result = usb_stor_bulk_transfer_srb(us, pipe, srb,
+ transfer_length);
US_DEBUGP("CBI data stage result is 0x%x\n", result);
/* report any errors */
@@ -1140,6 +1143,7 @@
if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
US_DEBUGP("usb_stor_CB_transport(): transfer aborted\n");
return USB_STOR_TRANSPORT_ABORTED;
+ }
if (result != USB_STOR_XFER_GOOD) {
/* Uh oh... serious problem here */
@@ -1148,9 +1152,11 @@
/* DATA STAGE */
/* transfer the data payload for this command, if one exists*/
- if (transfer_length)
- result = usb_stor_bulk_transfer_srb(us, us->send_bulk_pipe,
- srb, transfer_length);
+ if (transfer_length) {
+ unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ?
+ us->recv_bulk_pipe : us->send_bulk_pipe;
+ result = usb_stor_bulk_transfer_srb(us, pipe, srb,
+ transfer_length);
US_DEBUGP("CB data stage result is 0x%x\n", result);
/* report any errors */
--
Matthew Dharm Home: [EMAIL PROTECTED]
Maintainer, Linux USB Mass Storage Driver
Department of Justice agent. I have come to purify the flock.
-- DOJ agent
User Friendly, 5/22/1998
msg08552/pgp00000.pgp
Description: PGP signature
