This patch changes freecom.c and isd200.c to use the new data-moving logic
instead of the old data-moving logic.  This allows for code consolidation
and better error-handling.

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.652   -> 1.653  
#       drivers/usb/storage/isd200.c    1.28    -> 1.29   
#       drivers/usb/storage/freecom.c   1.22    -> 1.23   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/11/17      [EMAIL PROTECTED]       1.653
# Changed a couple of sub-drivers from old-style calls to new-style calls,
# so they get the benefits of all the added logic and ease-of-use of the
# new functions.  A couple of minor cleanups, also.
# --------------------------------------------
#
diff -Nru a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c
--- a/drivers/usb/storage/freecom.c     Sun Nov 17 15:38:01 2002
+++ b/drivers/usb/storage/freecom.c     Sun Nov 17 15:38:01 2002
@@ -115,7 +115,7 @@
         freecom_udata_t extra = (freecom_udata_t) us->extra;
         struct freecom_xfer_wrap *fxfr =
                 (struct freecom_xfer_wrap *) extra->buffer;
-        int result, partial;
+        int result;
 
         fxfr->Type = FCM_PACKET_INPUT | 0x00;
         fxfr->Timeout = 0;    /* Short timeout for debugging. */
@@ -125,14 +125,12 @@
         US_DEBUGP("Read data Freecom! (c=%d)\n", count);
 
         /* Issue the transfer command. */
-        result = usb_stor_bulk_msg (us, fxfr, opipe,
-                        FCM_PACKET_LENGTH, &partial);
+        result = usb_stor_bulk_transfer_buf (us, opipe, fxfr,
+                        FCM_PACKET_LENGTH, NULL);
         if (result != USB_STOR_XFER_GOOD) {
-                US_DEBUGP ("Freecom readdata xport failure: r=%d, p=%d\n",
-                                result, partial);
+                US_DEBUGP ("Freecom readdata transport error\n");
                 return USB_STOR_TRANSPORT_ERROR;
         }
-        US_DEBUGP("Done issuing read request: %d %d\n", result, partial);
 
         /* Now transfer all of our blocks. */
        US_DEBUGP("Start of read\n");
@@ -151,7 +149,7 @@
         freecom_udata_t extra = (freecom_udata_t) us->extra;
         struct freecom_xfer_wrap *fxfr =
                 (struct freecom_xfer_wrap *) extra->buffer;
-        int result, partial;
+        int result;
 
         fxfr->Type = FCM_PACKET_OUTPUT | 0x00;
         fxfr->Timeout = 0;    /* Short timeout for debugging. */
@@ -161,15 +159,12 @@
         US_DEBUGP("Write data Freecom! (c=%d)\n", count);
 
         /* Issue the transfer command. */
-        result = usb_stor_bulk_msg (us, fxfr, opipe,
-                        FCM_PACKET_LENGTH, &partial);
+        result = usb_stor_bulk_transfer_buf (us, opipe, fxfr,
+                        FCM_PACKET_LENGTH, NULL);
         if (result != USB_STOR_XFER_GOOD) {
-                US_DEBUGP ("Freecom writedata xport failure: r=%d, p=%d\n",
-                                result, partial);
+                US_DEBUGP ("Freecom writedata transport error\n");
                 return USB_STOR_TRANSPORT_ERROR;
         }
-        US_DEBUGP("Done issuing write request: %d %d\n",
-                        result, partial);
 
         /* Now transfer all of our blocks. */
        US_DEBUGP("Start of write\n");
@@ -191,7 +186,7 @@
         struct freecom_status  *fst;
         unsigned int ipipe, opipe;             /* We need both pipes. */
         int result;
-        int partial;
+       unsigned int partial;
         int length;
         freecom_udata_t extra;
 
@@ -215,23 +210,22 @@
         US_DEBUG(pdump (srb->cmnd, 12));
 
         /* Send it out. */
-        result = usb_stor_bulk_msg (us, fcb, opipe,
-                        FCM_PACKET_LENGTH, &partial);
+        result = usb_stor_bulk_transfer_buf (us, opipe, fcb,
+                        FCM_PACKET_LENGTH, NULL);
 
         /* The Freecom device will only fail if there is something wrong in
          * USB land.  It returns the status in its own registers, which
          * come back in the bulk pipe. */
         if (result != USB_STOR_XFER_GOOD) {
-                US_DEBUGP ("freecom xport failure: r=%d, p=%d\n",
-                                result, partial);
+                US_DEBUGP ("freecom transport error\n");
                 return USB_STOR_TRANSPORT_ERROR;
         }
 
         /* There are times we can optimize out this status read, but it
          * doesn't hurt us to always do it now. */
-        result = usb_stor_bulk_msg (us, fst, ipipe,
+        result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
                         FCM_PACKET_LENGTH, &partial);
-        US_DEBUGP("foo Status result %d %d\n", result, partial);
+        US_DEBUGP("foo Status result %d %u\n", result, partial);
        if (result != USB_STOR_XFER_GOOD)
                return USB_STOR_TRANSPORT_ERROR;
 
@@ -256,24 +250,23 @@
                memset (fcb->Filler, 0, sizeof (fcb->Filler));
 
                /* Send it out. */
-               result = usb_stor_bulk_msg (us, fcb, opipe,
-                               FCM_PACKET_LENGTH, &partial);
+               result = usb_stor_bulk_transfer_buf (us, opipe, fcb,
+                               FCM_PACKET_LENGTH, NULL);
 
                /* The Freecom device will only fail if there is something
                 * wrong in USB land.  It returns the status in its own
                 * registers, which come back in the bulk pipe.
                 */
                if (result != USB_STOR_XFER_GOOD) {
-                       US_DEBUGP ("freecom xport failure: r=%d, p=%d\n",
-                                       result, partial);
+                       US_DEBUGP ("freecom transport error\n");
                        return USB_STOR_TRANSPORT_ERROR;
                }
 
                /* get the data */
-               result = usb_stor_bulk_msg (us, fst, ipipe,
+               result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
                                FCM_PACKET_LENGTH, &partial);
 
-               US_DEBUGP("bar Status result %d %d\n", result, partial);
+               US_DEBUGP("bar Status result %d %u\n", result, partial);
                if (result > USB_STOR_XFER_SHORT)
                        return USB_STOR_TRANSPORT_ERROR;
 
@@ -328,7 +321,7 @@
                         return result;
 
                 US_DEBUGP("FCM: Waiting for status\n");
-                result = usb_stor_bulk_msg (us, fst, ipipe,
+                result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
                                 FCM_PACKET_LENGTH, &partial);
                US_DEBUG(pdump ((void *) fst, partial));
 
@@ -354,7 +347,7 @@
                         return result;
 
                 US_DEBUGP("FCM: Waiting for status\n");
-                result = usb_stor_bulk_msg (us, fst, ipipe,
+                result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
                                 FCM_PACKET_LENGTH, &partial);
 
                 if (partial != 4 || result > USB_STOR_XFER_SHORT)
@@ -385,13 +378,6 @@
         }
 
         return USB_STOR_TRANSPORT_GOOD;
-
-        US_DEBUGP("Freecom: transfer_length = %d\n",
-                       usb_stor_transfer_length (srb));
-
-        US_DEBUGP("Freecom: direction = %d\n", srb->sc_data_direction);
-
-        return USB_STOR_TRANSPORT_ERROR;
 }
 
 int
diff -Nru a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
--- a/drivers/usb/storage/isd200.c      Sun Nov 17 15:38:01 2002
+++ b/drivers/usb/storage/isd200.c      Sun Nov 17 15:38:01 2002
@@ -668,7 +668,7 @@
 #endif
 
        /* let's send the command via the control pipe */
-       result = usb_stor_control_msg(
+       result = usb_stor_ctrl_transfer(
                 us, 
                 us->send_ctrl_pipe,
                 0x01, 
@@ -709,7 +709,7 @@
        /* read the configuration information from ISD200.  Use this to */
        /* determine what the special ATA CDB bytes are.                */
 
-       result = usb_stor_control_msg(
+       result = usb_stor_ctrl_transfer(
                 us, 
                 us->recv_ctrl_pipe,
                 0x02, 

-- 
Matthew Dharm                              Home: [EMAIL PROTECTED] 
Maintainer, Linux USB Mass Storage Driver

I think the problem is there's a nut loose on your keyboard.
                                        -- Greg to Customer
User Friendly, 1/5/1999 

Attachment: msg09470/pgp00000.pgp
Description: PGP signature

Reply via email to