]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
qlogicpti: sg chaining support
authorJens Axboe <jens.axboe@oracle.com>
Wed, 9 May 2007 11:43:12 +0000 (13:43 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 16 Oct 2007 09:14:19 +0000 (11:14 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
drivers/scsi/qlogicpti.c

index e93f80316a19369d7d3416c887ece96bed1117c6..7a2e7986b038f16185875fe95bc8e2a32acc80a4 100644 (file)
@@ -868,7 +868,7 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd,
                           struct qlogicpti *qpti, u_int in_ptr, u_int out_ptr)
 {
        struct dataseg *ds;
-       struct scatterlist *sg;
+       struct scatterlist *sg, *s;
        int i, n;
 
        if (Cmnd->use_sg) {
@@ -884,11 +884,12 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd,
                n = sg_count;
                if (n > 4)
                        n = 4;
-               for (i = 0; i < n; i++, sg++) {
-                       ds[i].d_base = sg_dma_address(sg);
-                       ds[i].d_count = sg_dma_len(sg);
+               for_each_sg(sg, s, n, i) {
+                       ds[i].d_base = sg_dma_address(s);
+                       ds[i].d_count = sg_dma_len(s);
                }
                sg_count -= 4;
+               sg = s;
                while (sg_count > 0) {
                        struct Continuation_Entry *cont;
 
@@ -907,9 +908,9 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd,
                        n = sg_count;
                        if (n > 7)
                                n = 7;
-                       for (i = 0; i < n; i++, sg++) {
-                               ds[i].d_base = sg_dma_address(sg);
-                               ds[i].d_count = sg_dma_len(sg);
+                       for_each_sg(sg, s, n, i) {
+                               ds[i].d_base = sg_dma_address(s);
+                               ds[i].d_count = sg_dma_len(s);
                        }
                        sg_count -= n;
                }