diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-18 22:14:54 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-18 22:14:54 -0400 |
commit | 972c26bdd6b58e7534473c4f7928584578cf43f4 (patch) | |
tree | e32f940cf913ee80ac7ae5e3d92d53f90a6b6552 /drivers/scsi/pdc_adma.c | |
parent | b194b4250c2b7e9d762823ac6045316fcd4bf4f9 (diff) |
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.c | 8 |
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) | |||
293 | 293 | ||
294 | static int adma_fill_sg(struct ata_queued_cmd *qc) | 294 | static int adma_fill_sg(struct ata_queued_cmd *qc) |
295 | { | 295 | { |
296 | struct scatterlist *sg = qc->sg; | 296 | struct scatterlist *sg; |
297 | struct ata_port *ap = qc->ap; | 297 | struct ata_port *ap = qc->ap; |
298 | struct adma_port_priv *pp = ap->private_data; | 298 | struct adma_port_priv *pp = ap->private_data; |
299 | u8 *buf = pp->pkt; | 299 | u8 *buf = pp->pkt; |
300 | int nelem, i = (2 + buf[3]) * 8; | 300 | int i = (2 + buf[3]) * 8; |
301 | u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0); | 301 | u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0); |
302 | 302 | ||
303 | for (nelem = 0; nelem < qc->n_elem; nelem++,sg++) { | 303 | ata_for_each_sg(sg, qc) { |
304 | u32 addr; | 304 | u32 addr; |
305 | u32 len; | 305 | u32 len; |
306 | 306 | ||
@@ -312,7 +312,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc) | |||
312 | *(__le32 *)(buf + i) = cpu_to_le32(len); | 312 | *(__le32 *)(buf + i) = cpu_to_le32(len); |
313 | i += 4; | 313 | i += 4; |
314 | 314 | ||
315 | if ((nelem + 1) == qc->n_elem) | 315 | if (ata_sg_is_last(sg, qc)) |
316 | pFLAGS |= pEND; | 316 | pFLAGS |= pEND; |
317 | buf[i++] = pFLAGS; | 317 | buf[i++] = pFLAGS; |
318 | buf[i++] = qc->dev->dma_mode & 0xf; | 318 | buf[i++] = qc->dev->dma_mode & 0xf; |