diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2008-06-16 12:11:39 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-21 18:16:32 -0400 |
commit | 7c3e28bc56bd2e4310dc0af99f2b95eeda9a2ff7 (patch) | |
tree | 99dd471065e315f2a88a1c7b6b2ab4c4ef7302db | |
parent | 625f694936cbbdee98e6cc65f72724a7660e7946 (diff) |
USB: use standard SG iterator in the scatter-gather library
This patch (as1103) changes the iteration in the USB scatter-gather to
use a standard SG iterator. Otherwise the iteration will fail if it
encounters a chained SG list.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/core/message.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 315363b744a3..08af1083ebfc 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -400,7 +400,7 @@ int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev, | |||
400 | if (usb_pipein(pipe)) | 400 | if (usb_pipein(pipe)) |
401 | urb_flags |= URB_SHORT_NOT_OK; | 401 | urb_flags |= URB_SHORT_NOT_OK; |
402 | 402 | ||
403 | for (i = 0; i < io->entries; i++) { | 403 | for_each_sg(sg, sg, io->entries, i) { |
404 | unsigned len; | 404 | unsigned len; |
405 | 405 | ||
406 | io->urbs[i] = usb_alloc_urb(0, mem_flags); | 406 | io->urbs[i] = usb_alloc_urb(0, mem_flags); |
@@ -434,17 +434,17 @@ int usb_sg_init(struct usb_sg_request *io, struct usb_device *dev, | |||
434 | * to prevent stale pointers and to help spot bugs. | 434 | * to prevent stale pointers and to help spot bugs. |
435 | */ | 435 | */ |
436 | if (dma) { | 436 | if (dma) { |
437 | io->urbs[i]->transfer_dma = sg_dma_address(sg + i); | 437 | io->urbs[i]->transfer_dma = sg_dma_address(sg); |
438 | len = sg_dma_len(sg + i); | 438 | len = sg_dma_len(sg); |
439 | #if defined(CONFIG_HIGHMEM) || defined(CONFIG_GART_IOMMU) | 439 | #if defined(CONFIG_HIGHMEM) || defined(CONFIG_GART_IOMMU) |
440 | io->urbs[i]->transfer_buffer = NULL; | 440 | io->urbs[i]->transfer_buffer = NULL; |
441 | #else | 441 | #else |
442 | io->urbs[i]->transfer_buffer = sg_virt(&sg[i]); | 442 | io->urbs[i]->transfer_buffer = sg_virt(sg); |
443 | #endif | 443 | #endif |
444 | } else { | 444 | } else { |
445 | /* hc may use _only_ transfer_buffer */ | 445 | /* hc may use _only_ transfer_buffer */ |
446 | io->urbs[i]->transfer_buffer = sg_virt(&sg[i]); | 446 | io->urbs[i]->transfer_buffer = sg_virt(sg); |
447 | len = sg[i].length; | 447 | len = sg->length; |
448 | } | 448 | } |
449 | 449 | ||
450 | if (length) { | 450 | if (length) { |