From: Boaz Harrosh <bharrosh@panasas.com>
To: James Bottomley <James.Bottomley@SteelEye.com>,
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
Greg Kroah-Hartman <gregkh@suse.de>,
Alan Stern <stern@rowland.harvard.edu>,
Matthew
Subject: [PATCH 03/24] usb: shuttle_usbat.c - convert to accessors and !use_sg code path removal
Date: Wed, 12 Sep 2007 02:51:03 +0300 [thread overview]
Message-ID: <46E729E7.9030504@panasas.com> (raw)
In-Reply-To: <46E6F92D.2090409@panasas.com>
- functions that received char* but where passed scatterlist* mostly
were changed to receive void*
- Use scsi data accessors and remove of !use_sg code path
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
drivers/usb/storage/shuttle_usbat.c | 68 +++++++++++++---------------------
1 files changed, 26 insertions(+), 42 deletions(-)
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
index 5e27297..1cc1fcf 100644
--- a/drivers/usb/storage/shuttle_usbat.c
+++ b/drivers/usb/storage/shuttle_usbat.c
@@ -130,7 +130,7 @@ 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,
+ void* buf,
unsigned int len,
int use_sg)
{
@@ -138,14 +138,14 @@ static int usbat_bulk_read(struct us_data *us,
return USB_STOR_XFER_GOOD;
US_DEBUGP("usbat_bulk_read: len = %d\n", len);
- return usb_stor_bulk_transfer_sg(us, us->recv_bulk_pipe, data, len, use_sg, NULL);
+ return usb_stor_bulk_transfer_sg(us, us->recv_bulk_pipe, buf, len, use_sg, NULL);
}
/*
* Convenience function to perform a bulk write
*/
static int usbat_bulk_write(struct us_data *us,
- unsigned char *data,
+ void* buf,
unsigned int len,
int use_sg)
{
@@ -153,7 +153,7 @@ static int usbat_bulk_write(struct us_data *us,
return USB_STOR_XFER_GOOD;
US_DEBUGP("usbat_bulk_write: len = %d\n", len);
- return usb_stor_bulk_transfer_sg(us, us->send_bulk_pipe, data, len, use_sg, NULL);
+ return usb_stor_bulk_transfer_sg(us, us->send_bulk_pipe, buf, len, use_sg, NULL);
}
/*
@@ -317,7 +317,7 @@ static int usbat_wait_not_busy(struct us_data *us, int minutes)
* Read block data from the data register
*/
static int usbat_read_block(struct us_data *us,
- unsigned char *content,
+ void* buf,
unsigned short len,
int use_sg)
{
@@ -340,7 +340,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, use_sg);
+ result = usbat_bulk_read(us, buf, len, use_sg);
return (result == USB_STOR_XFER_GOOD ?
USB_STOR_TRANSPORT_GOOD : USB_STOR_TRANSPORT_ERROR);
}
@@ -350,7 +350,7 @@ static int usbat_read_block(struct us_data *us,
*/
static int usbat_write_block(struct us_data *us,
unsigned char access,
- unsigned char *content,
+ void* buf,
unsigned short len,
int minutes,
int use_sg)
@@ -375,7 +375,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, use_sg);
+ result = usbat_bulk_write(us, buf, len, use_sg);
if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR;
@@ -395,7 +395,7 @@ static int usbat_hp8200e_rw_block_test(struct us_data *us,
unsigned char timeout,
unsigned char qualifier,
int direction,
- unsigned char *content,
+ void *buf,
unsigned short len,
int use_sg,
int minutes)
@@ -475,7 +475,7 @@ static int usbat_hp8200e_rw_block_test(struct us_data *us,
}
result = usb_stor_bulk_transfer_sg(us,
- pipe, content, len, use_sg, NULL);
+ pipe, buf, len, use_sg, NULL);
/*
* If we get a stall on the bulk download, we'll retry
@@ -609,7 +609,7 @@ 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,
+ void* buffer,
int len,
int use_sg)
{
@@ -651,7 +651,7 @@ static int usbat_read_blocks(struct us_data *us,
* other related details) are defined beforehand with _set_shuttle_features().
*/
static int usbat_write_blocks(struct us_data *us,
- unsigned char *buffer,
+ void* buffer,
int len,
int use_sg)
{
@@ -1171,15 +1171,15 @@ static int usbat_hp8200e_handle_read10(struct us_data *us,
US_DEBUGP("handle_read10: transfersize %d\n",
srb->transfersize);
- if (srb->request_bufflen < 0x10000) {
+ if (scsi_bufflen(srb) < 0x10000) {
result = usbat_hp8200e_rw_block_test(us, USBAT_ATA,
registers, data, 19,
USBAT_ATA_DATA, USBAT_ATA_STATUS, 0xFD,
(USBAT_QUAL_FCQ | USBAT_QUAL_ALQ),
DMA_FROM_DEVICE,
- srb->request_buffer,
- srb->request_bufflen, srb->use_sg, 1);
+ scsi_sglist(srb),
+ scsi_bufflen(srb), scsi_sg_count(srb), 1);
return result;
}
@@ -1197,7 +1197,7 @@ static int usbat_hp8200e_handle_read10(struct us_data *us,
len <<= 16;
len |= data[7+7];
US_DEBUGP("handle_read10: GPCMD_READ_CD: len %d\n", len);
- srb->transfersize = srb->request_bufflen/len;
+ srb->transfersize = scsi_bufflen(srb)/len;
}
if (!srb->transfersize) {
@@ -1214,7 +1214,7 @@ static int usbat_hp8200e_handle_read10(struct us_data *us,
len = (65535/srb->transfersize) * srb->transfersize;
US_DEBUGP("Max read is %d bytes\n", len);
- len = min(len, srb->request_bufflen);
+ len = min(len, scsi_bufflen(srb));
buffer = kmalloc(len, GFP_NOIO);
if (buffer == NULL) /* bloody hell! */
return USB_STOR_TRANSPORT_FAILED;
@@ -1226,10 +1226,10 @@ static int usbat_hp8200e_handle_read10(struct us_data *us,
sg_segment = 0; /* for keeping track of where we are in */
sg_offset = 0; /* the scatter/gather list */
- while (transferred != srb->request_bufflen) {
+ while (transferred != scsi_bufflen(srb)) {
- if (len > srb->request_bufflen - transferred)
- len = srb->request_bufflen - transferred;
+ if (len > scsi_bufflen(srb) - transferred)
+ len = scsi_bufflen(srb) - transferred;
data[3] = len&0xFF; /* (cylL) = expected length (L) */
data[4] = (len>>8)&0xFF; /* (cylH) = expected length (H) */
@@ -1265,7 +1265,7 @@ static int usbat_hp8200e_handle_read10(struct us_data *us,
transferred += len;
sector += len / srb->transfersize;
- } /* while transferred != srb->request_bufflen */
+ } /* while transferred != scsi_bufflen(srb) */
kfree(buffer);
return result;
@@ -1433,9 +1433,8 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)
unsigned char data[32];
unsigned int len;
int i;
- char string[64];
- len = srb->request_bufflen;
+ len = scsi_bufflen(srb);
/* Send A0 (ATA PACKET COMMAND).
Note: I guess we're never going to get any of the ATA
@@ -1476,8 +1475,8 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)
USBAT_ATA_DATA, USBAT_ATA_STATUS, 0xFD,
(USBAT_QUAL_FCQ | USBAT_QUAL_ALQ),
DMA_TO_DEVICE,
- srb->request_buffer,
- len, srb->use_sg, 10);
+ scsi_sglist(srb),
+ len, scsi_sg_count(srb), 10);
if (result == USB_STOR_TRANSPORT_GOOD) {
transferred += len;
@@ -1544,23 +1543,8 @@ static int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)
len = *status;
- result = usbat_read_block(us, srb->request_buffer, len, srb->use_sg);
-
- /* Debug-print the first 32 bytes of the transfer */
-
- if (!srb->use_sg) {
- string[0] = 0;
- for (i=0; i<len && i<32; i++) {
- sprintf(string+strlen(string), "%02X ",
- ((unsigned char *)srb->request_buffer)[i]);
- if ((i%16)==15) {
- US_DEBUGP("%s\n", string);
- string[0] = 0;
- }
- }
- if (string[0]!=0)
- US_DEBUGP("%s\n", string);
- }
+ result = usbat_read_block(us, scsi_sglist(srb), len,
+ scsi_sg_count(srb));
}
return result;
--
1.5.3.1
next prev parent reply other threads:[~2007-09-11 23:51 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-11 20:23 [patchset 0/24] Lots of the Accessors patches and !use_sg cleanup Boaz Harrosh
2007-09-11 20:50 ` Cameron, Steve
2007-09-11 21:05 ` Boaz Harrosh
2007-09-11 23:49 ` [PATCH 01/24] usb: transport - convert to accessors and !use_sg code path removal Boaz Harrosh
2007-09-11 23:50 ` [PATCH 02/24] usb: protocol.c " Boaz Harrosh
2007-09-11 23:51 ` Boaz Harrosh [this message]
2007-09-11 23:51 ` [PATCH 04/24] usb: freecom.c & sddr09.c - convert to accessors and !use_sg cleanup Boaz Harrosh
2007-09-11 23:53 ` [PATCH 05/24] isd200.c: use one-element sg list in issuing commands Boaz Harrosh
2007-09-11 23:54 ` [PATCH 06/24] NCR5380 familly convert to accessors & !use_sg cleanup Boaz Harrosh
2007-09-11 23:55 ` [PATCH 07/24] arm: scsi convert to accessors and " Boaz Harrosh
2007-09-12 7:42 ` Russell King
2007-09-18 15:04 ` Boaz Harrosh
2007-12-15 0:27 ` James Bottomley
2007-12-16 15:28 ` Boaz Harrosh
2008-02-01 20:10 ` Russell King
2008-01-31 18:09 ` James Bottomley
2007-09-11 23:56 ` [PATCH 08/24] nsp_cs.c convert to data " Boaz Harrosh
2007-09-11 23:58 ` [PATCH 09/24] libata-scsi: convert to use the data buffer accessors Boaz Harrosh
2007-09-12 0:09 ` Jeff Garzik
2007-09-12 0:25 ` Boaz Harrosh
2007-09-12 1:40 ` Matthew Dharm
2007-09-12 6:36 ` Boaz Harrosh
2007-09-18 15:46 ` [PATCH ver2 1/2] libata-scsi: Remove !use_sg code paths Boaz Harrosh
2007-09-20 21:12 ` Jeff Garzik
2007-09-18 15:48 ` [PATCH ver2 2/2] libata-scsi: convert to use the data buffer accessors Boaz Harrosh
2007-09-12 0:00 ` [PATCH 10/24] eata_pio.c: convert to accessors and !use_sg cleanup Boaz Harrosh
2007-09-12 0:00 ` [PATCH 11/24] a2091.c: " Boaz Harrosh
2007-09-12 0:01 ` [PATCH 12/24] a3000.c: " Boaz Harrosh
2007-09-12 0:02 ` [PATCH 13/24] aha1542.c: " Boaz Harrosh
2007-09-12 0:03 ` [PATCH 14/24] atp870u.c: " Boaz Harrosh
2007-09-12 0:04 ` [PATCH 15/24] fd_mcs.c: " Boaz Harrosh
2007-09-12 0:05 ` [PATCH 16/24] imm.c: " Boaz Harrosh
2007-09-12 0:06 ` [PATCH 17/24] in2000.c: " Boaz Harrosh
2007-09-12 0:07 ` [PATCH 18/24] ppa.c: " Boaz Harrosh
2007-09-12 0:07 ` [PATCH 19/24] wd33c93.c: " Boaz Harrosh
2007-09-12 0:09 ` Subject: [PATCH 20/24] scsi: esp family " Boaz Harrosh
2007-09-12 0:09 ` [PATCH 21/24] qlogicpti.c: " Boaz Harrosh
2007-10-10 18:25 ` [PATCH 21/24 ver2] " Boaz Harrosh
2007-10-10 22:58 ` David Miller
2007-09-12 0:10 ` Subject: [PATCH 22/24] Remove psi240i driver from kernel Boaz Harrosh
2007-09-12 0:11 ` [PATCH 23/24] wd7000.c - proper fix for boards without sg support Boaz Harrosh
2007-09-12 0:13 ` [PATCH 24/24] ide-scsi.c: convert to data accessors and !use_sg cleanup Boaz Harrosh
2007-09-17 11:04 ` Bartlomiej Zolnierkiewicz
2007-09-18 8:49 ` Boaz Harrosh
2007-09-18 9:03 ` [PATCH ver2 " Boaz Harrosh
2007-09-18 9:14 ` Christoph Hellwig
2007-09-18 10:24 ` Boaz Harrosh
2007-09-18 10:27 ` [PATCH 24/24 ver3 ] " Boaz Harrosh
2007-09-19 19:59 ` Bartlomiej Zolnierkiewicz
2007-09-12 16:00 ` [patchset 0/24] Lots of the Accessors patches " Maciej W. Rozycki
2007-09-17 10:46 ` Bartlomiej Zolnierkiewicz
2007-09-17 11:36 ` Boaz Harrosh
2007-09-17 13:51 ` James Bottomley
2007-09-17 20:05 ` Bartlomiej Zolnierkiewicz
2007-09-17 20:57 ` Jeff Garzik
2007-09-17 21:00 ` James Bottomley
2007-09-17 21:05 ` Jeff Garzik
2007-10-10 18:24 ` Boaz Harrosh
2007-10-10 19:14 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46E729E7.9030504@panasas.com \
--to=bharrosh@panasas.com \
--cc=James.Bottomley@SteelEye.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=gregkh@suse.de \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).