This patch adds some helper functions, which are used by some later
patches, in our quest to make all the sub-drivers scatter-gather-safe.

Greg, please apply.

Matt

----- Forwarded message from Alan Stern <[EMAIL PROTECTED]> -----

Date: Mon, 24 Nov 2003 16:25:27 -0500 (EST)
From: Alan Stern <[EMAIL PROTECTED]>
Subject: PATCH: (as145) Another utility scatter-gather routine
To: Matthew Dharm <[EMAIL PROTECTED]>
cc: USB Storage List <[EMAIL PROTECTED]>
X-Spam-Status: No, hits=-4.0 required=5.0 tests=UNIFIED_PATCH,RCVD_IN_ORBZ version=2.11

Matt:

This patch adds a small utility routine for storing data in a transfer 
buffer.  The next patch uses this routine quite a bit in the isd200 
driver.

Alan Stern


--- a/drivers/usb/storage/protocol.h    Mon Nov 24 14:03:08 2003
+++ b/drivers/usb/storage/protocol.h    Mon Nov 24 14:03:45 2003
@@ -72,4 +72,6 @@
        unsigned int buflen, Scsi_Cmnd *srb, unsigned int *index,
        unsigned int *offset, enum xfer_buf_dir dir);
 
+extern void usb_stor_set_xfer_buf(unsigned char *buffer,
+       unsigned int buflen, Scsi_Cmnd *srb);
 #endif
--- a/drivers/usb/storage/protocol.c    Mon Nov 24 14:03:01 2003
+++ b/drivers/usb/storage/protocol.c    Mon Nov 24 14:07:16 2003
@@ -295,3 +295,16 @@
        }
        return cnt;
 }
+
+/* Store the contents of buffer into srb's transfer buffer and set the
+ * residue. */
+void usb_stor_set_xfer_buf(unsigned char *buffer,
+       unsigned int buflen, Scsi_Cmnd *srb)
+{
+       unsigned int index = 0, offset = 0;
+
+       usb_stor_access_xfer_buf(buffer, buflen, srb, &index, &offset,
+                       TO_XFER_BUF);
+       if (buflen < srb->request_bufflen)
+               srb->resid = srb->request_bufflen - buflen;
+}
--- a/drivers/usb/storage/usb.c Mon Nov 24 14:02:55 2003
+++ b/drivers/usb/storage/usb.c Mon Nov 24 14:07:20 2003
@@ -236,8 +236,6 @@
 void fill_inquiry_response(struct us_data *us, unsigned char *data,
                unsigned int data_len)
 {
-       unsigned int index, offset;
-
        if (data_len<36) // You lose.
                return;
 
@@ -264,11 +262,7 @@
                data[35] = 0x30 + ((us->pusb_dev->descriptor.bcdDevice) & 0x0F);
        }
 
-       index = offset = 0;
-       usb_stor_access_xfer_buf(data, data_len, us->srb,
-                       &index, &offset, TO_XFER_BUF);
-       if (data_len < us->srb->request_bufflen)
-               us->srb->resid = us->srb->request_bufflen - data_len;
+       usb_stor_set_xfer_buf(data, data_len, us->srb);
 }
 
 static int usb_stor_control_thread(void * __us)

----- End forwarded message -----

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

E:  You run this ship with Windows?!  YOU IDIOT!
L:  Give me a break, it came bundled with the computer!
                                        -- ESR and Lan Solaris
User Friendly, 12/8/1998

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to