Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28320
b: refs/heads/master
c: 141804d
h: refs/heads/master
v: v3
  • Loading branch information
Peter Chubb authored and Greg Kroah-Hartman committed Jun 21, 2006
1 parent 83f860c commit 0acfee3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 69165c29bb4db9bafead7c6574c73ce245965f3a
refs/heads/master: 141804d401631f0384feabfa5fc3e2ce1321c0f0
54 changes: 30 additions & 24 deletions trunk/drivers/usb/storage/shuttle_usbat.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,28 +131,30 @@ static int usbat_write(struct us_data *us,
* Convenience function to perform a bulk read
*/
static int usbat_bulk_read(struct us_data *us,
unsigned char *data,
unsigned int len)
unsigned char *data,
unsigned int len,
int use_sg)
{
if (len == 0)
return USB_STOR_XFER_GOOD;

US_DEBUGP("usbat_bulk_read: len = %d\n", len);
return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, data, len, NULL);
return usb_stor_bulk_transfer_sg(us, us->recv_bulk_pipe, data, len, use_sg, NULL);
}

/*
* Convenience function to perform a bulk write
*/
static int usbat_bulk_write(struct us_data *us,
unsigned char *data,
unsigned int len)
unsigned char *data,
unsigned int len,
int use_sg)
{
if (len == 0)
return USB_STOR_XFER_GOOD;

US_DEBUGP("usbat_bulk_write: len = %d\n", len);
return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, data, len, NULL);
return usb_stor_bulk_transfer_sg(us, us->send_bulk_pipe, data, len, use_sg, NULL);
}

/*
Expand Down Expand Up @@ -317,7 +319,8 @@ static int usbat_wait_not_busy(struct us_data *us, int minutes)
*/
static int usbat_read_block(struct us_data *us,
unsigned char *content,
unsigned short len)
unsigned short len,
int use_sg)
{
int result;
unsigned char *command = us->iobuf;
Expand All @@ -338,7 +341,7 @@ static int usbat_read_block(struct us_data *us,
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;

result = usbat_bulk_read(us, content, len);
result = usbat_bulk_read(us, content, len, use_sg);
return (result == USB_STOR_XFER_GOOD ?
USB_STOR_TRANSPORT_GOOD : USB_STOR_TRANSPORT_ERROR);
}
Expand All @@ -350,7 +353,8 @@ static int usbat_write_block(struct us_data *us,
unsigned char access,
unsigned char *content,
unsigned short len,
int minutes)
int minutes,
int use_sg)
{
int result;
unsigned char *command = us->iobuf;
Expand All @@ -372,7 +376,7 @@ static int usbat_write_block(struct us_data *us,
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;

result = usbat_bulk_write(us, content, len);
result = usbat_bulk_write(us, content, len, use_sg);
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;

Expand Down Expand Up @@ -465,7 +469,7 @@ static int usbat_hp8200e_rw_block_test(struct us_data *us,
data[1+(j<<1)] = data_out[j];
}

result = usbat_bulk_write(us, data, num_registers*2);
result = usbat_bulk_write(us, data, num_registers*2, 0);
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;

Expand Down Expand Up @@ -583,7 +587,7 @@ static int usbat_multiple_write(struct us_data *us,
}

/* Send the data */
result = usbat_bulk_write(us, data, num_registers*2);
result = usbat_bulk_write(us, data, num_registers*2, 0);
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;

Expand All @@ -606,8 +610,9 @@ static int usbat_multiple_write(struct us_data *us,
* other related details) are defined beforehand with _set_shuttle_features().
*/
static int usbat_read_blocks(struct us_data *us,
unsigned char *buffer,
int len)
unsigned char *buffer,
int len,
int use_sg)
{
int result;
unsigned char *command = us->iobuf;
Expand All @@ -627,7 +632,7 @@ static int usbat_read_blocks(struct us_data *us,
return USB_STOR_TRANSPORT_FAILED;

/* Read the blocks we just asked for */
result = usbat_bulk_read(us, buffer, len);
result = usbat_bulk_read(us, buffer, len, use_sg);
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_FAILED;

Expand All @@ -648,7 +653,8 @@ static int usbat_read_blocks(struct us_data *us,
*/
static int usbat_write_blocks(struct us_data *us,
unsigned char *buffer,
int len)
int len,
int use_sg)
{
int result;
unsigned char *command = us->iobuf;
Expand All @@ -668,7 +674,7 @@ static int usbat_write_blocks(struct us_data *us,
return USB_STOR_TRANSPORT_FAILED;

/* Write the data */
result = usbat_bulk_write(us, buffer, len);
result = usbat_bulk_write(us, buffer, len, use_sg);
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_FAILED;

Expand Down Expand Up @@ -947,7 +953,7 @@ static int usbat_flash_get_sector_count(struct us_data *us,
msleep(100);

/* Read the device identification data */
rc = usbat_read_block(us, reply, 512);
rc = usbat_read_block(us, reply, 512, 0);
if (rc != USB_STOR_TRANSPORT_GOOD)
goto leave;

Expand Down Expand Up @@ -1031,7 +1037,7 @@ static int usbat_flash_read_data(struct us_data *us,
goto leave;

/* Read the data we just requested */
result = usbat_read_blocks(us, buffer, len);
result = usbat_read_blocks(us, buffer, len, 0);
if (result != USB_STOR_TRANSPORT_GOOD)
goto leave;

Expand Down Expand Up @@ -1125,7 +1131,7 @@ static int usbat_flash_write_data(struct us_data *us,
goto leave;

/* Write the data */
result = usbat_write_blocks(us, buffer, len);
result = usbat_write_blocks(us, buffer, len, 0);
if (result != USB_STOR_TRANSPORT_GOOD)
goto leave;

Expand Down Expand Up @@ -1503,10 +1509,10 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)
* AT SPEED 4 IS UNRELIABLE!!!
*/

if ( (result = usbat_write_block(us,
if ((result = usbat_write_block(us,
USBAT_ATA, srb->cmnd, 12,
srb->cmnd[0]==GPCMD_BLANK ? 75 : 10)) !=
USB_STOR_TRANSPORT_GOOD) {
(srb->cmnd[0]==GPCMD_BLANK ? 75 : 10), 0) !=
USB_STOR_TRANSPORT_GOOD)) {
return result;
}

Expand All @@ -1533,7 +1539,7 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)
len = *status;


result = usbat_read_block(us, srb->request_buffer, len);
result = usbat_read_block(us, srb->request_buffer, len, srb->use_sg);

/* Debug-print the first 32 bytes of the transfer */

Expand Down

0 comments on commit 0acfee3

Please sign in to comment.