aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/storage/alauda.c16
-rw-r--r--drivers/usb/storage/datafab.c10
-rw-r--r--drivers/usb/storage/jumpshot.c10
-rw-r--r--drivers/usb/storage/protocol.c20
-rw-r--r--drivers/usb/storage/protocol.h2
-rw-r--r--drivers/usb/storage/sddr09.c16
-rw-r--r--drivers/usb/storage/sddr55.c16
-rw-r--r--drivers/usb/storage/shuttle_usbat.c17
8 files changed, 62 insertions, 45 deletions
diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index 4d3cbb12b713..8d3711a7ff06 100644
--- a/drivers/usb/storage/alauda.c
+++ b/drivers/usb/storage/alauda.c
@@ -798,12 +798,13 @@ static int alauda_read_data(struct us_data *us, unsigned long address,
798{ 798{
799 unsigned char *buffer; 799 unsigned char *buffer;
800 u16 lba, max_lba; 800 u16 lba, max_lba;
801 unsigned int page, len, index, offset; 801 unsigned int page, len, offset;
802 unsigned int blockshift = MEDIA_INFO(us).blockshift; 802 unsigned int blockshift = MEDIA_INFO(us).blockshift;
803 unsigned int pageshift = MEDIA_INFO(us).pageshift; 803 unsigned int pageshift = MEDIA_INFO(us).pageshift;
804 unsigned int blocksize = MEDIA_INFO(us).blocksize; 804 unsigned int blocksize = MEDIA_INFO(us).blocksize;
805 unsigned int pagesize = MEDIA_INFO(us).pagesize; 805 unsigned int pagesize = MEDIA_INFO(us).pagesize;
806 unsigned int uzonesize = MEDIA_INFO(us).uzonesize; 806 unsigned int uzonesize = MEDIA_INFO(us).uzonesize;
807 struct scatterlist *sg;
807 int result; 808 int result;
808 809
809 /* 810 /*
@@ -827,7 +828,8 @@ static int alauda_read_data(struct us_data *us, unsigned long address,
827 max_lba = MEDIA_INFO(us).capacity >> (blockshift + pageshift); 828 max_lba = MEDIA_INFO(us).capacity >> (blockshift + pageshift);
828 829
829 result = USB_STOR_TRANSPORT_GOOD; 830 result = USB_STOR_TRANSPORT_GOOD;
830 index = offset = 0; 831 offset = 0;
832 sg = NULL;
831 833
832 while (sectors > 0) { 834 while (sectors > 0) {
833 unsigned int zone = lba / uzonesize; /* integer division */ 835 unsigned int zone = lba / uzonesize; /* integer division */
@@ -873,7 +875,7 @@ static int alauda_read_data(struct us_data *us, unsigned long address,
873 875
874 /* Store the data in the transfer buffer */ 876 /* Store the data in the transfer buffer */
875 usb_stor_access_xfer_buf(buffer, len, us->srb, 877 usb_stor_access_xfer_buf(buffer, len, us->srb,
876 &index, &offset, TO_XFER_BUF); 878 &sg, &offset, TO_XFER_BUF);
877 879
878 page = 0; 880 page = 0;
879 lba++; 881 lba++;
@@ -891,11 +893,12 @@ static int alauda_write_data(struct us_data *us, unsigned long address,
891 unsigned int sectors) 893 unsigned int sectors)
892{ 894{
893 unsigned char *buffer, *blockbuffer; 895 unsigned char *buffer, *blockbuffer;
894 unsigned int page, len, index, offset; 896 unsigned int page, len, offset;
895 unsigned int blockshift = MEDIA_INFO(us).blockshift; 897 unsigned int blockshift = MEDIA_INFO(us).blockshift;
896 unsigned int pageshift = MEDIA_INFO(us).pageshift; 898 unsigned int pageshift = MEDIA_INFO(us).pageshift;
897 unsigned int blocksize = MEDIA_INFO(us).blocksize; 899 unsigned int blocksize = MEDIA_INFO(us).blocksize;
898 unsigned int pagesize = MEDIA_INFO(us).pagesize; 900 unsigned int pagesize = MEDIA_INFO(us).pagesize;
901 struct scatterlist *sg;
899 u16 lba, max_lba; 902 u16 lba, max_lba;
900 int result; 903 int result;
901 904
@@ -929,7 +932,8 @@ static int alauda_write_data(struct us_data *us, unsigned long address,
929 max_lba = MEDIA_INFO(us).capacity >> (pageshift + blockshift); 932 max_lba = MEDIA_INFO(us).capacity >> (pageshift + blockshift);
930 933
931 result = USB_STOR_TRANSPORT_GOOD; 934 result = USB_STOR_TRANSPORT_GOOD;
932 index = offset = 0; 935 offset = 0;
936 sg = NULL;
933 937
934 while (sectors > 0) { 938 while (sectors > 0) {
935 /* Write as many sectors as possible in this block */ 939 /* Write as many sectors as possible in this block */
@@ -946,7 +950,7 @@ static int alauda_write_data(struct us_data *us, unsigned long address,
946 950
947 /* Get the data from the transfer buffer */ 951 /* Get the data from the transfer buffer */
948 usb_stor_access_xfer_buf(buffer, len, us->srb, 952 usb_stor_access_xfer_buf(buffer, len, us->srb,
949 &index, &offset, FROM_XFER_BUF); 953 &sg, &offset, FROM_XFER_BUF);
950 954
951 result = alauda_write_lba(us, lba, page, pages, buffer, 955 result = alauda_write_lba(us, lba, page, pages, buffer,
952 blockbuffer); 956 blockbuffer);
diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
index c87ad1bae1d6..579e9f52053a 100644
--- a/drivers/usb/storage/datafab.c
+++ b/drivers/usb/storage/datafab.c
@@ -98,7 +98,8 @@ static int datafab_read_data(struct us_data *us,
98 unsigned char thistime; 98 unsigned char thistime;
99 unsigned int totallen, alloclen; 99 unsigned int totallen, alloclen;
100 int len, result; 100 int len, result;
101 unsigned int sg_idx = 0, sg_offset = 0; 101 unsigned int sg_offset = 0;
102 struct scatterlist *sg = NULL;
102 103
103 // we're working in LBA mode. according to the ATA spec, 104 // we're working in LBA mode. according to the ATA spec,
104 // we can support up to 28-bit addressing. I don't know if Datafab 105 // we can support up to 28-bit addressing. I don't know if Datafab
@@ -155,7 +156,7 @@ static int datafab_read_data(struct us_data *us,
155 156
156 // Store the data in the transfer buffer 157 // Store the data in the transfer buffer
157 usb_stor_access_xfer_buf(buffer, len, us->srb, 158 usb_stor_access_xfer_buf(buffer, len, us->srb,
158 &sg_idx, &sg_offset, TO_XFER_BUF); 159 &sg, &sg_offset, TO_XFER_BUF);
159 160
160 sector += thistime; 161 sector += thistime;
161 totallen -= len; 162 totallen -= len;
@@ -181,7 +182,8 @@ static int datafab_write_data(struct us_data *us,
181 unsigned char thistime; 182 unsigned char thistime;
182 unsigned int totallen, alloclen; 183 unsigned int totallen, alloclen;
183 int len, result; 184 int len, result;
184 unsigned int sg_idx = 0, sg_offset = 0; 185 unsigned int sg_offset = 0;
186 struct scatterlist *sg = NULL;
185 187
186 // we're working in LBA mode. according to the ATA spec, 188 // we're working in LBA mode. according to the ATA spec,
187 // we can support up to 28-bit addressing. I don't know if Datafab 189 // we can support up to 28-bit addressing. I don't know if Datafab
@@ -217,7 +219,7 @@ static int datafab_write_data(struct us_data *us,
217 219
218 // Get the data from the transfer buffer 220 // Get the data from the transfer buffer
219 usb_stor_access_xfer_buf(buffer, len, us->srb, 221 usb_stor_access_xfer_buf(buffer, len, us->srb,
220 &sg_idx, &sg_offset, FROM_XFER_BUF); 222 &sg, &sg_offset, FROM_XFER_BUF);
221 223
222 command[0] = 0; 224 command[0] = 0;
223 command[1] = thistime; 225 command[1] = thistime;
diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
index 003fcf545888..61097cbb1585 100644
--- a/drivers/usb/storage/jumpshot.c
+++ b/drivers/usb/storage/jumpshot.c
@@ -119,7 +119,8 @@ static int jumpshot_read_data(struct us_data *us,
119 unsigned char thistime; 119 unsigned char thistime;
120 unsigned int totallen, alloclen; 120 unsigned int totallen, alloclen;
121 int len, result; 121 int len, result;
122 unsigned int sg_idx = 0, sg_offset = 0; 122 unsigned int sg_offset = 0;
123 struct scatterlist *sg = NULL;
123 124
124 // we're working in LBA mode. according to the ATA spec, 125 // we're working in LBA mode. according to the ATA spec,
125 // we can support up to 28-bit addressing. I don't know if Jumpshot 126 // we can support up to 28-bit addressing. I don't know if Jumpshot
@@ -170,7 +171,7 @@ static int jumpshot_read_data(struct us_data *us,
170 171
171 // Store the data in the transfer buffer 172 // Store the data in the transfer buffer
172 usb_stor_access_xfer_buf(buffer, len, us->srb, 173 usb_stor_access_xfer_buf(buffer, len, us->srb,
173 &sg_idx, &sg_offset, TO_XFER_BUF); 174 &sg, &sg_offset, TO_XFER_BUF);
174 175
175 sector += thistime; 176 sector += thistime;
176 totallen -= len; 177 totallen -= len;
@@ -195,7 +196,8 @@ static int jumpshot_write_data(struct us_data *us,
195 unsigned char thistime; 196 unsigned char thistime;
196 unsigned int totallen, alloclen; 197 unsigned int totallen, alloclen;
197 int len, result, waitcount; 198 int len, result, waitcount;
198 unsigned int sg_idx = 0, sg_offset = 0; 199 unsigned int sg_offset = 0;
200 struct scatterlist *sg = NULL;
199 201
200 // we're working in LBA mode. according to the ATA spec, 202 // we're working in LBA mode. according to the ATA spec,
201 // we can support up to 28-bit addressing. I don't know if Jumpshot 203 // we can support up to 28-bit addressing. I don't know if Jumpshot
@@ -225,7 +227,7 @@ static int jumpshot_write_data(struct us_data *us,
225 227
226 // Get the data from the transfer buffer 228 // Get the data from the transfer buffer
227 usb_stor_access_xfer_buf(buffer, len, us->srb, 229 usb_stor_access_xfer_buf(buffer, len, us->srb,
228 &sg_idx, &sg_offset, FROM_XFER_BUF); 230 &sg, &sg_offset, FROM_XFER_BUF);
229 231
230 command[0] = 0; 232 command[0] = 0;
231 command[1] = thistime; 233 command[1] = thistime;
diff --git a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
index 9ad30428d2dd..cc8f7c52c729 100644
--- a/drivers/usb/storage/protocol.c
+++ b/drivers/usb/storage/protocol.c
@@ -157,7 +157,7 @@ void usb_stor_transparent_scsi_command(struct scsi_cmnd *srb,
157 * pick up from where this one left off. */ 157 * pick up from where this one left off. */
158 158
159unsigned int usb_stor_access_xfer_buf(unsigned char *buffer, 159unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
160 unsigned int buflen, struct scsi_cmnd *srb, unsigned int *index, 160 unsigned int buflen, struct scsi_cmnd *srb, struct scatterlist **sgptr,
161 unsigned int *offset, enum xfer_buf_dir dir) 161 unsigned int *offset, enum xfer_buf_dir dir)
162{ 162{
163 unsigned int cnt; 163 unsigned int cnt;
@@ -184,16 +184,17 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
184 * located in high memory -- then kmap() will map it to a temporary 184 * located in high memory -- then kmap() will map it to a temporary
185 * position in the kernel's virtual address space. */ 185 * position in the kernel's virtual address space. */
186 } else { 186 } else {
187 struct scatterlist *sg = 187 struct scatterlist *sg = *sgptr;
188 (struct scatterlist *) srb->request_buffer 188
189 + *index; 189 if (!sg)
190 sg = (struct scatterlist *) srb->request_buffer;
190 191
191 /* This loop handles a single s-g list entry, which may 192 /* This loop handles a single s-g list entry, which may
192 * include multiple pages. Find the initial page structure 193 * include multiple pages. Find the initial page structure
193 * and the starting offset within the page, and update 194 * and the starting offset within the page, and update
194 * the *offset and *index values for the next loop. */ 195 * the *offset and *index values for the next loop. */
195 cnt = 0; 196 cnt = 0;
196 while (cnt < buflen && *index < srb->use_sg) { 197 while (cnt < buflen) {
197 struct page *page = sg->page + 198 struct page *page = sg->page +
198 ((sg->offset + *offset) >> PAGE_SHIFT); 199 ((sg->offset + *offset) >> PAGE_SHIFT);
199 unsigned int poff = 200 unsigned int poff =
@@ -209,8 +210,7 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
209 210
210 /* Transfer continues to next s-g entry */ 211 /* Transfer continues to next s-g entry */
211 *offset = 0; 212 *offset = 0;
212 ++*index; 213 sg = sg_next(sg);
213 ++sg;
214 } 214 }
215 215
216 /* Transfer the data for all the pages in this 216 /* Transfer the data for all the pages in this
@@ -234,6 +234,7 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
234 sglen -= plen; 234 sglen -= plen;
235 } 235 }
236 } 236 }
237 *sgptr = sg;
237 } 238 }
238 239
239 /* Return the amount actually transferred */ 240 /* Return the amount actually transferred */
@@ -245,9 +246,10 @@ unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
245void usb_stor_set_xfer_buf(unsigned char *buffer, 246void usb_stor_set_xfer_buf(unsigned char *buffer,
246 unsigned int buflen, struct scsi_cmnd *srb) 247 unsigned int buflen, struct scsi_cmnd *srb)
247{ 248{
248 unsigned int index = 0, offset = 0; 249 unsigned int offset = 0;
250 struct scatterlist *sg = NULL;
249 251
250 usb_stor_access_xfer_buf(buffer, buflen, srb, &index, &offset, 252 usb_stor_access_xfer_buf(buffer, buflen, srb, &sg, &offset,
251 TO_XFER_BUF); 253 TO_XFER_BUF);
252 if (buflen < srb->request_bufflen) 254 if (buflen < srb->request_bufflen)
253 srb->resid = srb->request_bufflen - buflen; 255 srb->resid = srb->request_bufflen - buflen;
diff --git a/drivers/usb/storage/protocol.h b/drivers/usb/storage/protocol.h
index 845bed4b8031..8737a36891ca 100644
--- a/drivers/usb/storage/protocol.h
+++ b/drivers/usb/storage/protocol.h
@@ -52,7 +52,7 @@ extern void usb_stor_transparent_scsi_command(struct scsi_cmnd*,
52enum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF}; 52enum xfer_buf_dir {TO_XFER_BUF, FROM_XFER_BUF};
53 53
54extern unsigned int usb_stor_access_xfer_buf(unsigned char *buffer, 54extern unsigned int usb_stor_access_xfer_buf(unsigned char *buffer,
55 unsigned int buflen, struct scsi_cmnd *srb, unsigned int *index, 55 unsigned int buflen, struct scsi_cmnd *srb, struct scatterlist **,
56 unsigned int *offset, enum xfer_buf_dir dir); 56 unsigned int *offset, enum xfer_buf_dir dir);
57 57
58extern void usb_stor_set_xfer_buf(unsigned char *buffer, 58extern void usb_stor_set_xfer_buf(unsigned char *buffer,
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
index b2ed2a3e6fca..b12202c5da2d 100644
--- a/drivers/usb/storage/sddr09.c
+++ b/drivers/usb/storage/sddr09.c
@@ -705,7 +705,8 @@ sddr09_read_data(struct us_data *us,
705 unsigned char *buffer; 705 unsigned char *buffer;
706 unsigned int lba, maxlba, pba; 706 unsigned int lba, maxlba, pba;
707 unsigned int page, pages; 707 unsigned int page, pages;
708 unsigned int len, index, offset; 708 unsigned int len, offset;
709 struct scatterlist *sg;
709 int result; 710 int result;
710 711
711 // Figure out the initial LBA and page 712 // Figure out the initial LBA and page
@@ -730,7 +731,8 @@ sddr09_read_data(struct us_data *us,
730 // contiguous LBA's. Another exercise left to the student. 731 // contiguous LBA's. Another exercise left to the student.
731 732
732 result = 0; 733 result = 0;
733 index = offset = 0; 734 offset = 0;
735 sg = NULL;
734 736
735 while (sectors > 0) { 737 while (sectors > 0) {
736 738
@@ -777,7 +779,7 @@ sddr09_read_data(struct us_data *us,
777 779
778 // Store the data in the transfer buffer 780 // Store the data in the transfer buffer
779 usb_stor_access_xfer_buf(buffer, len, us->srb, 781 usb_stor_access_xfer_buf(buffer, len, us->srb,
780 &index, &offset, TO_XFER_BUF); 782 &sg, &offset, TO_XFER_BUF);
781 783
782 page = 0; 784 page = 0;
783 lba++; 785 lba++;
@@ -931,7 +933,8 @@ sddr09_write_data(struct us_data *us,
931 unsigned int pagelen, blocklen; 933 unsigned int pagelen, blocklen;
932 unsigned char *blockbuffer; 934 unsigned char *blockbuffer;
933 unsigned char *buffer; 935 unsigned char *buffer;
934 unsigned int len, index, offset; 936 unsigned int len, offset;
937 struct scatterlist *sg;
935 int result; 938 int result;
936 939
937 // Figure out the initial LBA and page 940 // Figure out the initial LBA and page
@@ -968,7 +971,8 @@ sddr09_write_data(struct us_data *us,
968 } 971 }
969 972
970 result = 0; 973 result = 0;
971 index = offset = 0; 974 offset = 0;
975 sg = NULL;
972 976
973 while (sectors > 0) { 977 while (sectors > 0) {
974 978
@@ -987,7 +991,7 @@ sddr09_write_data(struct us_data *us,
987 991
988 // Get the data from the transfer buffer 992 // Get the data from the transfer buffer
989 usb_stor_access_xfer_buf(buffer, len, us->srb, 993 usb_stor_access_xfer_buf(buffer, len, us->srb,
990 &index, &offset, FROM_XFER_BUF); 994 &sg, &offset, FROM_XFER_BUF);
991 995
992 result = sddr09_write_lba(us, lba, page, pages, 996 result = sddr09_write_lba(us, lba, page, pages,
993 buffer, blockbuffer); 997 buffer, blockbuffer);
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
index 0b1b5b59ca7b..d43a3415e12f 100644
--- a/drivers/usb/storage/sddr55.c
+++ b/drivers/usb/storage/sddr55.c
@@ -167,7 +167,8 @@ static int sddr55_read_data(struct us_data *us,
167 unsigned long address; 167 unsigned long address;
168 168
169 unsigned short pages; 169 unsigned short pages;
170 unsigned int len, index, offset; 170 unsigned int len, offset;
171 struct scatterlist *sg;
171 172
172 // Since we only read in one block at a time, we have to create 173 // Since we only read in one block at a time, we have to create
173 // a bounce buffer and move the data a piece at a time between the 174 // a bounce buffer and move the data a piece at a time between the
@@ -178,7 +179,8 @@ static int sddr55_read_data(struct us_data *us,
178 buffer = kmalloc(len, GFP_NOIO); 179 buffer = kmalloc(len, GFP_NOIO);
179 if (buffer == NULL) 180 if (buffer == NULL)
180 return USB_STOR_TRANSPORT_ERROR; /* out of memory */ 181 return USB_STOR_TRANSPORT_ERROR; /* out of memory */
181 index = offset = 0; 182 offset = 0;
183 sg = NULL;
182 184
183 while (sectors>0) { 185 while (sectors>0) {
184 186
@@ -255,7 +257,7 @@ static int sddr55_read_data(struct us_data *us,
255 257
256 // Store the data in the transfer buffer 258 // Store the data in the transfer buffer
257 usb_stor_access_xfer_buf(buffer, len, us->srb, 259 usb_stor_access_xfer_buf(buffer, len, us->srb,
258 &index, &offset, TO_XFER_BUF); 260 &sg, &offset, TO_XFER_BUF);
259 261
260 page = 0; 262 page = 0;
261 lba++; 263 lba++;
@@ -287,7 +289,8 @@ static int sddr55_write_data(struct us_data *us,
287 289
288 unsigned short pages; 290 unsigned short pages;
289 int i; 291 int i;
290 unsigned int len, index, offset; 292 unsigned int len, offset;
293 struct scatterlist *sg;
291 294
292 /* check if we are allowed to write */ 295 /* check if we are allowed to write */
293 if (info->read_only || info->force_read_only) { 296 if (info->read_only || info->force_read_only) {
@@ -304,7 +307,8 @@ static int sddr55_write_data(struct us_data *us,
304 buffer = kmalloc(len, GFP_NOIO); 307 buffer = kmalloc(len, GFP_NOIO);
305 if (buffer == NULL) 308 if (buffer == NULL)
306 return USB_STOR_TRANSPORT_ERROR; 309 return USB_STOR_TRANSPORT_ERROR;
307 index = offset = 0; 310 offset = 0;
311 sg = NULL;
308 312
309 while (sectors > 0) { 313 while (sectors > 0) {
310 314
@@ -322,7 +326,7 @@ static int sddr55_write_data(struct us_data *us,
322 326
323 // Get the data from the transfer buffer 327 // Get the data from the transfer buffer
324 usb_stor_access_xfer_buf(buffer, len, us->srb, 328 usb_stor_access_xfer_buf(buffer, len, us->srb,
325 &index, &offset, FROM_XFER_BUF); 329 &sg, &offset, FROM_XFER_BUF);
326 330
327 US_DEBUGP("Write %02X pages, to PBA %04X" 331 US_DEBUGP("Write %02X pages, to PBA %04X"
328 " (LBA %04X) page %02X\n", 332 " (LBA %04X) page %02X\n",
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