patch-2.4.8 linux/drivers/usb/storage/transport.c
Next file: linux/drivers/usb/storage/transport.h
Previous file: linux/drivers/usb/storage/shuttle_usbat.c
Back to the patch index
Back to the overall index
- Lines: 184
- Date:
Sun Jul 29 21:11:50 2001
- Orig file:
v2.4.7/linux/drivers/usb/storage/transport.c
- Orig date:
Wed Apr 18 11:49:12 2001
diff -u --recursive --new-file v2.4.7/linux/drivers/usb/storage/transport.c linux/drivers/usb/storage/transport.c
@@ -1,6 +1,6 @@
/* Driver for USB Mass Storage compliant devices
*
- * $Id: transport.c,v 1.38 2000/11/21 00:52:10 mdharm Exp $
+ * $Id: transport.c,v 1.39 2001/03/10 16:46:28 zagor Exp $
*
* Current development and maintenance by:
* (c) 1999, 2000 Matthew Dharm (mdharm-usb@one-eyed-alien.net)
@@ -52,7 +52,7 @@
#include <linux/sched.h>
#include <linux/errno.h>
-#include <linux/slab.h>
+#include <linux/malloc.h>
/***********************************************************************
* Helper routines
@@ -342,7 +342,7 @@
* the device -- this is because some devices crash their internal firmware
* when the status is requested after a halt
*/
-static int clear_halt(struct usb_device *dev, int pipe)
+int usb_stor_clear_halt(struct usb_device *dev, int pipe)
{
int result;
int endp = usb_pipeendpoint(pipe) | (usb_pipein(pipe) << 7);
@@ -536,7 +536,7 @@
/* 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);
- clear_halt(us->pusb_dev, pipe);
+ usb_stor_clear_halt(us->pusb_dev, pipe);
}
/* did we send all the data? */
@@ -577,7 +577,7 @@
* 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.
*/
-static void us_transfer(Scsi_Cmnd *srb, struct us_data* us)
+void usb_stor_transfer(Scsi_Cmnd *srb, struct us_data* us)
{
int i;
int result = -1;
@@ -635,7 +635,7 @@
/* Invoke the transport and basic error-handling/recovery methods
*
* This is used by the protocol layers to actually send the message to
- * the device and receive the response.
+ * the device and recieve the response.
*/
void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
{
@@ -821,7 +821,7 @@
{
struct us_data *us = (struct us_data *)urb->context;
- US_DEBUGP("USB IRQ received for device on host %d\n", us->host_no);
+ US_DEBUGP("USB IRQ recieved for device on host %d\n", us->host_no);
US_DEBUGP("-- IRQ data length is %d\n", urb->actual_length);
US_DEBUGP("-- IRQ state is %d\n", urb->status);
US_DEBUGP("-- Interrupt Status (0x%x, 0x%x)\n",
@@ -895,10 +895,10 @@
/* STALL must be cleared when they are detected */
if (result == -EPIPE) {
US_DEBUGP("-- Stall on control pipe. Clearing\n");
- result = clear_halt(us->pusb_dev,
+ result = usb_stor_clear_halt(us->pusb_dev,
usb_sndctrlpipe(us->pusb_dev,
0));
- US_DEBUGP("-- clear_halt() returns %d\n", result);
+ US_DEBUGP("-- usb_stor_clear_halt() returns %d\n", result);
return USB_STOR_TRANSPORT_FAILED;
}
@@ -909,7 +909,7 @@
/* DATA STAGE */
/* transfer the data payload for this command, if one exists*/
if (usb_stor_transfer_length(srb)) {
- us_transfer(srb, us);
+ usb_stor_transfer(srb, us);
US_DEBUGP("CBI data stage result is 0x%x\n", srb->result);
/* if it was aborted, we need to indicate that */
@@ -999,10 +999,10 @@
/* a stall is a fatal condition from the device */
if (result == -EPIPE) {
US_DEBUGP("-- Stall on control pipe. Clearing\n");
- result = clear_halt(us->pusb_dev,
+ result = usb_stor_clear_halt(us->pusb_dev,
usb_sndctrlpipe(us->pusb_dev,
0));
- US_DEBUGP("-- clear_halt() returns %d\n", result);
+ US_DEBUGP("-- usb_stor_clear_halt() returns %d\n", result);
return USB_STOR_TRANSPORT_FAILED;
}
@@ -1013,7 +1013,7 @@
/* DATA STAGE */
/* transfer the data payload for this command, if one exists*/
if (usb_stor_transfer_length(srb)) {
- us_transfer(srb, us);
+ usb_stor_transfer(srb, us);
US_DEBUGP("CB data stage result is 0x%x\n", srb->result);
/* if it was aborted, we need to indicate that */
@@ -1057,7 +1057,7 @@
/* if we get a STALL, clear the stall */
if (result == -EPIPE) {
US_DEBUGP("clearing endpoint halt for pipe 0x%x\n", pipe);
- clear_halt(us->pusb_dev, pipe);
+ usb_stor_clear_halt(us->pusb_dev, pipe);
}
/* return the default -- no LUNs */
@@ -1111,17 +1111,17 @@
/* 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);
- clear_halt(us->pusb_dev, pipe);
+ usb_stor_clear_halt(us->pusb_dev, pipe);
} else if (result) {
/* unknown error -- we've got a problem */
return USB_STOR_TRANSPORT_ERROR;
}
- /* if the command transferred well, then we go to the data stage */
+ /* if the command transfered well, then we go to the data stage */
if (result == 0) {
/* send/receive data payload, if there is any */
if (bcb.DataTransferLength) {
- us_transfer(srb, us);
+ usb_stor_transfer(srb, us);
US_DEBUGP("Bulk data transfer result 0x%x\n",
srb->result);
@@ -1150,7 +1150,7 @@
/* did the attempt to read the CSW fail? */
if (result == -EPIPE) {
US_DEBUGP("clearing endpoint halt for pipe 0x%x\n", pipe);
- clear_halt(us->pusb_dev, pipe);
+ usb_stor_clear_halt(us->pusb_dev, pipe);
/* get the status again */
US_DEBUGP("Attempting to get CSW (2nd try)...\n");
@@ -1164,7 +1164,7 @@
/* 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);
- clear_halt(us->pusb_dev, pipe);
+ usb_stor_clear_halt(us->pusb_dev, pipe);
return USB_STOR_TRANSPORT_ERROR;
}
}
@@ -1243,10 +1243,10 @@
set_current_state(TASK_RUNNING);
US_DEBUGP("CB_reset: clearing endpoint halt\n");
- clear_halt(us->pusb_dev,
- usb_rcvbulkpipe(us->pusb_dev, us->ep_in));
- clear_halt(us->pusb_dev,
- usb_rcvbulkpipe(us->pusb_dev, us->ep_out));
+ usb_stor_clear_halt(us->pusb_dev,
+ usb_rcvbulkpipe(us->pusb_dev, us->ep_in));
+ usb_stor_clear_halt(us->pusb_dev,
+ usb_rcvbulkpipe(us->pusb_dev, us->ep_out));
US_DEBUGP("CB_reset done\n");
/* return a result code based on the result of the control message */
@@ -1282,10 +1282,10 @@
schedule_timeout(HZ*6);
set_current_state(TASK_RUNNING);
- clear_halt(us->pusb_dev,
- usb_rcvbulkpipe(us->pusb_dev, us->ep_in));
- clear_halt(us->pusb_dev,
- usb_sndbulkpipe(us->pusb_dev, us->ep_out));
+ usb_stor_clear_halt(us->pusb_dev,
+ usb_rcvbulkpipe(us->pusb_dev, us->ep_in));
+ usb_stor_clear_halt(us->pusb_dev,
+ usb_sndbulkpipe(us->pusb_dev, us->ep_out));
US_DEBUGP("Bulk soft reset completed\n");
return SUCCESS;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)