aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/shuttle_usbat.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-05-11 06:33:09 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-16 05:20:59 -0400
commit1f6f31a03e3aed0854a6aa3ab763c3d3b2ff42ff (patch)
treebdb94c08e0bce7c17f686aabc274a7554718407b /drivers/usb/storage/shuttle_usbat.c
parent53d412fce05e73dd0b25b0ebfa83c7ee94f16451 (diff)
USB storage: sg chaining support
[PATCH] USB storage: sg chaining support Modify usb_stor_access_xfer_buf() to take a pointer to an sg entry pointer, so we can keep track of that instead of passing around an integer index (which we can't use when dealing with multiple scatterlist arrays). Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/usb/storage/shuttle_usbat.c')
-rw-r--r--drivers/usb/storage/shuttle_usbat.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
index 17ca4d73577b..cb22a9ad1694 100644
--- a/drivers/usb/storage/shuttle_usbat.c
+++ b/drivers/usb/storage/shuttle_usbat.c
@@ -993,7 +993,8 @@ static int usbat_flash_read_data(struct us_data *us,
993 unsigned char thistime; 993 unsigned char thistime;
994 unsigned int totallen, alloclen; 994 unsigned int totallen, alloclen;
995 int len, result; 995 int len, result;
996 unsigned int sg_idx = 0, sg_offset = 0; 996 unsigned int sg_offset = 0;
997 struct scatterlist *sg = NULL;
997 998
998 result = usbat_flash_check_media(us, info); 999 result = usbat_flash_check_media(us, info);
999 if (result != USB_STOR_TRANSPORT_GOOD) 1000 if (result != USB_STOR_TRANSPORT_GOOD)
@@ -1047,7 +1048,7 @@ static int usbat_flash_read_data(struct us_data *us,
1047 1048
1048 /* Store the data in the transfer buffer */ 1049 /* Store the data in the transfer buffer */
1049 usb_stor_access_xfer_buf(buffer, len, us->srb, 1050 usb_stor_access_xfer_buf(buffer, len, us->srb,
1050 &sg_idx, &sg_offset, TO_XFER_BUF); 1051 &sg, &sg_offset, TO_XFER_BUF);
1051 1052
1052 sector += thistime; 1053 sector += thistime;
1053 totallen -= len; 1054 totallen -= len;
@@ -1083,7 +1084,8 @@ static int usbat_flash_write_data(struct us_data *us,
1083 unsigned char thistime; 1084 unsigned char thistime;
1084 unsigned int totallen, alloclen; 1085 unsigned int totallen, alloclen;
1085 int len, result; 1086 int len, result;
1086 unsigned int sg_idx = 0, sg_offset = 0; 1087 unsigned int sg_offset = 0;
1088 struct scatterlist *sg = NULL;
1087 1089
1088 result = usbat_flash_check_media(us, info); 1090 result = usbat_flash_check_media(us, info);
1089 if (result != USB_STOR_TRANSPORT_GOOD) 1091 if (result != USB_STOR_TRANSPORT_GOOD)
@@ -1122,7 +1124,7 @@ static int usbat_flash_write_data(struct us_data *us,
1122 1124
1123 /* Get the data from the transfer buffer */ 1125 /* Get the data from the transfer buffer */
1124 usb_stor_access_xfer_buf(buffer, len, us->srb, 1126 usb_stor_access_xfer_buf(buffer, len, us->srb,
1125 &sg_idx, &sg_offset, FROM_XFER_BUF); 1127 &sg, &sg_offset, FROM_XFER_BUF);
1126 1128
1127 /* ATA command 0x30 (WRITE SECTORS) */ 1129 /* ATA command 0x30 (WRITE SECTORS) */
1128 usbat_pack_ata_sector_cmd(command, thistime, sector, 0x30); 1130 usbat_pack_ata_sector_cmd(command, thistime, sector, 0x30);
@@ -1162,8 +1164,8 @@ static int usbat_hp8200e_handle_read10(struct us_data *us,
1162 unsigned char *buffer; 1164 unsigned char *buffer;
1163 unsigned int len; 1165 unsigned int len;
1164 unsigned int sector; 1166 unsigned int sector;
1165 unsigned int sg_segment = 0;
1166 unsigned int sg_offset = 0; 1167 unsigned int sg_offset = 0;
1168 struct scatterlist *sg = NULL;
1167 1169
1168 US_DEBUGP("handle_read10: transfersize %d\n", 1170 US_DEBUGP("handle_read10: transfersize %d\n",
1169 srb->transfersize); 1171 srb->transfersize);
@@ -1220,9 +1222,6 @@ static int usbat_hp8200e_handle_read10(struct us_data *us,
1220 sector |= short_pack(data[7+5], data[7+4]); 1222 sector |= short_pack(data[7+5], data[7+4]);
1221 transferred = 0; 1223 transferred = 0;
1222 1224
1223 sg_segment = 0; /* for keeping track of where we are in */
1224 sg_offset = 0; /* the scatter/gather list */
1225
1226 while (transferred != srb->request_bufflen) { 1225 while (transferred != srb->request_bufflen) {
1227 1226
1228 if (len > srb->request_bufflen - transferred) 1227 if (len > srb->request_bufflen - transferred)
@@ -1255,7 +1254,7 @@ static int usbat_hp8200e_handle_read10(struct us_data *us,
1255 1254
1256 /* Store the data in the transfer buffer */ 1255 /* Store the data in the transfer buffer */
1257 usb_stor_access_xfer_buf(buffer, len, srb, 1256 usb_stor_access_xfer_buf(buffer, len, srb,
1258 &sg_segment, &sg_offset, TO_XFER_BUF); 1257 &sg, &sg_offset, TO_XFER_BUF);
1259 1258
1260 /* Update the amount transferred and the sector number */ 1259 /* Update the amount transferred and the sector number */
1261 1260