提交 41c2497b 编写于 作者: B Boaz Harrosh 提交者: James Bottomley

[SCSI] usb: freecom & sddr09 - convert to accessors and !use_sg cleanup

 - Use scsi data accessors and remove of !use_sg code path
 - This patch is dependent on cleanup patch to usb transport.c/h
Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
Acked-by: NMatthew Dharm <mdharm-scsi@one-eyed-alien.net>
Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
上级 dd829d23
...@@ -132,8 +132,7 @@ freecom_readdata (struct scsi_cmnd *srb, struct us_data *us, ...@@ -132,8 +132,7 @@ freecom_readdata (struct scsi_cmnd *srb, struct us_data *us,
/* Now transfer all of our blocks. */ /* Now transfer all of our blocks. */
US_DEBUGP("Start of read\n"); US_DEBUGP("Start of read\n");
result = usb_stor_bulk_transfer_sg(us, ipipe, srb->request_buffer, result = usb_stor_bulk_srb(us, ipipe, srb);
count, srb->use_sg, &srb->resid);
US_DEBUGP("freecom_readdata done!\n"); US_DEBUGP("freecom_readdata done!\n");
if (result > USB_STOR_XFER_SHORT) if (result > USB_STOR_XFER_SHORT)
...@@ -166,8 +165,7 @@ freecom_writedata (struct scsi_cmnd *srb, struct us_data *us, ...@@ -166,8 +165,7 @@ freecom_writedata (struct scsi_cmnd *srb, struct us_data *us,
/* Now transfer all of our blocks. */ /* Now transfer all of our blocks. */
US_DEBUGP("Start of write\n"); US_DEBUGP("Start of write\n");
result = usb_stor_bulk_transfer_sg(us, opipe, srb->request_buffer, result = usb_stor_bulk_srb(us, opipe, srb);
count, srb->use_sg, &srb->resid);
US_DEBUGP("freecom_writedata done!\n"); US_DEBUGP("freecom_writedata done!\n");
if (result > USB_STOR_XFER_SHORT) if (result > USB_STOR_XFER_SHORT)
...@@ -281,7 +279,7 @@ int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -281,7 +279,7 @@ int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
* and such will hang. */ * and such will hang. */
US_DEBUGP("Device indicates that it has %d bytes available\n", US_DEBUGP("Device indicates that it has %d bytes available\n",
le16_to_cpu (fst->Count)); le16_to_cpu (fst->Count));
US_DEBUGP("SCSI requested %d\n", srb->request_bufflen); US_DEBUGP("SCSI requested %d\n", scsi_bufflen(srb));
/* Find the length we desire to read. */ /* Find the length we desire to read. */
switch (srb->cmnd[0]) { switch (srb->cmnd[0]) {
...@@ -292,12 +290,12 @@ int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -292,12 +290,12 @@ int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
length = le16_to_cpu(fst->Count); length = le16_to_cpu(fst->Count);
break; break;
default: default:
length = srb->request_bufflen; length = scsi_bufflen(srb);
} }
/* verify that this amount is legal */ /* verify that this amount is legal */
if (length > srb->request_bufflen) { if (length > scsi_bufflen(srb)) {
length = srb->request_bufflen; length = scsi_bufflen(srb);
US_DEBUGP("Truncating request to match buffer length: %d\n", length); US_DEBUGP("Truncating request to match buffer length: %d\n", length);
} }
......
...@@ -1623,7 +1623,7 @@ int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -1623,7 +1623,7 @@ int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
} }
if (srb->request_bufflen == 0) if (scsi_bufflen(srb) == 0)
return USB_STOR_TRANSPORT_GOOD; return USB_STOR_TRANSPORT_GOOD;
if (srb->sc_data_direction == DMA_TO_DEVICE || if (srb->sc_data_direction == DMA_TO_DEVICE ||
...@@ -1634,12 +1634,9 @@ int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -1634,12 +1634,9 @@ int sddr09_transport(struct scsi_cmnd *srb, struct us_data *us)
US_DEBUGP("SDDR09: %s %d bytes\n", US_DEBUGP("SDDR09: %s %d bytes\n",
(srb->sc_data_direction == DMA_TO_DEVICE) ? (srb->sc_data_direction == DMA_TO_DEVICE) ?
"sending" : "receiving", "sending" : "receiving",
srb->request_bufflen); scsi_bufflen(srb));
result = usb_stor_bulk_transfer_sg(us, pipe, result = usb_stor_bulk_srb(us, pipe, srb);
srb->request_buffer,
srb->request_bufflen,
srb->use_sg, &srb->resid);
return (result == USB_STOR_XFER_GOOD ? return (result == USB_STOR_XFER_GOOD ?
USB_STOR_TRANSPORT_GOOD : USB_STOR_TRANSPORT_ERROR); USB_STOR_TRANSPORT_GOOD : USB_STOR_TRANSPORT_ERROR);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册