This patch is originally from Christoph Hellwig. This patch coverts from Scsi_Foo typefs to struct scsi_cmnd, and moved from the SCSI data direction constants to the DMA ones.
It also switches to the proper (or so they tell me) use of <scsi/*.h>
headers. This also includes some additional reshuffling to avoid useless
headers in the usb-storage local headers (to improve compile time).
Signed-off-by: Matthew Dharm <[EMAIL PROTECTED]>
===== drivers/usb/storage/datafab.c 1.34 vs edited =====
--- 1.34/drivers/usb/storage/datafab.c Sun May 23 13:01:57 2004
+++ edited/drivers/usb/storage/datafab.c Tue Jul 20 23:30:17 2004
@@ -50,16 +50,19 @@
* in that routine.
*/
+#include <linux/sched.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+
#include "transport.h"
#include "protocol.h"
#include "usb.h"
#include "debug.h"
#include "datafab.h"
-#include <linux/sched.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-
static int datafab_determine_lun(struct us_data *us,
struct datafab_info *info);
@@ -388,7 +391,7 @@
static int datafab_handle_mode_sense(struct us_data *us,
- Scsi_Cmnd * srb,
+ struct scsi_cmnd * srb,
int sense_6)
{
static unsigned char rw_err_page[12] = {
@@ -498,7 +501,7 @@
// Transport for the Datafab MDCFE-B
//
-int datafab_transport(Scsi_Cmnd * srb, struct us_data *us)
+int datafab_transport(struct scsi_cmnd * srb, struct us_data *us)
{
struct datafab_info *info;
int rc;
@@ -625,12 +628,12 @@
if (srb->cmnd[0] == MODE_SENSE) {
US_DEBUGP("datafab_transport: MODE_SENSE_6 detected\n");
- return datafab_handle_mode_sense(us, srb, TRUE);
+ return datafab_handle_mode_sense(us, srb, 1);
}
if (srb->cmnd[0] == MODE_SENSE_10) {
US_DEBUGP("datafab_transport: MODE_SENSE_10 detected\n");
- return datafab_handle_mode_sense(us, srb, FALSE);
+ return datafab_handle_mode_sense(us, srb, 0);
}
if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) {
===== drivers/usb/storage/datafab.h 1.5 vs edited =====
--- 1.5/drivers/usb/storage/datafab.h Mon Feb 9 21:33:13 2004
+++ edited/drivers/usb/storage/datafab.h Tue Jul 20 23:30:17 2004
@@ -24,7 +24,7 @@
#ifndef _USB_DATAFAB_MDCFE_B_H
#define _USB_DATAFAB_MDCFE_B_H
-extern int datafab_transport(Scsi_Cmnd *srb, struct us_data *us);
+extern int datafab_transport(struct scsi_cmnd *srb, struct us_data *us);
struct datafab_info {
unsigned long sectors; // total sector count
===== drivers/usb/storage/debug.c 1.15 vs edited =====
--- 1.15/drivers/usb/storage/debug.c Thu Jan 1 10:05:32 2004
+++ edited/drivers/usb/storage/debug.c Tue Jul 20 23:30:18 2004
@@ -44,9 +44,15 @@
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <linux/cdrom.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+
#include "debug.h"
+#include "scsi.h"
+
-void usb_stor_show_command(Scsi_Cmnd *srb)
+void usb_stor_show_command(struct scsi_cmnd *srb)
{
char *what = NULL;
int i;
===== drivers/usb/storage/debug.h 1.9 vs edited =====
--- 1.9/drivers/usb/storage/debug.h Thu Jan 1 10:05:32 2004
+++ edited/drivers/usb/storage/debug.h Tue Jul 20 23:30:19 2004
@@ -46,13 +46,13 @@
#include <linux/config.h>
#include <linux/kernel.h>
-#include <linux/cdrom.h>
-#include "usb.h"
+
+struct scsi_cmnd;
#define USB_STORAGE "usb-storage: "
#ifdef CONFIG_USB_STORAGE_DEBUG
-void usb_stor_show_command(Scsi_Cmnd *srb);
+void usb_stor_show_command(struct scsi_cmnd *srb);
void usb_stor_show_sense( unsigned char key,
unsigned char asc, unsigned char ascq );
#define US_DEBUGP(x...) printk( KERN_DEBUG USB_STORAGE x )
===== drivers/usb/storage/dpcm.c 1.4 vs edited =====
--- 1.4/drivers/usb/storage/dpcm.c Tue Apr 27 20:10:27 2004
+++ edited/drivers/usb/storage/dpcm.c Tue Jul 20 23:30:20 2004
@@ -30,6 +30,10 @@
*/
#include <linux/config.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>
+
#include "transport.h"
#include "protocol.h"
#include "usb.h"
@@ -41,7 +45,7 @@
* Transport for the Microtech DPCM-USB
*
*/
-int dpcm_transport(Scsi_Cmnd *srb, struct us_data *us)
+int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us)
{
int ret;
===== drivers/usb/storage/dpcm.h 1.1 vs edited =====
--- 1.1/drivers/usb/storage/dpcm.h Sat Nov 24 20:09:19 2001
+++ edited/drivers/usb/storage/dpcm.h Tue Jul 20 23:30:20 2004
@@ -29,6 +29,6 @@
#ifndef _MICROTECH_DPCM_USB_H
#define _MICROTECH_DPCM_USB_H
-extern int dpcm_transport(Scsi_Cmnd *srb, struct us_data *us);
+extern int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us);
#endif
===== drivers/usb/storage/freecom.c 1.38 vs edited =====
--- 1.38/drivers/usb/storage/freecom.c Tue Oct 7 00:20:45 2003
+++ edited/drivers/usb/storage/freecom.c Tue Jul 20 23:30:21 2004
@@ -29,12 +29,16 @@
*/
#include <linux/config.h>
+#include <linux/hdreg.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+
#include "transport.h"
#include "protocol.h"
#include "usb.h"
#include "debug.h"
#include "freecom.h"
-#include "linux/hdreg.h"
#ifdef CONFIG_USB_STORAGE_DEBUG
static void pdump (void *, int);
@@ -105,7 +109,7 @@
#define FCM_STATUS_PACKET_LENGTH 4
static int
-freecom_readdata (Scsi_Cmnd *srb, struct us_data *us,
+freecom_readdata (struct scsi_cmnd *srb, struct us_data *us,
unsigned int ipipe, unsigned int opipe, int count)
{
struct freecom_xfer_wrap *fxfr =
@@ -139,7 +143,7 @@
}
static int
-freecom_writedata (Scsi_Cmnd *srb, struct us_data *us,
+freecom_writedata (struct scsi_cmnd *srb, struct us_data *us,
int unsigned ipipe, unsigned int opipe, int count)
{
struct freecom_xfer_wrap *fxfr =
@@ -176,7 +180,7 @@
* Transport for the Freecom USB/IDE adaptor.
*
*/
-int freecom_transport(Scsi_Cmnd *srb, struct us_data *us)
+int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
{
struct freecom_cb_wrap *fcb;
struct freecom_status *fst;
@@ -302,7 +306,7 @@
* move in. */
switch (us->srb->sc_data_direction) {
- case SCSI_DATA_READ:
+ case DMA_FROM_DEVICE:
/* catch bogus "read 0 length" case */
if (!length)
break;
@@ -334,7 +338,7 @@
US_DEBUGP("Transfer happy\n");
break;
- case SCSI_DATA_WRITE:
+ case DMA_TO_DEVICE:
/* catch bogus "write 0 length" case */
if (!length)
break;
@@ -364,7 +368,7 @@
break;
- case SCSI_DATA_NONE:
+ case DMA_NONE:
/* Easy, do nothing. */
break;
===== drivers/usb/storage/freecom.h 1.1 vs edited =====
--- 1.1/drivers/usb/storage/freecom.h Sat Nov 24 20:09:20 2001
+++ edited/drivers/usb/storage/freecom.h Tue Jul 20 23:30:21 2004
@@ -29,7 +29,7 @@
#ifndef _FREECOM_USB_H
#define _FREECOM_USB_H
-extern int freecom_transport(Scsi_Cmnd *srb, struct us_data *us);
+extern int freecom_transport(struct scsi_cmnd *srb, struct us_data *us);
extern int usb_stor_freecom_reset(struct us_data *us);
extern int freecom_init (struct us_data *us);
===== drivers/usb/storage/isd200.c 1.51 vs edited =====
--- 1.51/drivers/usb/storage/isd200.c Sat Jun 5 00:22:46 2004
+++ edited/drivers/usb/storage/isd200.c Tue Jul 20 23:30:22 2004
@@ -44,6 +44,16 @@
/* Include files */
+#include <linux/jiffies.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+#include <linux/hdreg.h>
+#include <linux/ide.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>
+
#include "transport.h"
#include "protocol.h"
#include "usb.h"
@@ -51,11 +61,6 @@
#include "scsiglue.h"
#include "isd200.h"
-#include <linux/jiffies.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/hdreg.h>
-#include <linux/ide.h>
/* Timeout defines (in Seconds) */
@@ -349,7 +354,7 @@
* RETURNS:
* void
*/
-static void isd200_build_sense(struct us_data *us, Scsi_Cmnd *srb)
+static void isd200_build_sense(struct us_data *us, struct scsi_cmnd *srb)
{
struct isd200_info *info = (struct isd200_info *)us->extra;
struct sense_data *buf = (struct sense_data *) &srb->sense_buffer[0];
@@ -427,7 +432,7 @@
ata.generic.RegisterSelect =
REG_CYLINDER_LOW | REG_CYLINDER_HIGH |
REG_STATUS | REG_ERROR;
- srb->sc_data_direction = SCSI_DATA_READ;
+ srb->sc_data_direction = DMA_FROM_DEVICE;
srb->request_buffer = pointer;
srb->request_bufflen = value;
break;
@@ -439,7 +444,7 @@
ACTION_SELECT_5;
ata.generic.RegisterSelect = REG_DEVICE_HEAD;
ata.write.DeviceHeadByte = value;
- srb->sc_data_direction = SCSI_DATA_NONE;
+ srb->sc_data_direction = DMA_NONE;
break;
case ACTION_RESET:
@@ -448,7 +453,7 @@
ACTION_SELECT_3|ACTION_SELECT_4;
ata.generic.RegisterSelect = REG_DEVICE_CONTROL;
ata.write.DeviceControlByte = ATA_DC_RESET_CONTROLLER;
- srb->sc_data_direction = SCSI_DATA_NONE;
+ srb->sc_data_direction = DMA_NONE;
break;
case ACTION_REENABLE:
@@ -457,7 +462,7 @@
ACTION_SELECT_3|ACTION_SELECT_4;
ata.generic.RegisterSelect = REG_DEVICE_CONTROL;
ata.write.DeviceControlByte = ATA_DC_REENABLE_CONTROLLER;
- srb->sc_data_direction = SCSI_DATA_NONE;
+ srb->sc_data_direction = DMA_NONE;
break;
case ACTION_SOFT_RESET:
@@ -466,14 +471,14 @@
ata.generic.RegisterSelect = REG_DEVICE_HEAD | REG_COMMAND;
ata.write.DeviceHeadByte = info->DeviceHead;
ata.write.CommandByte = WIN_SRST;
- srb->sc_data_direction = SCSI_DATA_NONE;
+ srb->sc_data_direction = DMA_NONE;
break;
case ACTION_IDENTIFY:
US_DEBUGP(" isd200_action(IDENTIFY)\n");
ata.generic.RegisterSelect = REG_COMMAND;
ata.write.CommandByte = WIN_IDENTIFY;
- srb->sc_data_direction = SCSI_DATA_READ;
+ srb->sc_data_direction = DMA_FROM_DEVICE;
srb->request_buffer = (void *) info->id;
srb->request_bufflen = sizeof(struct hd_driveid);
break;
@@ -535,7 +540,7 @@
* the device and receive the response.
*/
static void isd200_invoke_transport( struct us_data *us,
- Scsi_Cmnd *srb,
+ struct scsi_cmnd *srb,
union ata_cdb *ataCdb )
{
int need_auto_sense = 0;
@@ -839,7 +844,7 @@
unsigned long endTime;
struct isd200_info *info = (struct isd200_info *)us->extra;
unsigned char *regs = info->RegsBuf;
- int recheckAsMaster = FALSE;
+ int recheckAsMaster = 0;
if ( detect )
endTime = jiffies + ISD200_ENUM_DETECT_TIMEOUT * HZ;
@@ -847,7 +852,7 @@
endTime = jiffies + ISD200_ENUM_BSY_TIMEOUT * HZ;
/* loop until we detect !BSY or timeout */
- while(TRUE) {
+ while(1) {
#ifdef CONFIG_USB_STORAGE_DEBUG
char* mstr = master_slave == ATA_ADDRESS_DEVHEAD_STD ?
"Master" : "Slave";
@@ -899,9 +904,9 @@
itself okay as a master also
*/
if ((master_slave & ATA_ADDRESS_DEVHEAD_SLAVE) &&
- (recheckAsMaster == FALSE)) {
+ !recheckAsMaster) {
US_DEBUGP(" Identified ATAPI device as slave.
Rechecking again as master\n");
- recheckAsMaster = TRUE;
+ recheckAsMaster = 1;
master_slave = ATA_ADDRESS_DEVHEAD_STD;
} else {
US_DEBUGP(" Identified ATAPI device\n");
@@ -948,15 +953,15 @@
if (retStatus == ISD200_GOOD) {
int isslave;
/* master or slave? */
- retStatus = isd200_try_enum( us, ATA_ADDRESS_DEVHEAD_STD, FALSE );
+ retStatus = isd200_try_enum( us, ATA_ADDRESS_DEVHEAD_STD, 0);
if (retStatus == ISD200_GOOD)
- retStatus = isd200_try_enum( us, ATA_ADDRESS_DEVHEAD_SLAVE,
FALSE );
+ retStatus = isd200_try_enum( us, ATA_ADDRESS_DEVHEAD_SLAVE, 0);
if (retStatus == ISD200_GOOD) {
retStatus = isd200_srst(us);
if (retStatus == ISD200_GOOD)
/* ata or atapi? */
- retStatus = isd200_try_enum( us,
ATA_ADDRESS_DEVHEAD_STD, TRUE );
+ retStatus = isd200_try_enum( us,
ATA_ADDRESS_DEVHEAD_STD, 1);
}
isslave = (info->DeviceHead & ATA_ADDRESS_DEVHEAD_SLAVE) ? 1 : 0;
@@ -1121,15 +1126,15 @@
* Translate SCSI commands to ATA commands.
*
* RETURNS:
- * TRUE if the command needs to be sent to the transport layer
- * FALSE otherwise
+ * 1 if the command needs to be sent to the transport layer
+ * 0 otherwise
*/
-static int isd200_scsi_to_ata(Scsi_Cmnd *srb, struct us_data *us,
+static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us,
union ata_cdb * ataCdb)
{
struct isd200_info *info = (struct isd200_info *)us->extra;
struct hd_driveid *id = info->id;
- int sendToTransport = TRUE;
+ int sendToTransport = 1;
unsigned char sectnum, head;
unsigned short cylinder;
unsigned long lba;
@@ -1147,7 +1152,7 @@
usb_stor_set_xfer_buf((unsigned char *) &info->InquiryData,
sizeof(info->InquiryData), srb);
srb->result = SAM_STAT_GOOD;
- sendToTransport = FALSE;
+ sendToTransport = 0;
break;
case MODE_SENSE:
@@ -1167,7 +1172,7 @@
} else {
US_DEBUGP(" Media Status not supported, just report okay\n");
srb->result = SAM_STAT_GOOD;
- sendToTransport = FALSE;
+ sendToTransport = 0;
}
break;
@@ -1185,7 +1190,7 @@
} else {
US_DEBUGP(" Media Status not supported, just report okay\n");
srb->result = SAM_STAT_GOOD;
- sendToTransport = FALSE;
+ sendToTransport = 0;
}
break;
@@ -1209,7 +1214,7 @@
usb_stor_set_xfer_buf((unsigned char *) &readCapacityData,
sizeof(readCapacityData), srb);
srb->result = SAM_STAT_GOOD;
- sendToTransport = FALSE;
+ sendToTransport = 0;
}
break;
@@ -1293,7 +1298,7 @@
} else {
US_DEBUGP(" Not removeable media, just report okay\n");
srb->result = SAM_STAT_GOOD;
- sendToTransport = FALSE;
+ sendToTransport = 0;
}
break;
@@ -1319,14 +1324,14 @@
} else {
US_DEBUGP(" Nothing to do, just report okay\n");
srb->result = SAM_STAT_GOOD;
- sendToTransport = FALSE;
+ sendToTransport = 0;
}
break;
default:
US_DEBUGP("Unsupported SCSI command - 0x%X\n", srb->cmnd[0]);
srb->result = DID_ERROR << 16;
- sendToTransport = FALSE;
+ sendToTransport = 0;
break;
}
@@ -1424,9 +1429,9 @@
*
*/
-void isd200_ata_command(Scsi_Cmnd *srb, struct us_data *us)
+void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us)
{
- int sendToTransport = TRUE;
+ int sendToTransport = 1;
union ata_cdb ataCdb;
/* Make sure driver was initialized */
===== drivers/usb/storage/isd200.h 1.1 vs edited =====
--- 1.1/drivers/usb/storage/isd200.h Sat Nov 24 20:09:20 2001
+++ edited/drivers/usb/storage/isd200.h Tue Jul 20 23:30:23 2004
@@ -25,7 +25,7 @@
#ifndef _USB_ISD200_H
#define _USB_ISD200_H
-extern void isd200_ata_command(Scsi_Cmnd *srb, struct us_data *us);
+extern void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us);
extern int isd200_Initialization(struct us_data *us);
#endif
===== drivers/usb/storage/jumpshot.c 1.37 vs edited =====
--- 1.37/drivers/usb/storage/jumpshot.c Sun Jun 27 23:05:04 2004
+++ edited/drivers/usb/storage/jumpshot.c Tue Jul 20 23:30:23 2004
@@ -47,15 +47,19 @@
* in that routine.
*/
+#include <linux/sched.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+
#include "transport.h"
#include "protocol.h"
#include "usb.h"
#include "debug.h"
#include "jumpshot.h"
-#include <linux/sched.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
static inline int jumpshot_bulk_read(struct us_data *us,
unsigned char *data,
@@ -319,7 +323,7 @@
}
static int jumpshot_handle_mode_sense(struct us_data *us,
- Scsi_Cmnd * srb,
+ struct scsi_cmnd * srb,
int sense_6)
{
static unsigned char rw_err_page[12] = {
@@ -426,7 +430,7 @@
// Transport for the Lexar 'Jumpshot'
//
-int jumpshot_transport(Scsi_Cmnd * srb, struct us_data *us)
+int jumpshot_transport(struct scsi_cmnd * srb, struct us_data *us)
{
struct jumpshot_info *info;
int rc;
@@ -551,12 +555,12 @@
if (srb->cmnd[0] == MODE_SENSE) {
US_DEBUGP("jumpshot_transport: MODE_SENSE_6 detected\n");
- return jumpshot_handle_mode_sense(us, srb, TRUE);
+ return jumpshot_handle_mode_sense(us, srb, 1);
}
if (srb->cmnd[0] == MODE_SENSE_10) {
US_DEBUGP("jumpshot_transport: MODE_SENSE_10 detected\n");
- return jumpshot_handle_mode_sense(us, srb, FALSE);
+ return jumpshot_handle_mode_sense(us, srb, 0);
}
if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) {
===== drivers/usb/storage/jumpshot.h 1.1 vs edited =====
--- 1.1/drivers/usb/storage/jumpshot.h Sat Nov 24 20:09:20 2001
+++ edited/drivers/usb/storage/jumpshot.h Tue Jul 20 23:30:24 2004
@@ -24,7 +24,7 @@
#ifndef _USB_JUMPSHOT_H
#define _USB_JUMPSHOT_H
-extern int jumpshot_transport(Scsi_Cmnd *srb, struct us_data *us);
+extern int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us);
struct jumpshot_info {
unsigned long sectors; // total sector count
===== drivers/usb/storage/protocol.c 1.23 vs edited =====
--- 1.23/drivers/usb/storage/protocol.c Thu Jan 1 10:05:33 2004
+++ edited/drivers/usb/storage/protocol.c Tue Jul 20 23:30:24 2004
@@ -45,6 +45,8 @@
*/
#include <linux/highmem.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
#include "protocol.h"
#include "usb.h"
#include "debug.h"
@@ -59,7 +61,7 @@
* Fix-up the return data from an INQUIRY command to show
* ANSI SCSI rev 2 so we don't confuse the SCSI layers above us
*/
-static void fix_inquiry_data(Scsi_Cmnd *srb)
+static void fix_inquiry_data(struct scsi_cmnd *srb)
{
unsigned char databuf[3];
unsigned int index, offset;
@@ -91,7 +93,7 @@
* Fix-up the return data from a READ CAPACITY command. My Feiya reader
* returns a value that is 1 too large.
*/
-static void fix_read_capacity(Scsi_Cmnd *srb)
+static void fix_read_capacity(struct scsi_cmnd *srb)
{
unsigned int index, offset;
u32 c;
@@ -120,11 +122,11 @@
* Protocol routines
***********************************************************************/
-void usb_stor_qic157_command(Scsi_Cmnd *srb, struct us_data *us)
+void usb_stor_qic157_command(struct scsi_cmnd *srb, struct us_data *us)
{
/* Pad the ATAPI command with zeros
*
- * NOTE: This only works because a Scsi_Cmnd struct field contains
+ * NOTE: This only works because a scsi_cmnd struct field contains
* a unsigned char cmnd[16], so we know we have storage available
*/
for (; srb->cmd_len<12; srb->cmd_len++)
@@ -141,11 +143,11 @@
}
}
-void usb_stor_ATAPI_command(Scsi_Cmnd *srb, struct us_data *us)
+void usb_stor_ATAPI_command(struct scsi_cmnd *srb, struct us_data *us)
{
/* Pad the ATAPI command with zeros
*
- * NOTE: This only works because a Scsi_Cmnd struct field contains
+ * NOTE: This only works because a scsi_cmnd struct field contains
* a unsigned char cmnd[16], so we know we have storage available
*/
@@ -166,12 +168,12 @@
}
-void usb_stor_ufi_command(Scsi_Cmnd *srb, struct us_data *us)
+void usb_stor_ufi_command(struct scsi_cmnd *srb, struct us_data *us)
{
/* fix some commands -- this is a form of mode translation
* UFI devices only accept 12 byte long commands
*
- * NOTE: This only works because a Scsi_Cmnd struct field contains
+ * NOTE: This only works because a scsi_cmnd struct field contains
* a unsigned char cmnd[16], so we know we have storage available
*/
@@ -213,7 +215,8 @@
}
}
-void usb_stor_transparent_scsi_command(Scsi_Cmnd *srb, struct us_data *us)
+void usb_stor_transparent_scsi_command(struct scsi_cmnd *srb,
+ struct us_data *us)
{
/* send the command to the transport layer */
usb_stor_invoke_transport(srb, us);
@@ -241,7 +244,7 @@
* pick up from where this one left off. */
unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
- unsigned int buflen, Scsi_Cmnd *srb, unsigned int *index,
+ unsigned int buflen, struct scsi_cmnd *srb, unsigned int *index,
unsigned int *offset, enum xfer_buf_dir dir)
{
unsigned int cnt;
@@ -327,7 +330,7 @@
/* Store the contents of buffer into srb's transfer buffer and set the
* SCSI residue. */
void usb_stor_set_xfer_buf(unsigned char *buffer,
- unsigned int buflen, Scsi_Cmnd *srb)
+ unsigned int buflen, struct scsi_cmnd *srb)
{
unsigned int index = 0, offset = 0;
===== drivers/usb/storage/protocol.h 1.11 vs edited =====
--- 1.11/drivers/usb/storage/protocol.h Thu Jan 1 10:05:33 2004
+++ edited/drivers/usb/storage/protocol.h Tue Jul 20 23:30:25 2004
@@ -41,9 +41,8 @@
#ifndef _PROTOCOL_H_
#define _PROTOCOL_H_
-#include <linux/blkdev.h>
-#include "scsi.h"
-#include "usb.h"
+struct scsi_cmnd;
+struct us_data;
/* Sub Classes */
@@ -60,18 +59,19 @@
#define US_SC_DEVICE 0xff /* Use device's value */
/* Protocol handling routines */
-extern void usb_stor_ATAPI_command(Scsi_Cmnd*, struct us_data*);
-extern void usb_stor_qic157_command(Scsi_Cmnd*, struct us_data*);
-extern void usb_stor_ufi_command(Scsi_Cmnd*, struct us_data*);
-extern void usb_stor_transparent_scsi_command(Scsi_Cmnd*, struct us_data*);
+extern void usb_stor_ATAPI_command(struct scsi_cmnd*, struct us_data*);
+extern void usb_stor_qic157_command(struct scsi_cmnd*, struct us_data*);
+extern void usb_stor_ufi_command(struct scsi_cmnd*, struct us_data*);
+extern void usb_stor_transparent_scsi_command(struct scsi_cmnd*,
+ struct us_data*);
-/* Scsi_Cmnd transfer buffer access utilities */
+/* struct scsi_cmnd transfer buffer access utilities */
enum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF};
extern unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
- unsigned int buflen, Scsi_Cmnd *srb, unsigned int *index,
+ unsigned int buflen, struct 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);
+ unsigned int buflen, struct scsi_cmnd *srb);
#endif
===== drivers/usb/storage/scsiglue.c 1.83 vs edited =====
--- 1.83/drivers/usb/storage/scsiglue.c Tue Jul 20 23:18:17 2004
+++ edited/drivers/usb/storage/scsiglue.c Tue Jul 20 23:30:25 2004
@@ -44,17 +44,23 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "scsiglue.h"
-#include "usb.h"
-#include "debug.h"
-#include "transport.h"
-#include "protocol.h"
#include <linux/slab.h>
#include <linux/module.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_devinfo.h>
+#include <scsi/scsi_device.h>
+#include <scsi/scsi_eh.h>
#include <scsi/scsi_host.h>
+#include "scsiglue.h"
+#include "usb.h"
+#include "debug.h"
+#include "transport.h"
+#include "protocol.h"
+
/***********************************************************************
* Host functions
***********************************************************************/
@@ -146,7 +152,8 @@
/* queue a command */
/* This is always called with scsi_lock(srb->host) held */
-static int queuecommand( Scsi_Cmnd *srb , void (*done)(Scsi_Cmnd *))
+static int queuecommand(struct scsi_cmnd *srb,
+ void (*done)(struct scsi_cmnd *))
{
struct us_data *us = (struct us_data *)srb->device->host->hostdata[0];
@@ -176,7 +183,7 @@
/* Command abort */
/* This is always called with scsi_lock(srb->host) held */
-static int command_abort( Scsi_Cmnd *srb )
+static int command_abort(struct scsi_cmnd *srb )
{
struct Scsi_Host *host = srb->device->host;
struct us_data *us = (struct us_data *) host->hostdata[0];
@@ -223,7 +230,7 @@
/* This invokes the transport reset mechanism to reset the state of the
* device */
/* This is always called with scsi_lock(srb->host) held */
-static int device_reset( Scsi_Cmnd *srb )
+static int device_reset(struct scsi_cmnd *srb)
{
struct us_data *us = (struct us_data *)srb->device->host->hostdata[0];
int result;
@@ -258,7 +265,7 @@
/* It refuses to work if there's more than one interface in
* the device, so that other users are not affected. */
/* This is always called with scsi_lock(srb->host) held */
-static int bus_reset( Scsi_Cmnd *srb )
+static int bus_reset(struct scsi_cmnd *srb)
{
struct us_data *us = (struct us_data *)srb->device->host->hostdata[0];
int result;
@@ -444,10 +451,10 @@
* periodically someone should test to see which setting is more
* optimal.
*/
- .use_clustering = TRUE,
+ .use_clustering = 1,
/* emulated HBA */
- .emulated = TRUE,
+ .emulated = 1,
/* we do our own delay after a device or bus reset */
.skip_settle_delay = 1,
===== drivers/usb/storage/scsiglue.h 1.10 vs edited =====
--- 1.10/drivers/usb/storage/scsiglue.h Sun May 23 13:01:59 2004
+++ edited/drivers/usb/storage/scsiglue.h Tue Jul 20 23:30:26 2004
@@ -41,17 +41,15 @@
#ifndef _SCSIGLUE_H_
#define _SCSIGLUE_H_
-#include <linux/blkdev.h>
-#include "scsi.h"
#include <scsi/scsi_host.h>
-#include "usb.h"
+
+struct us_data;
+struct scsi_cmnd;
extern void usb_stor_report_device_reset(struct us_data *us);
extern unsigned char usb_stor_sense_notready[18];
extern unsigned char usb_stor_sense_invalidCDB[18];
extern struct scsi_host_template usb_stor_host_template;
-extern int usb_stor_scsiSense10to6(Scsi_Cmnd*);
-extern int usb_stor_scsiSense6to10(Scsi_Cmnd*);
#endif
===== drivers/usb/storage/sddr09.c 1.49 vs edited =====
--- 1.49/drivers/usb/storage/sddr09.c Tue Jul 20 23:18:17 2004
+++ edited/drivers/usb/storage/sddr09.c Tue Jul 20 23:30:33 2004
@@ -41,16 +41,19 @@
* EF: compute checksum (?)
*/
+#include <linux/sched.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+
#include "transport.h"
#include "protocol.h"
#include "usb.h"
#include "debug.h"
#include "sddr09.h"
-#include <linux/version.h>
-#include <linux/sched.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) )
#define LSB_of(s) ((s)&0xFF)
@@ -1401,7 +1404,7 @@
/*
* Transport for the Sandisk SDDR-09
*/
-int sddr09_transport(Scsi_Cmnd *srb, struct us_data *us)
+int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us)
{
static unsigned char sensekey = 0, sensecode = 0;
static unsigned char havefakesense = 0;
@@ -1581,13 +1584,13 @@
if (srb->request_bufflen == 0)
return USB_STOR_TRANSPORT_GOOD;
- if (srb->sc_data_direction == SCSI_DATA_WRITE ||
- srb->sc_data_direction == SCSI_DATA_READ) {
- unsigned int pipe = (srb->sc_data_direction == SCSI_DATA_WRITE)
+ if (srb->sc_data_direction == DMA_TO_DEVICE ||
+ srb->sc_data_direction == DMA_FROM_DEVICE) {
+ unsigned int pipe = (srb->sc_data_direction == DMA_TO_DEVICE)
? us->send_bulk_pipe : us->recv_bulk_pipe;
US_DEBUGP("SDDR09: %s %d bytes\n",
- (srb->sc_data_direction == SCSI_DATA_WRITE) ?
+ (srb->sc_data_direction == DMA_TO_DEVICE) ?
"sending" : "receiving",
srb->request_bufflen);
===== drivers/usb/storage/sddr55.c 1.22 vs edited =====
--- 1.22/drivers/usb/storage/sddr55.c Fri Feb 6 01:27:12 2004
+++ edited/drivers/usb/storage/sddr55.c Tue Jul 20 23:30:33 2004
@@ -24,15 +24,19 @@
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <linux/jiffies.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+
#include "transport.h"
#include "protocol.h"
#include "usb.h"
#include "debug.h"
#include "sddr55.h"
-#include <linux/jiffies.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) )
#define LSB_of(s) ((s)&0xFF)
@@ -74,7 +78,7 @@
sddr55_bulk_transport(struct us_data *us, int direction,
unsigned char *data, unsigned int len) {
struct sddr55_card_info *info = (struct sddr55_card_info *)us->extra;
- unsigned int pipe = (direction == SCSI_DATA_READ) ?
+ unsigned int pipe = (direction == DMA_FROM_DEVICE) ?
us->recv_bulk_pipe : us->send_bulk_pipe;
if (!len)
@@ -99,7 +103,7 @@
command[5] = 0xB0;
command[7] = 0x80;
result = sddr55_bulk_transport(us,
- SCSI_DATA_WRITE, command, 8);
+ DMA_TO_DEVICE, command, 8);
US_DEBUGP("Result for send_command in status %d\n",
result);
@@ -110,7 +114,7 @@
}
result = sddr55_bulk_transport(us,
- SCSI_DATA_READ, status, 4);
+ DMA_FROM_DEVICE, status, 4);
/* expect to get short transfer if no card fitted */
if (result == USB_STOR_XFER_SHORT || result == USB_STOR_XFER_STALLED) {
@@ -139,7 +143,7 @@
/* now read status */
result = sddr55_bulk_transport(us,
- SCSI_DATA_READ, status, 2);
+ DMA_FROM_DEVICE, status, 2);
if (result != USB_STOR_XFER_GOOD) {
set_sense_info (4, 0, 0); /* hardware error */
@@ -215,7 +219,7 @@
/* send command */
result = sddr55_bulk_transport(us,
- SCSI_DATA_WRITE, command, 8);
+ DMA_TO_DEVICE, command, 8);
US_DEBUGP("Result for send_command in read_data %d\n",
result);
@@ -227,7 +231,7 @@
/* read data */
result = sddr55_bulk_transport(us,
- SCSI_DATA_READ, buffer, len);
+ DMA_FROM_DEVICE, buffer, len);
if (result != USB_STOR_XFER_GOOD) {
result = USB_STOR_TRANSPORT_ERROR;
@@ -236,7 +240,7 @@
/* now read status */
result = sddr55_bulk_transport(us,
- SCSI_DATA_READ, status, 2);
+ DMA_FROM_DEVICE, status, 2);
if (result != USB_STOR_XFER_GOOD) {
result = USB_STOR_TRANSPORT_ERROR;
@@ -390,7 +394,7 @@
/* send command */
result = sddr55_bulk_transport(us,
- SCSI_DATA_WRITE, command, 8);
+ DMA_TO_DEVICE, command, 8);
if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Result for send_command in write_data %d\n",
@@ -404,7 +408,7 @@
/* send the data */
result = sddr55_bulk_transport(us,
- SCSI_DATA_WRITE, buffer, len);
+ DMA_TO_DEVICE, buffer, len);
if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Result for send_data in write_data %d\n",
@@ -417,7 +421,7 @@
}
/* now read status */
- result = sddr55_bulk_transport(us, SCSI_DATA_READ, status, 6);
+ result = sddr55_bulk_transport(us, DMA_FROM_DEVICE, status, 6);
if (result != USB_STOR_XFER_GOOD) {
US_DEBUGP("Result for get_status in write_data %d\n",
@@ -483,7 +487,7 @@
memset(command, 0, 8);
command[5] = 0xB0;
command[7] = 0x84;
- result = sddr55_bulk_transport(us, SCSI_DATA_WRITE, command, 8);
+ result = sddr55_bulk_transport(us, DMA_TO_DEVICE, command, 8);
US_DEBUGP("Result of send_control for device ID is %d\n",
result);
@@ -492,7 +496,7 @@
return USB_STOR_TRANSPORT_ERROR;
result = sddr55_bulk_transport(us,
- SCSI_DATA_READ, content, 4);
+ DMA_FROM_DEVICE, content, 4);
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;
@@ -502,7 +506,7 @@
if (content[0] != 0xff) {
result = sddr55_bulk_transport(us,
- SCSI_DATA_READ, content, 2);
+ DMA_FROM_DEVICE, content, 2);
}
return USB_STOR_TRANSPORT_GOOD;
@@ -624,21 +628,21 @@
command[6] = numblocks * 2 / 256;
command[7] = 0x8A;
- result = sddr55_bulk_transport(us, SCSI_DATA_WRITE, command, 8);
+ result = sddr55_bulk_transport(us, DMA_TO_DEVICE, command, 8);
if ( result != USB_STOR_XFER_GOOD) {
kfree (buffer);
return -1;
}
- result = sddr55_bulk_transport(us, SCSI_DATA_READ, buffer, numblocks * 2);
+ result = sddr55_bulk_transport(us, DMA_FROM_DEVICE, buffer, numblocks * 2);
if ( result != USB_STOR_XFER_GOOD) {
kfree (buffer);
return -1;
}
- result = sddr55_bulk_transport(us, SCSI_DATA_READ, command, 2);
+ result = sddr55_bulk_transport(us, DMA_FROM_DEVICE, command, 2);
if ( result != USB_STOR_XFER_GOOD) {
kfree (buffer);
@@ -734,7 +738,7 @@
/*
* Transport for the Sandisk SDDR-55
*/
-int sddr55_transport(Scsi_Cmnd *srb, struct us_data *us)
+int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
{
int result;
static unsigned char inquiry_response[8] = {
===== drivers/usb/storage/usb.c 1.127 vs edited =====
--- 1.127/drivers/usb/storage/usb.c Thu Jul 8 12:14:08 2004
+++ edited/drivers/usb/storage/usb.c Tue Jul 20 23:30:34 2004
@@ -50,6 +50,11 @@
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/errno.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>
+
#include "usb.h"
#include "scsiglue.h"
#include "transport.h"
@@ -322,7 +327,7 @@
/* reject the command if the direction indicator
* is UNKNOWN
*/
- if (us->srb->sc_data_direction == SCSI_DATA_UNKNOWN) {
+ if (us->srb->sc_data_direction == DMA_BIDIRECTIONAL) {
US_DEBUGP("UNKNOWN data direction\n");
us->srb->result = DID_ERROR << 16;
}
===== drivers/usb/storage/sddr09.h 1.3 vs edited =====
--- 1.3/drivers/usb/storage/sddr09.h Fri May 3 10:19:07 2002
+++ edited/drivers/usb/storage/sddr09.h Tue Jul 20 23:30:35 2004
@@ -29,7 +29,7 @@
/* Sandisk SDDR-09 stuff */
-extern int sddr09_transport(Scsi_Cmnd *srb, struct us_data *us);
+extern int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us);
struct sddr09_card_info {
unsigned long capacity; /* Size of card in bytes */
===== drivers/usb/storage/usb.h 1.61 vs edited =====
--- 1.61/drivers/usb/storage/usb.h Sun Jun 27 23:05:07 2004
+++ edited/drivers/usb/storage/usb.h Tue Jul 20 23:30:35 2004
@@ -48,10 +48,9 @@
#include <linux/blkdev.h>
#include <linux/smp_lock.h>
#include <linux/completion.h>
-#include "scsi.h"
-#include <scsi/scsi_host.h>
struct us_data;
+struct scsi_cmnd;
/*
* Unusual device list definitions
@@ -102,9 +101,9 @@
#define US_IOBUF_SIZE 64 /* Size of the DMA-mapped I/O buffer */
-typedef int (*trans_cmnd)(Scsi_Cmnd*, struct us_data*);
+typedef int (*trans_cmnd)(struct scsi_cmnd *, struct us_data*);
typedef int (*trans_reset)(struct us_data*);
-typedef void (*proto_cmnd)(Scsi_Cmnd*, struct us_data*);
+typedef void (*proto_cmnd)(struct scsi_cmnd*, struct us_data*);
typedef void (*extra_data_destructor)(void *); /* extra data destructor */
/* we allocate one of these for every device that we remember */
@@ -144,7 +143,7 @@
/* SCSI interfaces */
struct Scsi_Host *host; /* our dummy host data */
- Scsi_Cmnd *srb; /* current srb */
+ struct scsi_cmnd *srb; /* current srb */
/* thread information */
int pid; /* control thread */
===== drivers/usb/storage/sddr55.h 1.1 vs edited =====
--- 1.1/drivers/usb/storage/sddr55.h Sat May 18 22:51:24 2002
+++ edited/drivers/usb/storage/sddr55.h Tue Jul 20 23:30:36 2004
@@ -28,7 +28,7 @@
/* Sandisk SDDR-55 stuff */
-extern int sddr55_transport(Scsi_Cmnd *srb, struct us_data *us);
+extern int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us);
extern int sddr55_reset(struct us_data *us);
#endif
===== drivers/usb/storage/shuttle_usbat.c 1.34 vs edited =====
--- 1.34/drivers/usb/storage/shuttle_usbat.c Sun May 23 13:02:00 2004
+++ edited/drivers/usb/storage/shuttle_usbat.c Tue Jul 20 23:30:36 2004
@@ -39,16 +39,20 @@
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <linux/sched.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+#include <linux/cdrom.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+
#include "transport.h"
#include "protocol.h"
#include "usb.h"
#include "debug.h"
#include "shuttle_usbat.h"
-#include <linux/sched.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-
#define short_pack(LSB,MSB) ( ((u16)(LSB)) | ( ((u16)(MSB))<<8 ) )
#define LSB_of(s) ((s)&0xFF)
#define MSB_of(s) ((s)>>8)
@@ -275,7 +279,7 @@
int minutes)
{
int result;
- unsigned int pipe = (direction == SCSI_DATA_READ) ?
+ unsigned int pipe = (direction == DMA_FROM_DEVICE) ?
us->recv_bulk_pipe : us->send_bulk_pipe;
// Not really sure the 0x07, 0x17, 0xfc, 0xe7 is necessary here,
@@ -315,9 +319,9 @@
} else
cmdlen = 8;
- command[cmdlen-8] = (direction==SCSI_DATA_WRITE ? 0x40 : 0xC0);
+ command[cmdlen-8] = (direction==DMA_TO_DEVICE ? 0x40 : 0xC0);
command[cmdlen-7] = access |
- (direction==SCSI_DATA_WRITE ? 0x05 : 0x04);
+ (direction==DMA_TO_DEVICE ? 0x05 : 0x04);
command[cmdlen-6] = data_reg;
command[cmdlen-5] = status_reg;
command[cmdlen-4] = timeout;
@@ -355,7 +359,7 @@
//US_DEBUGP("Transfer %s %d bytes, sg buffers %d\n",
- // direction == SCSI_DATA_WRITE ? "out" : "in",
+ // direction == DMA_TO_DEVICE ? "out" : "in",
// len, use_sg);
result = usb_stor_bulk_transfer_sg(us,
@@ -388,7 +392,7 @@
* the bulk output pipe only the first time.
*/
- if (direction==SCSI_DATA_READ && i==0) {
+ if (direction==DMA_FROM_DEVICE && i==0) {
if (usb_stor_clear_halt(us,
us->send_bulk_pipe) < 0)
return USB_STOR_TRANSPORT_ERROR;
@@ -399,7 +403,7 @@
*/
result = usbat_read(us, USBAT_ATA,
- direction==SCSI_DATA_WRITE ? 0x17 : 0x0E,
+ direction==DMA_TO_DEVICE ? 0x17 : 0x0E,
status);
if (result!=USB_STOR_XFER_GOOD)
@@ -410,7 +414,7 @@
return USB_STOR_TRANSPORT_FAILED;
US_DEBUGP("Redoing %s\n",
- direction==SCSI_DATA_WRITE ? "write" : "read");
+ direction==DMA_TO_DEVICE ? "write" : "read");
} else if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;
@@ -420,7 +424,7 @@
}
US_DEBUGP("Bummer! %s bulk data 20 times failed.\n",
- direction==SCSI_DATA_WRITE ? "Writing" : "Reading");
+ direction==DMA_TO_DEVICE ? "Writing" : "Reading");
return USB_STOR_TRANSPORT_FAILED;
}
@@ -520,7 +524,7 @@
static int usbat_handle_read10(struct us_data *us,
unsigned char *registers,
unsigned char *data,
- Scsi_Cmnd *srb)
+ struct scsi_cmnd *srb)
{
int result = USB_STOR_TRANSPORT_GOOD;
unsigned char *buffer;
@@ -537,7 +541,7 @@
result = usbat_rw_block_test(us, USBAT_ATA,
registers, data, 19,
0x10, 0x17, 0xFD, 0x30,
- SCSI_DATA_READ,
+ DMA_FROM_DEVICE,
srb->request_buffer,
srb->request_bufflen, srb->use_sg, 1);
@@ -606,7 +610,7 @@
result = usbat_rw_block_test(us, USBAT_ATA,
registers, data, 19,
0x10, 0x17, 0xFD, 0x30,
- SCSI_DATA_READ,
+ DMA_FROM_DEVICE,
buffer,
len, 0, 1);
@@ -803,7 +807,7 @@
/*
* Transport for the HP 8200e
*/
-int hp8200e_transport(Scsi_Cmnd *srb, struct us_data *us)
+int hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)
{
int result;
unsigned char *status = us->iobuf;
@@ -847,12 +851,12 @@
if (srb->cmnd[0] == TEST_UNIT_READY)
transferred = 0;
- if (srb->sc_data_direction == SCSI_DATA_WRITE) {
+ if (srb->sc_data_direction == DMA_TO_DEVICE) {
result = usbat_rw_block_test(us, USBAT_ATA,
registers, data, 19,
0x10, 0x17, 0xFD, 0x30,
- SCSI_DATA_WRITE,
+ DMA_TO_DEVICE,
srb->request_buffer,
len, srb->use_sg, 10);
@@ -900,7 +904,7 @@
// If there is response data to be read in
// then do it here.
- if (len != 0 && (srb->sc_data_direction == SCSI_DATA_READ)) {
+ if (len != 0 && (srb->sc_data_direction == DMA_FROM_DEVICE)) {
// How many bytes to read in? Check cylL register
===== drivers/usb/storage/shuttle_usbat.h 1.3 vs edited =====
--- 1.3/drivers/usb/storage/shuttle_usbat.h Sat May 15 08:48:19 2004
+++ edited/drivers/usb/storage/shuttle_usbat.h Tue Jul 20 23:30:37 2004
@@ -53,7 +53,7 @@
#define USBAT_UIO_ADPRST 0x01 // Reset SCM chip
/* HP 8200e stuff */
-extern int hp8200e_transport(Scsi_Cmnd *srb, struct us_data *us);
+extern int hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us);
extern int init_8200e(struct us_data *us);
#endif
===== drivers/usb/storage/transport.c 1.144 vs edited =====
--- 1.144/drivers/usb/storage/transport.c Tue Jul 20 23:18:18 2004
+++ edited/drivers/usb/storage/transport.c Tue Jul 20 23:30:37 2004
@@ -46,15 +46,20 @@
*/
#include <linux/config.h>
+#include <linux/sched.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_device.h>
+
#include "transport.h"
#include "protocol.h"
#include "scsiglue.h"
#include "usb.h"
#include "debug.h"
-#include <linux/sched.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
/***********************************************************************
* Data transfer routines
@@ -522,7 +527,7 @@
* This is used by the protocol layers to actually send the message to
* the device and receive the response.
*/
-void usb_stor_invoke_transport(Scsi_Cmnd *srb, struct us_data *us)
+void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
{
int need_auto_sense;
int result;
@@ -569,7 +574,7 @@
* can signal most data-in errors by stalling the bulk-in pipe.
*/
if ((us->protocol == US_PR_CB || us->protocol == US_PR_DPCM_USB) &&
- srb->sc_data_direction != SCSI_DATA_READ) {
+ srb->sc_data_direction != DMA_FROM_DEVICE) {
US_DEBUGP("-- CB transport device requiring auto-sense\n");
need_auto_sense = 1;
}
@@ -629,7 +634,7 @@
/* set the transfer direction */
old_sc_data_direction = srb->sc_data_direction;
- srb->sc_data_direction = SCSI_DATA_READ;
+ srb->sc_data_direction = DMA_FROM_DEVICE;
/* use the new buffer we have */
old_request_buffer = srb->request_buffer;
@@ -749,7 +754,7 @@
* Control/Bulk/Interrupt transport
*/
-int usb_stor_CBI_transport(Scsi_Cmnd *srb, struct us_data *us)
+int usb_stor_CBI_transport(struct scsi_cmnd *srb, struct us_data *us)
{
unsigned int transfer_length = srb->request_bufflen;
unsigned int pipe = 0;
@@ -778,7 +783,7 @@
/* DATA STAGE */
/* transfer the data payload for this command, if one exists*/
if (transfer_length) {
- pipe = srb->sc_data_direction == SCSI_DATA_READ ?
+ pipe = srb->sc_data_direction == DMA_FROM_DEVICE ?
us->recv_bulk_pipe : us->send_bulk_pipe;
result = usb_stor_bulk_transfer_sg(us, pipe,
srb->request_buffer, transfer_length,
@@ -849,7 +854,7 @@
/*
* Control/Bulk transport
*/
-int usb_stor_CB_transport(Scsi_Cmnd *srb, struct us_data *us)
+int usb_stor_CB_transport(struct scsi_cmnd *srb, struct us_data *us)
{
unsigned int transfer_length = srb->request_bufflen;
int result;
@@ -877,7 +882,7 @@
/* DATA STAGE */
/* transfer the data payload for this command, if one exists*/
if (transfer_length) {
- unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ?
+ unsigned int pipe = srb->sc_data_direction == DMA_FROM_DEVICE ?
us->recv_bulk_pipe : us->send_bulk_pipe;
result = usb_stor_bulk_transfer_sg(us, pipe,
srb->request_buffer, transfer_length,
@@ -939,7 +944,7 @@
return -1;
}
-int usb_stor_Bulk_transport(Scsi_Cmnd *srb, struct us_data *us)
+int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
{
struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap *) us->iobuf;
@@ -952,7 +957,7 @@
/* set up the command wrapper */
bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
bcb->DataTransferLength = cpu_to_le32(transfer_length);
- bcb->Flags = srb->sc_data_direction == SCSI_DATA_READ ? 1 << 7 : 0;
+ bcb->Flags = srb->sc_data_direction == DMA_FROM_DEVICE ? 1 << 7 : 0;
bcb->Tag = srb->serial_number;
bcb->Lun = srb->device->lun;
if (us->flags & US_FL_SCM_MULT_TARG)
@@ -978,7 +983,7 @@
/* DATA STAGE */
/* send/receive data payload, if there is any */
if (transfer_length) {
- unsigned int pipe = srb->sc_data_direction == SCSI_DATA_READ ?
+ unsigned int pipe = srb->sc_data_direction == DMA_FROM_DEVICE ?
us->recv_bulk_pipe : us->send_bulk_pipe;
result = usb_stor_bulk_transfer_sg(us, pipe,
srb->request_buffer, transfer_length,
===== drivers/usb/storage/transport.h 1.41 vs edited =====
--- 1.41/drivers/usb/storage/transport.h Mon Jul 28 11:29:05 2003
+++ edited/drivers/usb/storage/transport.h Tue Jul 20 23:30:38 2004
@@ -44,7 +44,8 @@
#include <linux/config.h>
#include <linux/blkdev.h>
#include "usb.h"
-#include "scsi.h"
+
+struct scsi_cmnd;
/* Protocols */
@@ -150,16 +151,16 @@
#define US_CBI_ADSC 0
-extern int usb_stor_CBI_transport(Scsi_Cmnd*, struct us_data*);
+extern int usb_stor_CBI_transport(struct scsi_cmnd *, struct us_data*);
-extern int usb_stor_CB_transport(Scsi_Cmnd*, struct us_data*);
+extern int usb_stor_CB_transport(struct scsi_cmnd *, struct us_data*);
extern int usb_stor_CB_reset(struct us_data*);
-extern int usb_stor_Bulk_transport(Scsi_Cmnd*, struct us_data*);
+extern int usb_stor_Bulk_transport(struct scsi_cmnd *, struct us_data*);
extern int usb_stor_Bulk_max_lun(struct us_data*);
extern int usb_stor_Bulk_reset(struct us_data*);
-extern void usb_stor_invoke_transport(Scsi_Cmnd*, struct us_data*);
+extern void usb_stor_invoke_transport(struct scsi_cmnd *, struct us_data*);
extern void usb_stor_stop_transport(struct us_data*);
extern int usb_stor_control_msg(struct us_data *us, unsigned int pipe,
--
Matthew Dharm Home: [EMAIL PROTECTED]
Maintainer, Linux USB Mass Storage Driver
Sir, for the hundreth time, we do NOT carry 600-round boxes of belt-fed
suction darts!
-- Salesperson to Greg
User Friendly, 12/30/1997
pgpUmLHyF5VlV.pgp
Description: PGP signature
