diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2007-05-11 06:33:09 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2007-10-16 05:20:59 -0400 |
commit | 1f6f31a03e3aed0854a6aa3ab763c3d3b2ff42ff (patch) | |
tree | bdb94c08e0bce7c17f686aabc274a7554718407b /drivers/usb/storage/sddr55.c | |
parent | 53d412fce05e73dd0b25b0ebfa83c7ee94f16451 (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/sddr55.c')
-rw-r--r-- | drivers/usb/storage/sddr55.c | 16 |
1 files changed, 10 insertions, 6 deletions
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", |