diff options
Diffstat (limited to 'drivers/scsi/sata_sx4.c')
-rw-r--r-- | drivers/scsi/sata_sx4.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index 0ec21e09f5d8..f859bbd681ed 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c | |||
@@ -450,14 +450,14 @@ static inline void pdc20621_host_pkt(struct ata_taskfile *tf, u8 *buf, | |||
450 | 450 | ||
451 | static void pdc20621_dma_prep(struct ata_queued_cmd *qc) | 451 | static void pdc20621_dma_prep(struct ata_queued_cmd *qc) |
452 | { | 452 | { |
453 | struct scatterlist *sg = qc->sg; | 453 | struct scatterlist *sg; |
454 | struct ata_port *ap = qc->ap; | 454 | struct ata_port *ap = qc->ap; |
455 | struct pdc_port_priv *pp = ap->private_data; | 455 | struct pdc_port_priv *pp = ap->private_data; |
456 | void __iomem *mmio = ap->host_set->mmio_base; | 456 | void __iomem *mmio = ap->host_set->mmio_base; |
457 | struct pdc_host_priv *hpriv = ap->host_set->private_data; | 457 | struct pdc_host_priv *hpriv = ap->host_set->private_data; |
458 | void __iomem *dimm_mmio = hpriv->dimm_mmio; | 458 | void __iomem *dimm_mmio = hpriv->dimm_mmio; |
459 | unsigned int portno = ap->port_no; | 459 | unsigned int portno = ap->port_no; |
460 | unsigned int i, last, idx, total_len = 0, sgt_len; | 460 | unsigned int i, idx, total_len = 0, sgt_len; |
461 | u32 *buf = (u32 *) &pp->dimm_buf[PDC_DIMM_HEADER_SZ]; | 461 | u32 *buf = (u32 *) &pp->dimm_buf[PDC_DIMM_HEADER_SZ]; |
462 | 462 | ||
463 | assert(qc->flags & ATA_QCFLAG_DMAMAP); | 463 | assert(qc->flags & ATA_QCFLAG_DMAMAP); |
@@ -470,12 +470,11 @@ static void pdc20621_dma_prep(struct ata_queued_cmd *qc) | |||
470 | /* | 470 | /* |
471 | * Build S/G table | 471 | * Build S/G table |
472 | */ | 472 | */ |
473 | last = qc->n_elem; | ||
474 | idx = 0; | 473 | idx = 0; |
475 | for (i = 0; i < last; i++) { | 474 | ata_for_each_sg(sg, qc) { |
476 | buf[idx++] = cpu_to_le32(sg_dma_address(&sg[i])); | 475 | buf[idx++] = cpu_to_le32(sg_dma_address(sg)); |
477 | buf[idx++] = cpu_to_le32(sg_dma_len(&sg[i])); | 476 | buf[idx++] = cpu_to_le32(sg_dma_len(sg)); |
478 | total_len += sg_dma_len(&sg[i]); | 477 | total_len += sg_dma_len(sg); |
479 | } | 478 | } |
480 | buf[idx - 1] |= cpu_to_le32(ATA_PRD_EOT); | 479 | buf[idx - 1] |= cpu_to_le32(ATA_PRD_EOT); |
481 | sgt_len = idx * 4; | 480 | sgt_len = idx * 4; |