summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pdc_adma.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-19 04:14:54 +0200
committerJeff Garzik <jgarzik@pobox.com>2005-10-19 04:14:54 +0200
commit972c26bdd6b58e7534473c4f7928584578cf43f4 (patch)
treee32f940cf913ee80ac7ae5e3d92d53f90a6b6552 /drivers/scsi/pdc_adma.c
parentMerge branch 'upstream' (diff)
downloadlinux-972c26bdd6b58e7534473c4f7928584578cf43f4.tar.xz
linux-972c26bdd6b58e7534473c4f7928584578cf43f4.zip
libata: add ata_sg_is_last() helper, use it in several drivers
Diffstat (limited to 'drivers/scsi/pdc_adma.c')
-rw-r--r--drivers/scsi/pdc_adma.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c
index 53b8db4be1a9..c6825da6ae20 100644
--- a/drivers/scsi/pdc_adma.c
+++ b/drivers/scsi/pdc_adma.c
@@ -293,14 +293,14 @@ static void adma_eng_timeout(struct ata_port *ap)
static int adma_fill_sg(struct ata_queued_cmd *qc)
{
- struct scatterlist *sg = qc->sg;
+ struct scatterlist *sg;
struct ata_port *ap = qc->ap;
struct adma_port_priv *pp = ap->private_data;
u8 *buf = pp->pkt;
- int nelem, i = (2 + buf[3]) * 8;
+ int i = (2 + buf[3]) * 8;
u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0);
- for (nelem = 0; nelem < qc->n_elem; nelem++,sg++) {
+ ata_for_each_sg(sg, qc) {
u32 addr;
u32 len;
@@ -312,7 +312,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
*(__le32 *)(buf + i) = cpu_to_le32(len);
i += 4;
- if ((nelem + 1) == qc->n_elem)
+ if (ata_sg_is_last(sg, qc))
pFLAGS |= pEND;
buf[i++] = pFLAGS;
buf[i++] = qc->dev->dma_mode & 0xf;