ChangeSet 1.738.5.24, 2002/10/13 13:48:00-07:00, [EMAIL PROTECTED]
[PATCH] usb-storage: cache pipe values
This patch to usb-storage makes all pipe values used by the driver an
unsigned int (like they should be), and caches them in the device data
structure.
diff -Nru a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c
--- a/drivers/usb/storage/freecom.c Sun Oct 13 17:08:47 2002
+++ b/drivers/usb/storage/freecom.c Sun Oct 13 17:08:47 2002
@@ -173,7 +173,7 @@
static int
freecom_readdata (Scsi_Cmnd *srb, struct us_data *us,
- int ipipe, int opipe, int count)
+ unsigned int ipipe, unsigned int opipe, int count)
{
freecom_udata_t extra = (freecom_udata_t) us->extra;
struct freecom_xfer_wrap *fxfr =
@@ -214,7 +214,7 @@
static int
freecom_writedata (Scsi_Cmnd *srb, struct us_data *us,
- int ipipe, int opipe, int count)
+ int unsigned ipipe, unsigned int opipe, int count)
{
freecom_udata_t extra = (freecom_udata_t) us->extra;
struct freecom_xfer_wrap *fxfr =
@@ -262,7 +262,7 @@
{
struct freecom_cb_wrap *fcb;
struct freecom_status *fst;
- int ipipe, opipe; /* We need both pipes. */
+ unsigned int ipipe, opipe; /* We need both pipes. */
int result;
int partial;
int length;
@@ -276,8 +276,8 @@
US_DEBUGP("Freecom TRANSPORT STARTED\n");
/* Get handles for both transports. */
- opipe = usb_sndbulkpipe (us->pusb_dev, us->ep_out);
- ipipe = usb_rcvbulkpipe (us->pusb_dev, us->ep_in);
+ opipe = us->send_bulk_pipe;
+ ipipe = us->recv_bulk_pipe;
/* The ATAPI Command always goes out first. */
fcb->Type = FCM_PACKET_ATAPI | 0x00;
@@ -515,8 +515,7 @@
}
}
- result = usb_control_msg(us->pusb_dev,
- usb_rcvctrlpipe(us->pusb_dev, 0),
+ result = usb_control_msg(us->pusb_dev, us->recv_ctrl_pipe,
0x4c, 0xc0, 0x4346, 0x0, buffer, 0x20, 3*HZ);
buffer[32] = '\0';
US_DEBUGP("String returned from FC init is: %s\n", buffer);
@@ -528,8 +527,7 @@
*/
/* send reset */
- result = usb_control_msg(us->pusb_dev,
- usb_sndctrlpipe(us->pusb_dev, 0),
+ result = usb_control_msg(us->pusb_dev, us->send_ctrl_pipe,
0x4d, 0x40, 0x24d8, 0x0, NULL, 0x0, 3*HZ);
US_DEBUGP("result from activate reset is %d\n", result);
@@ -537,8 +535,7 @@
mdelay(250);
/* clear reset */
- result = usb_control_msg(us->pusb_dev,
- usb_sndctrlpipe(us->pusb_dev, 0),
+ result = usb_control_msg(us->pusb_dev, us->send_ctrl_pipe,
0x4d, 0x40, 0x24f8, 0x0, NULL, 0x0, 3*HZ);
US_DEBUGP("result from clear reset is %d\n", result);
diff -Nru a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c
--- a/drivers/usb/storage/initializers.c Sun Oct 13 17:08:47 2002
+++ b/drivers/usb/storage/initializers.c Sun Oct 13 17:08:47 2002
@@ -50,7 +50,7 @@
int result;
US_DEBUGP("Attempting to init eUSCSI bridge...\n");
- result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev, 0),
+ result = usb_control_msg(us->pusb_dev, us->send_ctrl_pipe,
0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR,
0x01, 0x0, &data, 0x1, 5*HZ);
US_DEBUGP("-- result is %d\n", result);
diff -Nru a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
--- a/drivers/usb/storage/isd200.c Sun Oct 13 17:08:47 2002
+++ b/drivers/usb/storage/isd200.c Sun Oct 13 17:08:47 2002
@@ -408,13 +408,13 @@
{
int result;
int partial;
- int pipe;
+ unsigned int pipe;
/* calculate the appropriate pipe information */
if (dataDirection == SCSI_DATA_READ)
- pipe = usb_rcvbulkpipe(us->pusb_dev, us->ep_in);
+ pipe = us->recv_bulk_pipe;
else
- pipe = usb_sndbulkpipe(us->pusb_dev, us->ep_out);
+ pipe = us->send_bulk_pipe;
/* transfer the data */
US_DEBUGP("isd200_transfer_partial(): xfer %d bytes\n", length);
@@ -546,7 +546,6 @@
struct bulk_cb_wrap bcb;
struct bulk_cs_wrap bcs;
int result;
- int pipe;
int partial;
unsigned int transfer_amount;
@@ -566,9 +565,6 @@
bcb.Length = AtaCdbLength;
- /* construct the pipe handle */
- pipe = usb_sndbulkpipe(us->pusb_dev, us->ep_out);
-
/* copy the command payload */
memset(bcb.CDB, 0, sizeof(bcb.CDB));
memcpy(bcb.CDB, AtaCdb, bcb.Length);
@@ -578,8 +574,8 @@
le32_to_cpu(bcb.Signature), bcb.Tag,
(bcb.Lun >> 4), (bcb.Lun & 0xFF),
le32_to_cpu(bcb.DataTransferLength), bcb.Flags, bcb.Length);
- result = usb_stor_bulk_msg(us, &bcb, pipe, US_BULK_CB_WRAP_LEN,
- &partial);
+ result = usb_stor_bulk_msg(us, &bcb, us->send_bulk_pipe,
+ US_BULK_CB_WRAP_LEN, &partial);
US_DEBUGP("Bulk command transfer result=%d\n", result);
/* did we abort this command? */
@@ -589,8 +585,9 @@
else if (result == -EPIPE) {
/* if we stall, we need to clear it before we go on */
- US_DEBUGP("clearing endpoint halt for pipe 0x%x\n", pipe);
- if (usb_stor_clear_halt(us, pipe) < 0)
+ US_DEBUGP("clearing endpoint halt for pipe 0x%x\n",
+ us->send_bulk_pipe);
+ if (usb_stor_clear_halt(us, us->send_bulk_pipe) < 0)
return ISD200_TRANSPORT_ERROR;
} else if (result)
return ISD200_TRANSPORT_ERROR;
@@ -608,13 +605,10 @@
* an explanation of how this code works.
*/
- /* construct the pipe handle */
- pipe = usb_rcvbulkpipe(us->pusb_dev, us->ep_in);
-
/* get CSW for device status */
US_DEBUGP("Attempting to get CSW...\n");
- result = usb_stor_bulk_msg(us, &bcs, pipe, US_BULK_CS_WRAP_LEN,
- &partial);
+ result = usb_stor_bulk_msg(us, &bcs, us->recv_bulk_pipe,
+ US_BULK_CS_WRAP_LEN, &partial);
/* did we abort this command? */
if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
return ISD200_TRANSPORT_ABORTED;
@@ -622,13 +616,14 @@
/* did the attempt to read the CSW fail? */
if (result == -EPIPE) {
- US_DEBUGP("clearing endpoint halt for pipe 0x%x\n", pipe);
- if (usb_stor_clear_halt(us, pipe) < 0)
+ US_DEBUGP("clearing endpoint halt for pipe 0x%x\n",
+ us->recv_bulk_pipe);
+ if (usb_stor_clear_halt(us, us->recv_bulk_pipe) < 0)
return ISD200_TRANSPORT_ERROR;
/* get the status again */
US_DEBUGP("Attempting to get CSW (2nd try)...\n");
- result = usb_stor_bulk_msg(us, &bcs, pipe,
+ result = usb_stor_bulk_msg(us, &bcs, us->recv_bulk_pipe,
US_BULK_CS_WRAP_LEN, &partial);
/* if the command was aborted, indicate that */
@@ -638,8 +633,9 @@
/* if it fails again, we need a reset and return an error*/
if (result == -EPIPE) {
- US_DEBUGP("clearing halt for pipe 0x%x\n", pipe);
- usb_stor_clear_halt(us, pipe);
+ US_DEBUGP("clearing halt for pipe 0x%x\n",
+ us->recv_bulk_pipe);
+ usb_stor_clear_halt(us, us->recv_bulk_pipe);
return ISD200_TRANSPORT_ERROR;
}
}
@@ -937,7 +933,7 @@
/* let's send the command via the control pipe */
result = usb_stor_control_msg(
us,
- usb_sndctrlpipe(us->pusb_dev,0),
+ us->send_ctrl_pipe,
0x01,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
0x0000,
@@ -978,7 +974,7 @@
result = usb_stor_control_msg(
us,
- usb_rcvctrlpipe(us->pusb_dev,0),
+ us->recv_ctrl_pipe,
0x02,
USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
0x0000,
diff -Nru a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
--- a/drivers/usb/storage/jumpshot.c Sun Oct 13 17:08:46 2002
+++ b/drivers/usb/storage/jumpshot.c Sun Oct 13 17:08:46 2002
@@ -95,8 +95,7 @@
return USB_STOR_TRANSPORT_ERROR;
// send the setup
- rc = usb_storage_send_control(us,
- usb_rcvctrlpipe(us->pusb_dev, 0),
+ rc = usb_storage_send_control(us, us->recv_ctrl_pipe,
0, 0xA0, 0, 7, &reply, 1);
if (rc != USB_STOR_TRANSPORT_GOOD)
@@ -160,8 +159,7 @@
command[5] |= (sector >> 24) & 0x0F;
// send the setup + command
- result = usb_storage_send_control(us,
- usb_sndctrlpipe(us->pusb_dev, 0),
+ result = usb_storage_send_control(us, us->send_ctrl_pipe,
0, 0x20, 0, 1, command, 7);
if (result != USB_STOR_TRANSPORT_GOOD)
goto leave;
@@ -247,8 +245,7 @@
command[5] |= (sector >> 24) & 0x0F;
// send the setup + command
- result = usb_storage_send_control(
- us, usb_sndctrlpipe(us->pusb_dev, 0),
+ result = usb_storage_send_control(us, us->send_ctrl_pipe,
0, 0x20, 0, 1, command, 7);
// send the data
@@ -302,8 +299,7 @@
return USB_STOR_TRANSPORT_ERROR;
// send the setup
- rc = usb_storage_send_control(us,
- usb_sndctrlpipe(us->pusb_dev, 0),
+ rc = usb_storage_send_control(us, us->send_ctrl_pipe,
0, 0x20, 0, 6, command, 2);
if (rc != USB_STOR_TRANSPORT_GOOD) {
diff -Nru a/drivers/usb/storage/raw_bulk.c b/drivers/usb/storage/raw_bulk.c
--- a/drivers/usb/storage/raw_bulk.c Sun Oct 13 17:08:47 2002
+++ b/drivers/usb/storage/raw_bulk.c Sun Oct 13 17:08:47 2002
@@ -40,7 +40,7 @@
int
usb_storage_send_control(struct us_data *us,
- int pipe,
+ unsigned int pipe,
unsigned char request,
unsigned char requesttype,
unsigned int value,
@@ -85,12 +85,12 @@
unsigned int len, unsigned int *act_len) {
int result;
- int pipe;
+ unsigned int pipe;
if (direction == SCSI_DATA_READ)
- pipe = usb_rcvbulkpipe(us->pusb_dev, us->ep_in);
+ pipe = us->recv_bulk_pipe;
else
- pipe = usb_sndbulkpipe(us->pusb_dev, us->ep_out);
+ pipe = us->send_bulk_pipe;
result = usb_stor_bulk_msg(us, data, pipe, len, act_len);
diff -Nru a/drivers/usb/storage/raw_bulk.h b/drivers/usb/storage/raw_bulk.h
--- a/drivers/usb/storage/raw_bulk.h Sun Oct 13 17:08:46 2002
+++ b/drivers/usb/storage/raw_bulk.h Sun Oct 13 17:08:46 2002
@@ -3,7 +3,7 @@
/* usb bulk */
extern int usb_storage_send_control(
- struct us_data *us, int pipe,
+ struct us_data *us, unsigned int pipe,
unsigned char request, unsigned char requesttype,
unsigned int value, unsigned int index,
unsigned char *xfer_data, unsigned int xfer_len);
diff -Nru a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
--- a/drivers/usb/storage/sddr09.c Sun Oct 13 17:08:47 2002
+++ b/drivers/usb/storage/sddr09.c Sun Oct 13 17:08:47 2002
@@ -224,15 +224,15 @@
unsigned char direction,
unsigned char *xfer_data,
unsigned int xfer_len) {
- int pipe;
+ unsigned int pipe;
unsigned char requesttype = (0x41 | direction);
// Get the receive or send control pipe number
if (direction == USB_DIR_IN)
- pipe = usb_rcvctrlpipe(us->pusb_dev,0);
+ pipe = us->recv_ctrl_pipe;
else
- pipe = usb_sndctrlpipe(us->pusb_dev,0);
+ pipe = us->send_ctrl_pipe;
return usb_storage_send_control(us, pipe, request, requesttype,
0, 0, xfer_data, xfer_len);
diff -Nru a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
--- a/drivers/usb/storage/shuttle_usbat.c Sun Oct 13 17:08:46 2002
+++ b/drivers/usb/storage/shuttle_usbat.c Sun Oct 13 17:08:46 2002
@@ -50,12 +50,6 @@
#include <linux/errno.h>
#include <linux/slab.h>
-extern int usb_stor_control_msg(struct us_data *us, unsigned int pipe,
- u8 request, u8 requesttype, u16 value, u16 index,
- void *data, u16 size);
-extern int usb_stor_bulk_msg(struct us_data *us, void *data, int pipe,
- unsigned int len, unsigned int *act_len);
-
#define short_pack(LSB,MSB) ( ((u16)(LSB)) | ( ((u16)(MSB))<<8 ) )
#define LSB_of(s) ((s)&0xFF)
#define MSB_of(s) ((s)>>8)
@@ -70,7 +64,7 @@
int result;
result = usb_storage_send_control(us,
- usb_rcvctrlpipe(us->pusb_dev,0),
+ us->recv_ctrl_pipe,
access,
0xC0,
(u16)reg,
@@ -89,7 +83,7 @@
int result;
result = usb_storage_send_control(us,
- usb_sndctrlpipe(us->pusb_dev,0),
+ us->send_ctrl_pipe,
access|0x01,
0x40,
short_pack(reg, content),
@@ -115,7 +109,7 @@
};
result = usb_storage_send_control(us,
- usb_sndctrlpipe(us->pusb_dev,0),
+ us->send_ctrl_pipe,
0x80,
0x40,
0,
@@ -140,7 +134,7 @@
};
result = usb_storage_send_control(us,
- usb_sndctrlpipe(us->pusb_dev,0),
+ us->send_ctrl_pipe,
0x80,
0x40,
0,
@@ -222,7 +216,7 @@
};
result = usb_storage_send_control(us,
- usb_sndctrlpipe(us->pusb_dev,0),
+ us->send_ctrl_pipe,
0x80,
0x40,
0,
@@ -293,7 +287,7 @@
*/
result = usb_storage_send_control(us,
- usb_sndctrlpipe(us->pusb_dev,0),
+ us->send_ctrl_pipe,
0x80,
0x40,
0,
@@ -352,8 +346,7 @@
if (direction==SCSI_DATA_READ && i==0) {
if (usb_stor_clear_halt(us,
- usb_sndbulkpipe(us->pusb_dev,
- us->ep_out)) < 0)
+ us->send_bulk_pipe) < 0)
return USB_STOR_TRANSPORT_ERROR;
}
@@ -413,7 +406,7 @@
}
result = usb_storage_send_control(us,
- usb_sndctrlpipe(us->pusb_dev,0),
+ us->send_ctrl_pipe,
0x80,
0x40,
0,
@@ -439,7 +432,7 @@
int result;
result = usb_storage_send_control(us,
- usb_rcvctrlpipe(us->pusb_dev,0),
+ us->recv_ctrl_pipe,
0x82,
0xC0,
0,
@@ -457,7 +450,7 @@
int result;
result = usb_storage_send_control(us,
- usb_sndctrlpipe(us->pusb_dev,0),
+ us->send_ctrl_pipe,
0x82,
0x40,
short_pack(enable_flags, data_flags),
diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c Sun Oct 13 17:08:46 2002
+++ b/drivers/usb/storage/transport.c Sun Oct 13 17:08:47 2002
@@ -488,7 +488,7 @@
/* This is our function to emulate usb_bulk_msg() with enough control
* to make aborts/resets/timeouts work
*/
-int usb_stor_bulk_msg(struct us_data *us, void *data, int pipe,
+int usb_stor_bulk_msg(struct us_data *us, void *data, unsigned int pipe,
unsigned int len, unsigned int *act_len)
{
int status;
@@ -515,13 +515,12 @@
* Since many vendors in this space limit their testing to interoperability
* with these two OSes, specification violations like this one are common.
*/
-int usb_stor_clear_halt(struct us_data *us, int pipe)
+int usb_stor_clear_halt(struct us_data *us, unsigned int pipe)
{
int result;
int endp = usb_pipeendpoint(pipe) | (usb_pipein(pipe) << 7);
- result = usb_stor_control_msg(us,
- usb_sndctrlpipe(us->pusb_dev, 0),
+ result = usb_stor_control_msg(us, us->send_ctrl_pipe,
USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT, 0,
endp, NULL, 0); /* note: no 3*HZ timeout */
US_DEBUGP("usb_stor_clear_halt: result=%d\n", result);
@@ -556,13 +555,13 @@
{
int result;
int partial;
- int pipe;
+ unsigned int pipe;
- /* calculate the appropriate pipe information */
+ /* get the appropriate pipe value */
if (us->srb->sc_data_direction == SCSI_DATA_READ)
- pipe = usb_rcvbulkpipe(us->pusb_dev, us->ep_in);
+ pipe = us->recv_bulk_pipe;
else
- pipe = usb_sndbulkpipe(us->pusb_dev, us->ep_out);
+ pipe = us->send_bulk_pipe;
/* transfer the data */
US_DEBUGP("usb_stor_transfer_partial(): xfer %d bytes\n", length);
@@ -985,7 +984,7 @@
/* COMMAND STAGE */
/* let's send the command via the control pipe */
- result = usb_stor_control_msg(us, usb_sndctrlpipe(us->pusb_dev,0),
+ result = usb_stor_control_msg(us, us->send_ctrl_pipe,
US_CBI_ADSC,
USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0,
us->ifnum, srb->cmnd, srb->cmd_len);
@@ -1097,7 +1096,7 @@
/* COMMAND STAGE */
/* let's send the command via the control pipe */
- result = usb_stor_control_msg(us, usb_sndctrlpipe(us->pusb_dev,0),
+ result = usb_stor_control_msg(us, us->send_ctrl_pipe,
US_CBI_ADSC,
USB_TYPE_CLASS | USB_RECIP_INTERFACE, 0,
us->ifnum, srb->cmnd, srb->cmd_len);
@@ -1153,12 +1152,12 @@
{
unsigned char data;
int result;
- int pipe;
- /* issue the command -- use usb_control_msg() because
- * this is not a scsi queued-command */
- pipe = usb_rcvctrlpipe(us->pusb_dev, 0);
- result = usb_control_msg(us->pusb_dev, pipe,
+ /* Issue the command -- use usb_control_msg() because this is
+ * not a scsi queued-command. Also note that at this point the
+ * cached pipe values have not yet been stored. */
+ result = usb_control_msg(us->pusb_dev,
+ usb_rcvctrlpipe(us->pusb_dev, 0),
US_BULK_GET_MAX_LUN,
USB_DIR_IN | USB_TYPE_CLASS |
USB_RECIP_INTERFACE,
@@ -1180,7 +1179,6 @@
struct bulk_cb_wrap bcb;
struct bulk_cs_wrap bcs;
int result;
- int pipe;
int partial;
/* set up the command wrapper */
@@ -1193,9 +1191,6 @@
bcb.Lun |= srb->target << 4;
bcb.Length = srb->cmd_len;
- /* construct the pipe handle */
- pipe = usb_sndbulkpipe(us->pusb_dev, us->ep_out);
-
/* copy the command payload */
memset(bcb.CDB, 0, sizeof(bcb.CDB));
memcpy(bcb.CDB, srb->cmnd, bcb.Length);
@@ -1205,8 +1200,8 @@
le32_to_cpu(bcb.Signature), bcb.Tag,
(bcb.Lun >> 4), (bcb.Lun & 0x0F),
bcb.DataTransferLength, bcb.Flags, bcb.Length);
- result = usb_stor_bulk_msg(us, &bcb, pipe, US_BULK_CB_WRAP_LEN,
- &partial);
+ result = usb_stor_bulk_msg(us, &bcb, us->send_bulk_pipe,
+ US_BULK_CB_WRAP_LEN, &partial);
US_DEBUGP("Bulk command transfer result=%d\n", result);
/* did we abort this command? */
@@ -1217,8 +1212,9 @@
/* if we stall, we need to clear it before we go on */
if (result == -EPIPE) {
- US_DEBUGP("clearing endpoint halt for pipe 0x%x\n", pipe);
- result = usb_stor_clear_halt(us, pipe);
+ US_DEBUGP("clearing endpoint halt for pipe 0x%x\n",
+ us->send_bulk_pipe);
+ result = usb_stor_clear_halt(us, us->send_bulk_pipe);
/* did we abort this command? */
if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
@@ -1251,13 +1247,10 @@
* an explanation of how this code works.
*/
- /* construct the pipe handle */
- pipe = usb_rcvbulkpipe(us->pusb_dev, us->ep_in);
-
/* get CSW for device status */
US_DEBUGP("Attempting to get CSW...\n");
- result = usb_stor_bulk_msg(us, &bcs, pipe, US_BULK_CS_WRAP_LEN,
- &partial);
+ result = usb_stor_bulk_msg(us, &bcs, us->recv_bulk_pipe,
+ US_BULK_CS_WRAP_LEN, &partial);
/* did we abort this command? */
if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
@@ -1267,8 +1260,9 @@
/* did the attempt to read the CSW fail? */
if (result == -EPIPE) {
- US_DEBUGP("clearing endpoint halt for pipe 0x%x\n", pipe);
- result = usb_stor_clear_halt(us, pipe);
+ US_DEBUGP("clearing endpoint halt for pipe 0x%x\n",
+ us->recv_bulk_pipe);
+ result = usb_stor_clear_halt(us, us->recv_bulk_pipe);
/* did we abort this command? */
if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
@@ -1280,7 +1274,7 @@
/* get the status again */
US_DEBUGP("Attempting to get CSW (2nd try)...\n");
- result = usb_stor_bulk_msg(us, &bcs, pipe,
+ result = usb_stor_bulk_msg(us, &bcs, us->recv_bulk_pipe,
US_BULK_CS_WRAP_LEN, &partial);
/* did we abort this command? */
@@ -1291,8 +1285,9 @@
/* if it fails again, we need a reset and return an error*/
if (result == -EPIPE) {
- US_DEBUGP("clearing halt for pipe 0x%x\n", pipe);
- result = usb_stor_clear_halt(us, pipe);
+ US_DEBUGP("clearing halt for pipe 0x%x\n",
+ us->recv_bulk_pipe);
+ result = usb_stor_clear_halt(us, us->recv_bulk_pipe);
/* did we abort this command? */
if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
@@ -1364,7 +1359,7 @@
* following a powerup or USB attach event. */
/* Use usb_control_msg() because this is not a queued-command */
- result = usb_control_msg(us->pusb_dev, usb_sndctrlpipe(us->pusb_dev,0),
+ result = usb_control_msg(us->pusb_dev, us->send_ctrl_pipe,
request, requesttype, value, index, data, size,
20*HZ);
if (result < 0)
@@ -1377,14 +1372,12 @@
/* Use usb_clear_halt() because this is not a queued-command */
US_DEBUGP("Soft reset: clearing bulk-in endpoint halt\n");
- result = usb_clear_halt(us->pusb_dev,
- usb_rcvbulkpipe(us->pusb_dev, us->ep_in));
+ result = usb_clear_halt(us->pusb_dev, us->recv_bulk_pipe);
if (result < 0)
goto Done;
US_DEBUGP("Soft reset: clearing bulk-out endpoint halt\n");
- result = usb_clear_halt(us->pusb_dev,
- usb_sndbulkpipe(us->pusb_dev, us->ep_out));
+ result = usb_clear_halt(us->pusb_dev, us->send_bulk_pipe);
Done:
diff -Nru a/drivers/usb/storage/transport.h b/drivers/usb/storage/transport.h
--- a/drivers/usb/storage/transport.h Sun Oct 13 17:08:47 2002
+++ b/drivers/usb/storage/transport.h Sun Oct 13 17:08:47 2002
@@ -153,12 +153,12 @@
extern void usb_stor_abort_transport(struct us_data*);
extern int usb_stor_transfer_partial(struct us_data*, char*, int);
-extern int usb_stor_bulk_msg(struct us_data *us, void *data, int pipe,
- unsigned int len, unsigned int *act_len);
+extern int usb_stor_bulk_msg(struct us_data *us, void *data,
+ unsigned int pipe, unsigned int len, unsigned int *act_len);
extern int usb_stor_control_msg(struct us_data *us, unsigned int pipe,
u8 request, u8 requesttype, u16 value, u16 index,
void *data, u16 size);
-extern int usb_stor_clear_halt(struct us_data*, int );
+extern int usb_stor_clear_halt(struct us_data*, unsigned int pipe);
extern void usb_stor_transfer(Scsi_Cmnd*, struct us_data*);
#endif
diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c Sun Oct 13 17:08:46 2002
+++ b/drivers/usb/storage/usb.c Sun Oct 13 17:08:46 2002
@@ -525,6 +525,12 @@
int maxp;
int result;
+ /* calculate and store the pipe values */
+ ss->send_bulk_pipe = usb_sndbulkpipe(ss->pusb_dev, ss->ep_out);
+ ss->recv_bulk_pipe = usb_rcvbulkpipe(ss->pusb_dev, ss->ep_in);
+ ss->send_ctrl_pipe = usb_sndctrlpipe(ss->pusb_dev, 0);
+ ss->recv_ctrl_pipe = usb_rcvctrlpipe(ss->pusb_dev, 0);
+
/* allocate the usb_ctrlrequest for control packets */
US_DEBUGP("Allocating usb_ctrlrequest\n");
ss->dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO);
diff -Nru a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
--- a/drivers/usb/storage/usb.h Sun Oct 13 17:08:47 2002
+++ b/drivers/usb/storage/usb.h Sun Oct 13 17:08:47 2002
@@ -134,6 +134,10 @@
struct semaphore dev_semaphore; /* protect pusb_dev */
struct usb_device *pusb_dev; /* this usb_device */
unsigned long flags; /* from filter initially */
+ unsigned int send_bulk_pipe; /* cached pipe values */
+ unsigned int recv_bulk_pipe;
+ unsigned int send_ctrl_pipe;
+ unsigned int recv_ctrl_pipe;
/* information about the device -- always good */
char vendor[USB_STOR_STRING_LEN];
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel